Whamcloud - gitweb
9e6e362dd8b48c69af545a922720bef1fa9318a2
[tools/e2fsprogs.git] / tests / d_xattr_sorting / script
1 if test -x $DEBUGFS_EXE; then
2
3 OUT=$test_name.log
4 EXP=$test_dir/expect
5 VERIFY_FSCK_OPT=-yf
6
7 TEST_DATA=$test_name.tmp
8 VERIFY_DATA=$test_name.ver.tmp
9
10 echo "debugfs sort extended attributes" > $OUT
11
12 dd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1
13
14 echo "mke2fs -Fq -b 1024 test.img 512" >> $OUT
15
16 $MKE2FS -Fq -b 1024 $TMPFILE 512 > /dev/null 2>&1
17 status=$?
18 echo Exit status is $status >> $OUT
19
20 B=$(mktemp ${TMPDIR:-/tmp}/b.XXXXXX)
21
22 perl -e 'print "x" x 256;' > $B
23
24 echo "ea_set -f /tmp/b / security.SMEG64" > $OUT.new
25 $DEBUGFS -w -R "ea_set -f $B / security.SMEG64" $TMPFILE >> $OUT.new 2>&1
26 status=$?
27 echo Exit status is $status >> $OUT.new
28 sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
29
30 echo "ea_set -f /tmp/b / security.imb" > $OUT.new
31 $DEBUGFS -w -R "ea_set -f $B / security.imb" $TMPFILE >> $OUT.new 2>&1
32 status=$?
33 echo Exit status is $status >> $OUT.new
34 sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
35
36 echo "ea_set / user.moo cow" > $OUT.new
37 $DEBUGFS -w -R "ea_set / user.moo cow" $TMPFILE >> $OUT.new 2>&1
38 status=$?
39 echo Exit status is $status >> $OUT.new
40 sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
41
42 rm -f $B
43 unset B
44
45 echo "ea_list /" > $OUT.new
46 $DEBUGFS -w -R "ea_list /" $TMPFILE >> $OUT.new 2>&1
47 status=$?
48 echo Exit status is $status >> $OUT.new
49 sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
50
51 echo "ea_get / security.imb" > $OUT.new
52 $DEBUGFS -w -R "ea_get / security.imb" $TMPFILE >> $OUT.new 2>&1
53 status=$?
54 echo Exit status is $status >> $OUT.new
55 sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
56
57 echo "ea_get / security.SMEG64" > $OUT.new
58 $DEBUGFS -w -R "ea_get / security.SMEG64" $TMPFILE >> $OUT.new 2>&1
59 status=$?
60 echo Exit status is $status >> $OUT.new
61 sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
62
63 echo "ea_get / nosuchea" > $OUT.new
64 $DEBUGFS -w -R "ea_get / nosuchea" $TMPFILE >> $OUT.new 2>&1
65 status=$?
66 echo Exit status is $status >> $OUT.new
67 sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
68
69 echo e2fsck $VERIFY_FSCK_OPT -N test_filesys > $OUT.new
70 $FSCK $VERIFY_FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1
71 status=$?
72 echo Exit status is $status >> $OUT.new
73 sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
74
75 #
76 # Do the verification
77 #
78
79 rm -f $TMPFILE $OUT.new
80 cmp -s $OUT $EXP
81 status=$?
82
83 if [ "$status" = 0 ] ; then
84         echo "$test_name: $test_description: ok"
85         touch $test_name.ok
86 else
87         echo "$test_name: $test_description: failed"
88         diff $DIFF_OPTS $EXP $OUT > $test_name.failed
89 fi
90
91 unset VERIFY_FSCK_OPT NATIVE_FSCK_OPT OUT EXP TEST_DATA VERIFY_DATA
92
93 else #if test -x $DEBUGFS_EXE; then
94         echo "$test_name: $test_description: skipped"
95 fi