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