2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2018 Oracle, Inc. All Rights Reserved.
7 # Look for stringified constants in the __print_symbolic format strings,
8 # which suggest that we forgot to TRACE_DEFINE_ENUM somewhere, which causes
9 # incomplete ftrace reporting.
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
17 status=1 # failure is the default!
18 trap "_cleanup; exit \$status" 0 1 2 3 7 15
26 # get standard environment, filters and checks
29 # real QA test starts here
31 _require_command "$CC_PROG" "cc"
35 sedprog=$tmp.ftrace.sed
37 ftrace_dir=$DEBUGFS_MNT/tracing/events/xfs
39 test -d $ftrace_dir || _notrun "ftrace not enabled"
41 # The second argument to __print_symbolic is stringified in the tracepoint's
42 # fmt file, so we look for "{ NUM, STRING }" and try to separate each of them
43 # into single lines so that we can build a C structure. This will (we hope)
44 # catch non-constant numbers that the compiler won't know about.
45 cat > $sedprog << ENDL
54 unsigned long long num;
58 egrep '(__print_flags|__print_symbolic)' $ftrace_dir*/*/format | \
59 sed -f $sedprog | grep '^{' | sort | uniq >> $cprog
63 int main(int argc, char *argv[]) { return 0; }
66 cat $cprog >> $seqres.full
67 echo Compiler errors imply missing TRACE_DEFINE_ENUM.
68 $CC_PROG -o $oprog $cprog
71 echo Silence is golden