fsx: Replace use of bcmp() with memcmp()
[xfstests-dev.git] / 195
1 #! /bin/sh
2 # FS QA Test No. 195
3 #
4 # Make sure the chattr dump flag gets picked up by xfsdump without a sync
5 #
6 # http://oss.sgi.com/bugzilla/show_bug.cgi?id=340
7 #
8 #-----------------------------------------------------------------------
9 # Copyright (c) 2008 Christoph Hellwig.
10 #-----------------------------------------------------------------------
11 #
12 # creator
13 owner=hch@lst.de
14
15 seq=`basename $0`
16 echo "QA output created by $seq"
17
18 here=`pwd`
19 tmp=/tmp/$$
20 status=1        # failure is the default!
21
22 _cleanup()
23 {
24         rm -rf $TEST_DIR/d
25         rm -f $TEST_DIR/dumpfile
26 }
27 trap "_cleanup; exit \$status" 0 1 2 3 15
28
29 #
30 # Perform a level 0 dump that respects the chattr dump exclude flag,
31 # and grep the output for the inode number we expect / do not expect
32 # to be skipped
33 #
34 # Only dump a subtree so we get away with a single partition for
35 # the subtree to be dumped and the dump file.
36 #
37 _do_dump()
38 {
39         xfsdump -l 0 -s d -F  \
40                 -L prova -M prova \
41                 -f $TEST_DIR/dumpfile -e -v excluded_files=debug $TEST_DIR \
42                 | grep "ino $inum" \
43                 | sed -e 's/xfsdump: pruned ino [0-9]*, owner 0, estimated size 0: skip flag set/xfsdump: pruned ino NNN, owner 0, estimated size 0: skip flag set/'
44 }
45
46 # get standard environment, filters and checks
47 . ./common.rc
48 . ./common.filter
49
50 # real QA test starts here
51 _supported_fs xfs
52 _supported_os Linux
53
54 _require_user
55
56 echo "Preparing subtree"
57 mkdir $TEST_DIR/d
58 touch $TEST_DIR/d/t
59 inum=`stat --format "%i" $TEST_DIR/d/t`
60
61 echo "No dump exclude flag set (should not be skipped)"
62 _do_dump
63
64 echo "Dump exclude flag set, but no sync yet (should be skipped)"
65 chattr +d $TEST_DIR/d/t
66 _do_dump
67
68 echo "Dump exclude flag set, after sync (should be skipped)"
69 sync
70 _do_dump
71
72 # success, all done
73 echo "*** done"
74 rm -f $seq.full
75 status=0