1#!/bin/bash 2 3if [ "$(grep -c 'define HAVE_MAGIC_H' ../lib/config.h)" -eq 0 ]; then 4 echo "$test_name: skipped (no magic)" 5 exit 0 6fi 7 8FSCK_OPT=-fn 9IMAGE=$test_dir/image.bz2 10 11bzip2 -d < $IMAGE > $TMPFILE 12$DD if=/dev/zero of=$TMPFILE conv=notrunc oflag=append bs=1024k count=16 > /dev/null 2>&1 13 14# Run fsck to fix things? 15if [ -x $DEBUGFS_EXE ]; then 16 EXP=$test_dir/expect 17else 18 EXP=$test_dir/expect.nodebugfs 19fi 20OUT=$test_name.log 21rm -f $test_name.failed $test_name.ok 22 23echo "*** e2fsck" > $OUT 24$FSCK $FSCK_OPT $TMPFILE >> $OUT 2>&1 25echo "*** debugfs" >> $OUT 26test -x $DEBUGFS_EXE && $DEBUGFS -R 'quit' $TMPFILE >> $OUT 2>&1 27echo "*** tune2fs" >> $OUT 28$TUNE2FS -i 0 $TMPFILE >> $OUT 2>&1 29echo "*** mke2fs" >> $OUT 30$MKE2FS -n $TMPFILE >> $OUT 2>&1 31 32sed -f $cmd_dir/filter.sed < $OUT > $OUT.new 33mv $OUT.new $OUT 34 35# Figure out what happened 36if cmp -s $EXP $OUT; then 37 echo "$test_name: $test_description: ok" 38 touch $test_name.ok 39else 40 echo "$test_name: $test_description: failed" 41 diff -u $EXP $OUT >> $test_name.failed 42fi 43unset EXP OUT FSCK_OPT IMAGE 44