OSDN Git Service

Code drop from //branches/cupcake/...@124589
[android-x86/external-e2fsprogs.git] / tests / defaults / e_script
1 #
2 # Default script for testing the relocation library routines 
3 # (irel -- inode relocation and brel -- block relocation)
4 #
5
6 if [ -f $test_dir/setup ]; then
7         . $test_dir/setup
8 fi
9
10 if [ "$class"x = x ]; then
11         class=`echo $test_name | sed -e 's/e_\([^_]*\)_\(.*\)/\1/'`
12         instance=`echo $test_name | sed -e 's/e_\([^_]*\)_\(.*\)/\2/'`
13 fi
14 if [ "$OUT"x = x ]; then
15         OUT=$test_name.log
16 fi
17 if [ "$EXPECT"x = x ]; then
18         EXPECT=$SRCDIR/progs/test_data/expect.$class
19 fi
20
21 if [ "$class" = irel ]; then
22         TEST_PROG=$TEST_REL
23 elif [ "$class" = brel ]; then
24         TEST_PROG=$TEST_REL
25 elif [ "$class" = icount ]; then
26         TEST_PROG=$TEST_ICOUNT
27 else
28         TEST_PROG=/bin/cat
29 fi
30
31 cat $SRCDIR/progs/test_data/$instance.setup $SRCDIR/progs/test_data/test.$class \
32     | $TEST_PROG -f - 2>&1 | tr -d \\015 > $OUT 
33
34 cmp -s $EXPECT $OUT
35 status=$?
36
37 rm -f $test_name.failed $test_name.ok
38
39 if [ "$status" = 0 ] ; then
40     echo "ok"
41     touch $test_name.ok
42 else
43     echo "failed"
44     diff $DIFF_OPTS $EXPECT $OUT > $test_name.failed
45 fi
46
47 unset EXPECT OUT class instance