• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2
3IMAGE=$test_dir/image.bz2
4
5bzip2 -d < $IMAGE > $TMPFILE
6
7# Run fsck to fix the multiply-claimed block breakage
8FSCK_OPT=-f
9EXP1=$test_dir/expect.1
10OUT1=$test_name.1.log
11
12echo "nyyyyyyy" | E2FSCK_FORCE_INTERACTIVE=y $FSCK $FSCK_OPT -N test_filesys $TMPFILE 2>&1 | head -n 1000 | tail -n +2 > $OUT1
13echo "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
17FSCK_OPT=-fn
18EXP2=$test_dir/expect.2
19OUT2=$test_name.2.log
20
21$FSCK $FSCK_OPT -N test_filesys $TMPFILE 2>&1 | head -n 1000 | tail -n +2 > $OUT2
22echo "Exit status is $?" >> $OUT2
23
24# Figure out what happened
25rm -f $test_name.failed $test_name.ok
26if cmp -s $EXP1 $OUT1 && cmp -s $EXP2 $OUT2; then
27	echo "$test_name: $test_description: ok"
28	touch $test_name.ok
29else
30	echo "$test_name: $test_description: failed"
31	diff -u $EXP1 $OUT1 >> $test_name.failed
32	diff -u $EXP2 $OUT2 >> $test_name.failed
33fi
34unset EXP1 OUT1 EXP2 OUT2 FSCK_OPT IMAGE
35