Debian Codegraph @

tests/d_xattr_edits/script

raw
1 if ! test -x $DEBUGFS_EXE; then
2 echo "$test_name: $test_description: skipped (no debugfs)"
3 return 0
4 fi
5
6 OUT=$test_name.log
7 EXP=$test_dir/expect
8 VERIFY_FSCK_OPT=-yf
9
10 TEST_DATA=$test_name.tmp
11 VERIFY_DATA=$test_name.ver.tmp
12
13 echo "debugfs edit extended attributes" > $OUT.new
14
15 dd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1
16
17 echo "mke2fs -Fq -b 1024 test.img 512" >> $OUT.new
18
19 $MKE2FS -Fq -b 1024 $TMPFILE 512 > /dev/null 2>&1
20 status=$?
21 echo Exit status is $status >> $OUT.new
22
23 echo "ea_set / user.joe smith" >> $OUT.new
24 $DEBUGFS -w -R "ea_set / user.joe smith" $TMPFILE >> $OUT.new 2>&1
25 status=$?
26 echo Exit status is $status >> $OUT.new
27
28 echo "ea_set / user.moo FEE_FIE_FOE_FUMMMMMM" >> $OUT.new
29 $DEBUGFS -w -R "ea_set / user.moo FEE_FIE_FOE_FUMMMMMM" $TMPFILE >> $OUT.new 2>&1
30 status=$?
31 echo Exit status is $status >> $OUT.new
32
33 echo "ea_list /" >> $OUT.new
34 $DEBUGFS -w -R "ea_list /" $TMPFILE >> $OUT.new 2>&1
35 status=$?
36 echo Exit status is $status >> $OUT.new
37
38 echo "ea_get / user.moo" >> $OUT.new
39 $DEBUGFS -w -R "ea_get / user.moo" $TMPFILE >> $OUT.new 2>&1
40 status=$?
41 echo Exit status is $status >> $OUT.new
42
43 echo "ea_get / nosuchea" >> $OUT.new
44 $DEBUGFS -w -R "ea_get / nosuchea" $TMPFILE >> $OUT.new 2>&1
45 status=$?
46 echo Exit status is $status >> $OUT.new
47
48 echo "ea_rm / user.moo" >> $OUT.new
49 $DEBUGFS -w -R "ea_rm / user.moo" $TMPFILE >> $OUT.new 2>&1
50 status=$?
51 echo Exit status is $status >> $OUT.new
52
53 echo "ea_rm / nosuchea" >> $OUT.new
54 $DEBUGFS -w -R "ea_rm / nosuchea" $TMPFILE >> $OUT.new 2>&1
55 status=$?
56 echo Exit status is $status >> $OUT.new
57
58 echo "ea_list /" >> $OUT.new
59 $DEBUGFS -w -R "ea_list /" $TMPFILE >> $OUT.new 2>&1
60 status=$?
61 echo Exit status is $status >> $OUT.new
62
63 echo "ea_get / user.moo" >> $OUT.new
64 $DEBUGFS -w -R "ea_get / user.moo" $TMPFILE >> $OUT.new 2>&1
65 status=$?
66 echo Exit status is $status >> $OUT.new
67
68 echo "ea_rm / user.joe" >> $OUT.new
69 $DEBUGFS -w -R "ea_rm / user.joe" $TMPFILE >> $OUT.new 2>&1
70 status=$?
71 echo Exit status is $status >> $OUT.new
72
73 echo "ea_list /" >> $OUT.new
74 $DEBUGFS -w -R "ea_list /" $TMPFILE >> $OUT.new 2>&1
75 status=$?
76 echo Exit status is $status >> $OUT.new
77
78 echo "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567" > $TEST_DATA
79 echo "ea_set -f $TEST_DATA / user.file_based_xattr" >> $OUT.new
80 $DEBUGFS -w -R "ea_set -f $TEST_DATA / user.file_based_xattr" $TMPFILE >> $OUT.new 2>&1
81 status=$?
82 echo Exit status is $status >> $OUT.new
83
84 echo "ea_list /" >> $OUT.new
85 $DEBUGFS -w -R "ea_list /" $TMPFILE >> $OUT.new 2>&1
86 status=$?
87 echo Exit status is $status >> $OUT.new
88
89 echo "ea_get / user.file_based_xattr" >> $OUT.new
90 $DEBUGFS -w -R "ea_get / user.file_based_xattr" $TMPFILE >> $OUT.new 2>&1
91 status=$?
92 echo Exit status is $status >> $OUT.new
93
94 echo "ea_get -f $VERIFY_DATA / user.file_based_xattr" >> $OUT.new
95 $DEBUGFS -w -R "ea_get -f $VERIFY_DATA / user.file_based_xattr" $TMPFILE >> $OUT.new 2>&1
96 status=$?
97 echo Exit status is $status >> $OUT.new
98
99 echo "Compare big attribute" >> $OUT.new
100 diff -u $TEST_DATA $VERIFY_DATA >> $OUT.new
101
102 echo e2fsck $VERIFY_FSCK_OPT -N test_filesys >> $OUT.new
103 $FSCK $VERIFY_FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1
104 status=$?
105 echo Exit status is $status >> $OUT.new
106 sed -f $cmd_dir/filter.sed $OUT.new > $OUT
107
108 #
109 # Do the verification
110 #
111
112 rm -f $TMPFILE $TEST_DATA $VERIFY_DATA $OUT.new
113 cmp -s $OUT $EXP
114 status=$?
115
116 if [ "$status" = 0 ] ; then
117 echo "$test_name: $test_description: ok"
118 touch $test_name.ok
119 else
120 echo "$test_name: $test_description: failed"
121 diff $DIFF_OPTS $EXP $OUT > $test_name.failed
122 fi
123
124 unset VERIFY_FSCK_OPT NATIVE_FSCK_OPT OUT EXP TEST_DATA VERIFY_DATA