blob: 7e32a5695a7457f5bcdef8bb6166e7c5faced5cd [file] [log] [blame]
IMAGE=$test_dir/image.gz
VERIFY_FSCK_OPT=-yf
SWAP_FSCK_OPT=-Sy
NATIVE_FSCK_OPT=-sy
OUT=$test_name.log
EXP=$test_dir/expect
gunzip < $IMAGE > $TMPFILE
echo "Swapfs test" > $OUT
echo e2fsck $VERIFY_FSCK_OPT -N test_filesys > $OUT.new
$FSCK $VERIFY_FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
sed -e '2d' $OUT.new >> $OUT
echo e2fsck $SWAP_FSCK_OPT -N test_filesys > $OUT.new
$FSCK $SWAP_FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
sed -e '2d' $OUT.new >> $OUT
echo Running debugfs.... >> $OUT
$DEBUGFS -f $test_dir/debugfs.cmd $TMPFILE > $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
sed -e '1d' $OUT.new >> $OUT
echo e2fsck $VERIFY_FSCK_OPT -N test_filesys > $OUT.new
$FSCK $VERIFY_FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
sed -e '2d' $OUT.new >> $OUT
echo e2fsck $NATIVE_FSCK_OPT -N test_filesys > $OUT.new
$FSCK $NATIVE_FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
sed -e '2d' $OUT.new >> $OUT
echo Running debugfs.... >> $OUT
$DEBUGFS -f $test_dir/debugfs.cmd $TMPFILE > $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
sed -e '1d' $OUT.new >> $OUT
echo e2fsck $VERIFY_FSCK_OPT -N test_filesys > $OUT.new
$FSCK $VERIFY_FSCK_OPT -N test_filesys $TMPFILE >> $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
sed -e '2d' $OUT.new >> $OUT
rm -f $OUT.new
rm $TMPFILE
#
# Do the verification
#
rm -f $test_name.ok $test_name.failed
cmp -s $OUT $EXP
status=$?
if [ "$status" = 0 ] ; then
echo "ok"
touch $test_name.ok
else
echo "failed"
diff -c $EXP $OUT > $test_name.failed
fi
unset IMAGE VERIFY_FSCK_OPT SWAP_FSCK_OPT NATIVE_FSCK_OPT OUT EXP