• 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 load/dump test" > $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
23dd if=$TEST_BITS of=$TEST_DATA bs=128k count=1 conv=sync > /dev/null 2>&1
24echo "file fragment odd size" >> $TEST_DATA
25
26echo "debugfs -R ''write $TEST_DATA test_data'' -w test.img" >> $OUT.new
27$DEBUGFS -R "write $TEST_DATA test_data" -w $TMPFILE >> $OUT.new 2>&1
28status=$?
29echo Exit status is $status >> $OUT.new
30
31echo e2fsck $VERIFY_FSCK_OPT -N test_filesys >> $OUT.new
32$FSCK $VERIFY_FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1
33status=$?
34echo Exit status is $status >> $OUT.new
35
36echo "debugfs -R ''dump test_data $VERIFY_DATA'' test.img" >> $OUT.new
37$DEBUGFS -R "dump test_data $VERIFY_DATA" $TMPFILE >> $OUT.new 2>&1
38status=$?
39echo Exit status is $status >> $OUT.new
40
41echo "cmp $TEST_DATA $VERIFY_DATA" >> $OUT.new
42cmp $TEST_DATA $VERIFY_DATA >>$OUT.new
43status=$?
44echo Exit status is $status >> $OUT.new
45sed -f $cmd_dir/filter.sed $OUT.new > $OUT
46
47#
48# Do the verification
49#
50
51if [ "$SKIP_UNLINK" != "true" ]; then
52	rm -f $VERIFY_DATA $TEST_DATA $TMPFILE $OUT.new
53else
54	echo "TMPFILE=$TMPFILE"
55fi
56cmp -s $OUT $EXP
57status=$?
58
59if [ "$status" = 0 ] ; then
60	echo "$test_name: $test_description: ok"
61	touch $test_name.ok
62else
63	echo "$test_name: $test_description: failed"
64	diff $DIFF_OPTS $EXP $OUT > $test_name.failed
65fi
66
67unset VERIFY_FSCK_OPT NATIVE_FSCK_OPT OUT EXP TEST_DATA VERIFY_DATA
68