Theodore Ts'o | 1cca86f | 2003-09-01 09:28:18 -0400 | [diff] [blame] | 1 | if [ "$DESCRIPTION"x != x ]; then |
Matthias Andree | 0ac93a0 | 2006-05-30 15:47:05 +0200 | [diff] [blame] | 2 | printf "%s" "$DESCRIPTION: " |
Theodore Ts'o | 1cca86f | 2003-09-01 09:28:18 -0400 | [diff] [blame] | 3 | fi |
Theodore Ts'o | a418d3a | 1997-04-26 14:00:26 +0000 | [diff] [blame] | 4 | if [ "$IMAGE"x = x ]; then |
| 5 | IMAGE=$test_dir/image.gz |
| 6 | fi |
| 7 | |
| 8 | if [ "$FSCK_OPT"x = x ]; then |
| 9 | FSCK_OPT=-yf |
| 10 | fi |
| 11 | |
| 12 | if [ "$SECOND_FSCK_OPT"x = x ]; then |
| 13 | SECOND_FSCK_OPT=-yf |
| 14 | fi |
| 15 | |
| 16 | if [ "$OUT1"x = x ]; then |
| 17 | OUT1=$test_name.1.log |
| 18 | fi |
| 19 | |
| 20 | if [ "$OUT2"x = x ]; then |
| 21 | OUT2=$test_name.2.log |
| 22 | fi |
| 23 | |
| 24 | if [ "$EXP1"x = x ]; then |
Theodore Ts'o | 89e9fc4 | 2003-09-03 09:51:52 -0400 | [diff] [blame] | 25 | if [ -f $test_dir/expect.1.gz ]; then |
| 26 | EXP1=tmp_expect |
| 27 | gunzip < $test_dir/expect.1.gz > $EXP1 |
| 28 | else |
| 29 | EXP1=$test_dir/expect.1 |
| 30 | fi |
Theodore Ts'o | a418d3a | 1997-04-26 14:00:26 +0000 | [diff] [blame] | 31 | fi |
| 32 | |
| 33 | if [ "$EXP2"x = x ]; then |
Theodore Ts'o | 89e9fc4 | 2003-09-03 09:51:52 -0400 | [diff] [blame] | 34 | if [ -f $test_dir/expect.2.gz ]; then |
| 35 | EXP2=tmp_expect |
| 36 | gunzip < $test_dir/expect.2.gz > $EXP2 |
| 37 | else |
| 38 | EXP2=$test_dir/expect.2 |
| 39 | fi |
Theodore Ts'o | a418d3a | 1997-04-26 14:00:26 +0000 | [diff] [blame] | 40 | fi |
| 41 | |
Theodore Ts'o | 1cca86f | 2003-09-01 09:28:18 -0400 | [diff] [blame] | 42 | if [ "$SKIP_GUNZIP" != "true" ] ; then |
| 43 | gunzip < $IMAGE > $TMPFILE |
| 44 | fi |
| 45 | |
| 46 | cp /dev/null $OUT1 |
Theodore Ts'o | a418d3a | 1997-04-26 14:00:26 +0000 | [diff] [blame] | 47 | |
Theodore Ts'o | 0444e15 | 1999-11-10 13:17:24 +0000 | [diff] [blame] | 48 | eval $PREP_CMD |
| 49 | |
Theodore Ts'o | a418d3a | 1997-04-26 14:00:26 +0000 | [diff] [blame] | 50 | $FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT1.new 2>&1 |
| 51 | status=$? |
| 52 | echo Exit status is $status >> $OUT1.new |
Theodore Ts'o | 1cca86f | 2003-09-01 09:28:18 -0400 | [diff] [blame] | 53 | sed -e '1d' $OUT1.new | sed -e '/^JFS DEBUG:/d' | tr -d \\015 >> $OUT1 |
Theodore Ts'o | a418d3a | 1997-04-26 14:00:26 +0000 | [diff] [blame] | 54 | rm -f $OUT1.new |
| 55 | |
| 56 | if [ "$ONE_PASS_ONLY" != "true" ]; then |
| 57 | $FSCK $SECOND_FSCK_OPT -N test_filesys $TMPFILE > $OUT2.new 2>&1 |
| 58 | status=$? |
| 59 | echo Exit status is $status >> $OUT2.new |
Theodore Ts'o | 7d4343d | 2002-02-12 02:34:44 -0500 | [diff] [blame] | 60 | sed -e '1d' $OUT2.new | sed -e '/^JFS DEBUG:/d' > $OUT2 |
Theodore Ts'o | a418d3a | 1997-04-26 14:00:26 +0000 | [diff] [blame] | 61 | rm -f $OUT2.new |
| 62 | fi |
| 63 | |
Theodore Ts'o | 89e9fc4 | 2003-09-03 09:51:52 -0400 | [diff] [blame] | 64 | eval $AFTER_CMD |
| 65 | |
| 66 | if [ "$SKIP_UNLINK" != "true" ] ; then |
| 67 | rm $TMPFILE |
| 68 | fi |
Theodore Ts'o | a418d3a | 1997-04-26 14:00:26 +0000 | [diff] [blame] | 69 | |
| 70 | if [ "$SKIP_VERIFY" != "true" ] ; then |
| 71 | rm -f $test_name.ok $test_name.failed |
| 72 | cmp -s $OUT1 $EXP1 |
| 73 | status1=$? |
| 74 | if [ "$ONE_PASS_ONLY" != "true" ]; then |
| 75 | cmp -s $OUT2 $EXP2 |
| 76 | status2=$? |
| 77 | else |
| 78 | status2=0 |
| 79 | fi |
| 80 | |
| 81 | if [ "$status1" = 0 -a "$status2" = 0 ] ; then |
| 82 | echo "ok" |
| 83 | touch $test_name.ok |
| 84 | else |
| 85 | echo "failed" |
Theodore Ts'o | d82f890 | 2005-06-16 15:08:00 -0400 | [diff] [blame] | 86 | diff $DIFF_OPTS $EXP1 $OUT1 > $test_name.failed |
Theodore Ts'o | a418d3a | 1997-04-26 14:00:26 +0000 | [diff] [blame] | 87 | if [ "$ONE_PASS_ONLY" != "true" ]; then |
Theodore Ts'o | d82f890 | 2005-06-16 15:08:00 -0400 | [diff] [blame] | 88 | diff $DIFF_OPTS $EXP2 $OUT2 >> $test_name.failed |
Theodore Ts'o | a418d3a | 1997-04-26 14:00:26 +0000 | [diff] [blame] | 89 | fi |
| 90 | fi |
Theodore Ts'o | 89e9fc4 | 2003-09-03 09:51:52 -0400 | [diff] [blame] | 91 | rm -f tmp_expect |
Theodore Ts'o | a418d3a | 1997-04-26 14:00:26 +0000 | [diff] [blame] | 92 | fi |
| 93 | |
| 94 | if [ "$SKIP_CLEANUP" != "true" ] ; then |
Theodore Ts'o | 1cca86f | 2003-09-01 09:28:18 -0400 | [diff] [blame] | 95 | unset IMAGE FSCK_OPT SECOND_FSCK_OPT OUT1 OUT2 EXP1 EXP2 |
| 96 | unset SKIP_VERIFY SKIP_CLEANUP SKIP_GUNZIP ONE_PASS_ONLY PREP_CMD |
Theodore Ts'o | 89e9fc4 | 2003-09-03 09:51:52 -0400 | [diff] [blame] | 97 | unset DESCRIPTION SKIP_UNLINK AFTER_CMD |
Theodore Ts'o | a418d3a | 1997-04-26 14:00:26 +0000 | [diff] [blame] | 98 | fi |
Theodore Ts'o | 1e3472c | 1997-04-29 14:53:37 +0000 | [diff] [blame] | 99 | |