btrfs/012: check free size of scratch device before copying files
[xfstests-dev.git] / tests / xfs / 499
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2018 Oracle, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 499
6 #
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.
10 #
11 seq=`basename $0`
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
14
15 here=`pwd`
16 tmp=/tmp/$$
17 status=1        # failure is the default!
18 trap "_cleanup; exit \$status" 0 1 2 3 7 15
19
20 _cleanup()
21 {
22         cd /
23         rm -rf $tmp.*
24 }
25
26 # get standard environment, filters and checks
27 . ./common/rc
28
29 # real QA test starts here
30 _supported_fs xfs
31 _require_command "$CC_PROG" "cc"
32
33 cprog=$tmp.ftrace.c
34 oprog=$tmp.ftrace
35 sedprog=$tmp.ftrace.sed
36
37 ftrace_dir=$DEBUGFS_MNT/tracing/events/xfs
38
39 test -d $ftrace_dir || _notrun "ftrace not enabled"
40
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
46 s/}, /},\n/g
47 s/}),/},\n/g
48 s/})/},\n/g
49 s/, {/\n{/g
50 ENDL
51
52 cat > $cprog << ENDL
53 struct ftrace_chk {
54         unsigned long long      num;
55         char                    *str;
56 } syms[] = {
57 ENDL
58 egrep '(__print_flags|__print_symbolic)' $ftrace_dir*/*/format | \
59         sed -f $sedprog | grep '^{' | sort | uniq >> $cprog
60 cat >> $cprog << ENDL
61 };
62
63 int main(int argc, char *argv[]) { return 0; }
64 ENDL
65
66 cat $cprog >> $seqres.full
67 echo Compiler errors imply missing TRACE_DEFINE_ENUM.
68 $CC_PROG -o $oprog $cprog
69
70 # success, all done
71 echo Silence is golden
72 status=0
73 exit