script revision f9fd342e568dbadaadbb0b242f14271cb384c38b
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 create special files" > $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
20$DEBUGFS -w $TMPFILE << EOF > /dev/null 2>&1
21set_current_time 201301151400
22set_super_value lastcheck 0
23set_super_value hash_seed null
24set_super_value mkfs_time 0
25symlink foo bar
26symlink foo2 12345678901234567890123456789012345678901234567890123456789012345678901234567890
27mknod pipe p
28mknod sda b 8 0
29mknod null c 1 3
30EOF
31
32echo "debugfs -R ''stat foo'' -w test.img" > $OUT.new
33$DEBUGFS -R "stat foo" -w $TMPFILE >> $OUT.new 2>&1
34status=$?
35echo Exit status is $status >> $OUT.new
36sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
37
38echo "debugfs -R ''stat foo2'' -w test.img" > $OUT.new
39$DEBUGFS -R "stat foo2" -w $TMPFILE >> $OUT.new 2>&1
40status=$?
41echo Exit status is $status >> $OUT.new
42sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
43
44echo "debugfs -R ''block_dump 28'' -w test.img" > $OUT.new
45$DEBUGFS -R "block_dump 28" -w $TMPFILE >> $OUT.new 2>&1
46status=$?
47echo Exit status is $status >> $OUT.new
48sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
49
50echo "debugfs -R ''stat pipe'' -w test.img" > $OUT.new
51$DEBUGFS -R "stat pipe" -w $TMPFILE >> $OUT.new 2>&1
52status=$?
53echo Exit status is $status >> $OUT.new
54sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
55
56echo "debugfs -R ''stat sda'' -w test.img" > $OUT.new
57$DEBUGFS -R "stat sda" -w $TMPFILE >> $OUT.new 2>&1
58status=$?
59echo Exit status is $status >> $OUT.new
60sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
61
62echo "debugfs -R ''stat null'' -w test.img" > $OUT.new
63$DEBUGFS -R "stat null" -w $TMPFILE >> $OUT.new 2>&1
64status=$?
65echo Exit status is $status >> $OUT.new
66sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
67
68echo e2fsck $VERIFY_FSCK_OPT -N test_filesys > $OUT.new
69$FSCK $VERIFY_FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1
70status=$?
71echo Exit status is $status >> $OUT.new
72sed -f $cmd_dir/filter.sed $OUT.new >> $OUT
73
74#
75# Do the verification
76#
77
78rm -f $TMPFILE $OUT.new
79cmp -s $OUT $EXP
80status=$?
81
82if [ "$status" = 0 ] ; then
83	echo "$test_name: $test_description: ok"
84	touch $test_name.ok
85else
86	echo "$test_name: $test_description: failed"
87	diff $DIFF_OPTS $EXP $OUT > $test_name.failed
88fi
89
90unset VERIFY_FSCK_OPT NATIVE_FSCK_OPT OUT EXP TEST_DATA VERIFY_DATA
91
92else #if test -x $DEBUGFS_EXE; then
93	echo "$test_name: $test_description: skipped"
94fi 
95