1#!/bin/bash
2
3# Run this test with a specific time, because we're crosslinking an extent tree
4# block with the inode table.  When fsck sets dtime to now, we want "now" to be
5# our preprogrammed value.
6
7FSCK_OPT=-fy
8IMAGE=$test_dir/image.gz
9E2FSCK_TIME=4294967294
10export E2FSCK_TIME
11
12gzip -d < $IMAGE > $TMPFILE
13
14# Run fsck to fix things?
15EXP1=$test_dir/expect.1
16OUT1=$test_name.1.log
17rm -rf $test_name.failed $test_name.ok
18
19$FSCK $FSCK_OPT -N test_filesys $TMPFILE 2>&1 | tail -n +2 > $OUT1
20echo "Exit status is $?" >> $OUT1
21
22# Run a second time
23EXP2=$test_dir/expect.2
24OUT2=$test_name.2.log
25
26$FSCK $FSCK_OPT -N test_filesys $TMPFILE 2>&1 | tail -n +2 > $OUT2
27echo "Exit status is $?" >> $OUT2
28
29# Figure out what happened
30if cmp -s $EXP1 $OUT1 && cmp -s $EXP2 $OUT2; then
31	echo "$test_name: $test_description: ok"
32	touch $test_name.ok
33else
34	echo "$test_name: $test_description: failed"
35	diff -u $EXP1 $OUT1 >> $test_name.failed
36	diff -u $EXP2 $OUT2 >> $test_name.failed
37fi
38