]> git.ipfire.org Git - thirdparty/e2fsprogs.git/blob - tests/d_loaddump/script
tests: clean up $DEBUGFS_EXE usage in scripts
[thirdparty/e2fsprogs.git] / tests / d_loaddump / script
1 if ! test -x $DEBUGFS_EXE; then
2 echo "$test_name: $test_description: skipped (no debugfs)"
3 return 0
4 fi
5
6 OUT=$test_name.log
7 EXP=$test_dir/expect
8 VERIFY_FSCK_OPT=-yf
9
10 TEST_DATA=$test_name.tmp
11 VERIFY_DATA=$test_name.ver.tmp
12
13 echo "debugfs load/dump test" > $OUT
14
15 dd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1
16
17 echo "mke2fs -Fq -b 1024 test.img 512" >> $OUT
18
19 $MKE2FS -Fq -b 1024 $TMPFILE 512 > /dev/null 2>&1
20 status=$?
21 echo Exit status is $status >> $OUT
22
23 dd if=$TEST_BITS of=$TEST_DATA bs=128k count=1 conv=sync > /dev/null 2>&1
24 echo "file fragment odd size" >> $TEST_DATA
25
26 echo "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
28 status=$?
29 echo Exit status is $status >> $OUT.new
30 sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
31
32 echo e2fsck $VERIFY_FSCK_OPT -N test_filesys > $OUT.new
33 $FSCK $VERIFY_FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1
34 status=$?
35 echo Exit status is $status >> $OUT.new
36 sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
37
38 echo "debugfs -R ''dump test_data $VERIFY_DATA'' test.img" > $OUT.new
39 $DEBUGFS -R "dump test_data $VERIFY_DATA" $TMPFILE >> $OUT.new 2>&1
40 status=$?
41 echo Exit status is $status >> $OUT.new
42 sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
43
44 echo "cmp $TEST_DATA $VERIFY_DATA" >> $OUT
45 cmp $TEST_DATA $VERIFY_DATA >>$OUT
46 status=$?
47 echo Exit status is $status >> $OUT
48
49 #
50 # Do the verification
51 #
52
53 if [ "$SKIP_UNLINK" != "true" ]; then
54 rm -f $VERIFY_DATA $TEST_DATA $TMPFILE $OUT.new
55 else
56 echo "TMPFILE=$TMPFILE"
57 fi
58 cmp -s $OUT $EXP
59 status=$?
60
61 if [ "$status" = 0 ] ; then
62 echo "$test_name: $test_description: ok"
63 touch $test_name.ok
64 else
65 echo "$test_name: $test_description: failed"
66 diff $DIFF_OPTS $EXP $OUT > $test_name.failed
67 fi
68
69 unset VERIFY_FSCK_OPT NATIVE_FSCK_OPT OUT EXP TEST_DATA VERIFY_DATA