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 sort 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
20B=$(mktemp ${TMPDIR:-/tmp}/b.XXXXXX)
21
22perl -e 'print "x" x 256;' > $B
23
24echo "ea_set -f /tmp/b / security.SMEG64" > $OUT.new
25$DEBUGFS -w -R "ea_set -f $B / security.SMEG64" $TMPFILE >> $OUT.new 2>&1
26status=$?
27echo Exit status is $status >> $OUT.new
28sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
29
30echo "ea_set -f /tmp/b / security.imb" > $OUT.new
31$DEBUGFS -w -R "ea_set -f $B / security.imb" $TMPFILE >> $OUT.new 2>&1
32status=$?
33echo Exit status is $status >> $OUT.new
34sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
35
36echo "ea_set / user.moo cow" > $OUT.new
37$DEBUGFS -w -R "ea_set / user.moo cow" $TMPFILE >> $OUT.new 2>&1
38status=$?
39echo Exit status is $status >> $OUT.new
40sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
41
42rm -f $B
43unset B
44
45echo "ea_list /" > $OUT.new
46$DEBUGFS -w -R "ea_list /" $TMPFILE >> $OUT.new 2>&1
47status=$?
48echo Exit status is $status >> $OUT.new
49sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
50
51echo "ea_get / security.imb" > $OUT.new
52$DEBUGFS -w -R "ea_get / security.imb" $TMPFILE >> $OUT.new 2>&1
53status=$?
54echo Exit status is $status >> $OUT.new
55sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
56
57echo "ea_get / nosuchea" > $OUT.new
58$DEBUGFS -w -R "ea_get / nosuchea" $TMPFILE >> $OUT.new 2>&1
59status=$?
60echo Exit status is $status >> $OUT.new
61sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
62
63echo e2fsck $VERIFY_FSCK_OPT -N test_filesys > $OUT.new
64$FSCK $VERIFY_FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1
65status=$?
66echo Exit status is $status >> $OUT.new
67sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
68
69#
70# Do the verification
71#
72
73rm -f $TMPFILE $OUT.new
74cmp -s $OUT $EXP
75status=$?
76
77if [ "$status" = 0 ] ; then
78	echo "$test_name: $test_description: ok"
79	touch $test_name.ok
80else
81	echo "$test_name: $test_description: failed"
82	diff $DIFF_OPTS $EXP $OUT > $test_name.failed
83fi
84
85unset VERIFY_FSCK_OPT NATIVE_FSCK_OPT OUT EXP TEST_DATA VERIFY_DATA
86
87else #if test -x $DEBUGFS_EXE; then
88	echo "$test_name: $test_description: skipped"
89fi
90