• 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 edit 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
23echo "ea_set / user.joe smith" >> $OUT.new
24$DEBUGFS -w -R "ea_set / user.joe smith" $TMPFILE >> $OUT.new 2>&1
25status=$?
26echo Exit status is $status >> $OUT.new
27
28echo "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
30status=$?
31echo Exit status is $status >> $OUT.new
32
33echo "ea_list /" >> $OUT.new
34$DEBUGFS -w -R "ea_list /" $TMPFILE >> $OUT.new 2>&1
35status=$?
36echo Exit status is $status >> $OUT.new
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
42
43echo "ea_get / nosuchea" >> $OUT.new
44$DEBUGFS -w -R "ea_get / nosuchea" $TMPFILE >> $OUT.new 2>&1
45status=$?
46echo Exit status is $status >> $OUT.new
47
48echo "ea_rm / user.moo" >> $OUT.new
49$DEBUGFS -w -R "ea_rm / user.moo" $TMPFILE >> $OUT.new 2>&1
50status=$?
51echo Exit status is $status >> $OUT.new
52
53echo "ea_rm / nosuchea" >> $OUT.new
54$DEBUGFS -w -R "ea_rm / nosuchea" $TMPFILE >> $OUT.new 2>&1
55status=$?
56echo Exit status is $status >> $OUT.new
57
58echo "ea_list /" >> $OUT.new
59$DEBUGFS -w -R "ea_list /" $TMPFILE >> $OUT.new 2>&1
60status=$?
61echo Exit status is $status >> $OUT.new
62
63echo "ea_get / user.moo" >> $OUT.new
64$DEBUGFS -w -R "ea_get / user.moo" $TMPFILE >> $OUT.new 2>&1
65status=$?
66echo Exit status is $status >> $OUT.new
67
68echo "ea_rm / user.joe" >> $OUT.new
69$DEBUGFS -w -R "ea_rm / user.joe" $TMPFILE >> $OUT.new 2>&1
70status=$?
71echo Exit status is $status >> $OUT.new
72
73echo "ea_list /" >> $OUT.new
74$DEBUGFS -w -R "ea_list /" $TMPFILE >> $OUT.new 2>&1
75status=$?
76echo Exit status is $status >> $OUT.new
77
78echo "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567" > $TEST_DATA
79echo "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
81status=$?
82echo Exit status is $status >> $OUT.new
83
84echo "ea_list /" >> $OUT.new
85$DEBUGFS -w -R "ea_list /" $TMPFILE >> $OUT.new 2>&1
86status=$?
87echo Exit status is $status >> $OUT.new
88
89echo "ea_get / user.file_based_xattr" >> $OUT.new
90$DEBUGFS -w -R "ea_get / user.file_based_xattr" $TMPFILE >> $OUT.new 2>&1
91status=$?
92echo Exit status is $status >> $OUT.new
93
94echo "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
96status=$?
97echo Exit status is $status >> $OUT.new
98
99echo "Compare big attribute" >> $OUT.new
100diff -u $TEST_DATA $VERIFY_DATA >> $OUT.new
101
102echo e2fsck $VERIFY_FSCK_OPT -N test_filesys >> $OUT.new
103$FSCK $VERIFY_FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1
104status=$?
105echo Exit status is $status >> $OUT.new
106sed -f $cmd_dir/filter.sed $OUT.new > $OUT
107
108#
109# Do the verification
110#
111
112rm -f $TMPFILE $TEST_DATA $VERIFY_DATA $OUT.new
113cmp -s $OUT $EXP
114status=$?
115
116if [ "$status" = 0 ] ; then
117	echo "$test_name: $test_description: ok"
118	touch $test_name.ok
119else
120	echo "$test_name: $test_description: failed"
121	diff $DIFF_OPTS $EXP $OUT > $test_name.failed
122fi
123
124unset VERIFY_FSCK_OPT NATIVE_FSCK_OPT OUT EXP TEST_DATA VERIFY_DATA
125