blob: 2fd5969eea49e5b6f067585abc922ffce1f9c14b [file] [log] [blame]
OUT=$test_name.log
EXP=$test_dir/expect
VERIFY_FSCK_OPT=-yf
TEST_DATA=test.data
VERIFY_DATA=test.verify
echo "debugfs load/dump test" > $OUT
dd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1
echo "mke2fs -Fq -b 1024 $TMPFILE 512" >> $OUT
$MKE2FS -Fq $TMPFILE 512 > /dev/null 2>&1
status=$?
echo Exit status is $status >> $OUT
dd if=$DEBUGFS of=$TEST_DATA bs=128k count=1 conv=sync > /dev/null 2>&1
echo "file fragment odd size" >> $TEST_DATA
echo "debugfs -R ''write $TEST_DATA test_data'' -w $TMPFILE" > $OUT.new
$DEBUGFS -R "write $TEST_DATA test_data" -w $TMPFILE >> $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
sed -e '2d' $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 "debugfs -R ''dump test_data $VERIFY_DATA'' $TMPFILE" > $OUT.new
$DEBUGFS -R "dump test_data $VERIFY_DATA" $TMPFILE >> $OUT.new 2>&1
status=$?
echo Exit status is $status >> $OUT.new
sed -e '2d' $OUT.new >> $OUT
echo "cmp $TEST_DATA $VERIFY_DATA" >> $OUT
cmp $TEST_DATA $VERIFY_DATA >>$OUT
status=$?
echo Exit status is $status >> $OUT
#
# Do the verification
#
rm -f $test_name.ok $test_name.failed $VERIFY_DATA $TEST_DATA $TMPFILE
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 VERIFY_FSCK_OPT NATIVE_FSCK_OPT OUT EXP TEST_DATA VERIFY_DATA