1821fc8ca32bec735c431ef58297a905900cb43e6Darrick J. Wong#!/bin/bash 2821fc8ca32bec735c431ef58297a905900cb43e6Darrick J. Wong 3821fc8ca32bec735c431ef58297a905900cb43e6Darrick J. WongFSCK_OPT=-fy 4821fc8ca32bec735c431ef58297a905900cb43e6Darrick J. WongIMAGE=$test_dir/image.bz2 5821fc8ca32bec735c431ef58297a905900cb43e6Darrick J. Wong 6821fc8ca32bec735c431ef58297a905900cb43e6Darrick J. Wongbzip2 -d < $IMAGE > $TMPFILE 7821fc8ca32bec735c431ef58297a905900cb43e6Darrick J. Wong 8821fc8ca32bec735c431ef58297a905900cb43e6Darrick J. Wong# Run fsck to fix things? 9821fc8ca32bec735c431ef58297a905900cb43e6Darrick J. WongEXP1=$test_dir/expect.1 10821fc8ca32bec735c431ef58297a905900cb43e6Darrick J. WongOUT1=$test_name.1.log 11821fc8ca32bec735c431ef58297a905900cb43e6Darrick J. Wongrm -rf $test_name.failed $test_name.ok 12821fc8ca32bec735c431ef58297a905900cb43e6Darrick J. Wong 13821fc8ca32bec735c431ef58297a905900cb43e6Darrick J. Wong$FSCK $FSCK_OPT -N test_filesys $TMPFILE 2>&1 | head -n 1000 | tail -n +2 > $OUT1 14821fc8ca32bec735c431ef58297a905900cb43e6Darrick J. Wongecho "Exit status is $?" >> $OUT1 15821fc8ca32bec735c431ef58297a905900cb43e6Darrick J. Wong 16821fc8ca32bec735c431ef58297a905900cb43e6Darrick J. Wong# Run a second time 17821fc8ca32bec735c431ef58297a905900cb43e6Darrick J. WongEXP2=$test_dir/expect.2 18821fc8ca32bec735c431ef58297a905900cb43e6Darrick J. WongOUT2=$test_name.2.log 19821fc8ca32bec735c431ef58297a905900cb43e6Darrick J. Wong 20821fc8ca32bec735c431ef58297a905900cb43e6Darrick J. Wong$FSCK $FSCK_OPT -N test_filesys $TMPFILE 2>&1 | head -n 1000 | tail -n +2 > $OUT2 21821fc8ca32bec735c431ef58297a905900cb43e6Darrick J. Wongecho "Exit status is $?" >> $OUT2 22821fc8ca32bec735c431ef58297a905900cb43e6Darrick J. Wong 23821fc8ca32bec735c431ef58297a905900cb43e6Darrick J. Wong# Figure out what happened 24821fc8ca32bec735c431ef58297a905900cb43e6Darrick J. Wongif cmp -s $EXP1 $OUT1 && cmp -s $EXP2 $OUT2; then 25821fc8ca32bec735c431ef58297a905900cb43e6Darrick J. Wong echo "$test_name: $test_description: ok" 26821fc8ca32bec735c431ef58297a905900cb43e6Darrick J. Wong touch $test_name.ok 27821fc8ca32bec735c431ef58297a905900cb43e6Darrick J. Wongelse 28821fc8ca32bec735c431ef58297a905900cb43e6Darrick J. Wong echo "$test_name: $test_description: failed" 29821fc8ca32bec735c431ef58297a905900cb43e6Darrick J. Wong diff -u $EXP1 $OUT1 >> $test_name.failed 30821fc8ca32bec735c431ef58297a905900cb43e6Darrick J. Wong diff -u $EXP2 $OUT2 >> $test_name.failed 31821fc8ca32bec735c431ef58297a905900cb43e6Darrick J. Wongfi 32