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