Whamcloud - gitweb
tests: fix test scripts that don't work on non-Linux systems.
[tools/e2fsprogs.git] / tests / m_mmp_bad_magic / script
1 # use current directory instead of /tmp becase tmpfs doesn't support DIO
2 rm -f $TMPFILE
3 TMPFILE=$(mktemp ./tmp-$test_name.XXXXXX)
4
5 stat -f $TMPFILE | grep -q "Type: tmpfs"
6 if [ $? = 0 ]; then
7         rm -f $TMPFILE
8         echo "$test_name: $test_description: skipped for tmpfs (no O_DIRECT)"
9         return 0
10 fi
11 gzip -dc < $test_dir/image.gz > $TMPFILE
12
13 OUT=$test_name.log
14 EXP=$test_dir/expect
15 $FSCK -fy $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed > $OUT
16 echo Exit status is $? >> $OUT
17
18 rm -f $TMPFILE
19 cmp -s $OUT $EXP
20 status=$?
21
22 if [ "$status" = 0 ] ; then
23         echo "$test_name: $test_description: ok"
24         touch $test_name.ok
25 else
26         echo "$test_name: $test_description: failed"
27         diff $DIFF_OPTS $EXP $OUT > $test_name.failed
28         rm -f $test_name.tmp
29 fi
30 unset OUT EXP