| 1 |
if ! test -x $DEBUGFS_EXE; then |
| 2 |
echo "$test_name: $test_description: skipped (no debugfs)" |
| 3 |
return 0 |
| 4 |
fi |
| 5 |
|
| 6 |
IMAGE=$test_dir/image.gz |
| 7 |
FSCK_OPT=-fy |
| 8 |
OUT=$test_name.log |
| 9 |
if [ -f $test_dir/expect.gz ]; then |
| 10 |
EXP=$test_name.tmp |
| 11 |
gunzip < $test_dir/expect.gz > $EXP1 |
| 12 |
else |
| 13 |
EXP=$test_dir/expect |
| 14 |
fi |
| 15 |
|
| 16 |
gzip -d < $IMAGE > $TMPFILE |
| 17 |
|
| 18 |
$FSCK -fy -N test_filesys $TMPFILE > $OUT.new 2>&1 |
| 19 |
status=$? |
| 20 |
echo Exit status is $status >> $OUT.new |
| 21 |
|
| 22 |
$FSCK -fy -N test_filesys $TMPFILE >> $OUT.new 2>&1 |
| 23 |
status=$? |
| 24 |
echo Exit status is $status >> $OUT.new |
| 25 |
|
| 26 |
echo "cat /a" > $TMPFILE.cmd |
| 27 |
echo >> $TMPFILE.cmd |
| 28 |
$DEBUGFS -f $TMPFILE.cmd $TMPFILE >> $OUT.new 2>&1 |
| 29 |
sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT.new > $OUT |
| 30 |
rm -f $TMPFILE $TMPFILE.cmd $OUT.new |
| 31 |
|
| 32 |
cmp -s $OUT $EXP |
| 33 |
status=$? |
| 34 |
|
| 35 |
if [ "$status" = 0 ] ; then |
| 36 |
echo "$test_name: $test_description: ok" |
| 37 |
touch $test_name.ok |
| 38 |
else |
| 39 |
echo "$test_name: $test_description: failed" |
| 40 |
diff $DIFF_OPTS $EXP $OUT > $test_name.failed |
| 41 |
rm -f $test_name.tmp |
| 42 |
fi |
| 43 |
|
| 44 |
unset IMAGE FSCK_OPT OUT EXP |