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 _begin_fstest auto quick
14 _register_cleanup "_cleanup" BUS
16 # Import common functions.
18 # real QA test starts here
20 _require_command "$CC_PROG" "cc"
24 sedprog=$tmp.ftrace.sed
26 ftrace_dir=$DEBUGFS_MNT/tracing/events/xfs
28 test -d $ftrace_dir || _notrun "ftrace not enabled"
30 # The second argument to __print_symbolic is stringified in the tracepoint's
31 # fmt file, so we look for "{ NUM, STRING }" and try to separate each of them
32 # into single lines so that we can build a C structure. This will (we hope)
33 # catch non-constant numbers that the compiler won't know about.
34 cat > $sedprog << ENDL
43 unsigned long long num;
47 egrep '(__print_flags|__print_symbolic)' $ftrace_dir*/*/format | \
48 sed -f $sedprog | grep '^{' | sort | uniq >> $cprog
52 int main(int argc, char *argv[]) { return 0; }
55 cat $cprog >> $seqres.full
56 echo Compiler errors imply missing TRACE_DEFINE_ENUM.
57 $CC_PROG -o $oprog $cprog
60 echo Silence is golden