| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
IMAGE=$test_dir/image.bz2 |
| 4 |
|
| 5 |
bzip2 -d < $IMAGE > $TMPFILE |
| 6 |
|
| 7 |
# Run fsck to fix the multiply-claimed block breakage |
| 8 |
FSCK_OPT=-f |
| 9 |
EXP1=$test_dir/expect.1 |
| 10 |
OUT1=$test_name.1.log |
| 11 |
|
| 12 |
echo "nyyyyyyy" | E2FSCK_FORCE_INTERACTIVE=y $FSCK $FSCK_OPT -N test_filesys $TMPFILE 2>&1 | head -n 1000 | tail -n +2 > $OUT1 |
| 13 |
echo "Exit status is $?" >> $OUT1 |
| 14 |
|
| 15 |
# Run a second time to verify that fsck completely repaired everything in |
| 16 |
# the first run, including quota corrections |
| 17 |
FSCK_OPT=-fn |
| 18 |
EXP2=$test_dir/expect.2 |
| 19 |
OUT2=$test_name.2.log |
| 20 |
|
| 21 |
$FSCK $FSCK_OPT -N test_filesys $TMPFILE 2>&1 | head -n 1000 | tail -n +2 > $OUT2 |
| 22 |
echo "Exit status is $?" >> $OUT2 |
| 23 |
|
| 24 |
# Figure out what happened |
| 25 |
rm -f $test_name.failed $test_name.ok |
| 26 |
if cmp -s $EXP1 $OUT1 && cmp -s $EXP2 $OUT2; then |
| 27 |
echo "$test_name: $test_description: ok" |
| 28 |
touch $test_name.ok |
| 29 |
else |
| 30 |
echo "$test_name: $test_description: failed" |
| 31 |
diff -u $EXP1 $OUT1 >> $test_name.failed |
| 32 |
diff -u $EXP2 $OUT2 >> $test_name.failed |
| 33 |
fi |
| 34 |
unset EXP1 OUT1 EXP2 OUT2 FSCK_OPT IMAGE |