xref: /aosp_15_r20/external/e2fsprogs/tests/defaults/e_script (revision 6a54128f25917bfc36a8a6e9d722c04a0b4641b6)
1*6a54128fSAndroid Build Coastguard Worker#
2*6a54128fSAndroid Build Coastguard Worker# Default script for testing the relocation library routines
3*6a54128fSAndroid Build Coastguard Worker# (irel -- inode relocation and brel -- block relocation)
4*6a54128fSAndroid Build Coastguard Worker#
5*6a54128fSAndroid Build Coastguard Worker
6*6a54128fSAndroid Build Coastguard Workerif [ -f $test_dir/setup ]; then
7*6a54128fSAndroid Build Coastguard Worker	. $test_dir/setup
8*6a54128fSAndroid Build Coastguard Workerfi
9*6a54128fSAndroid Build Coastguard Worker
10*6a54128fSAndroid Build Coastguard Workerif [ "$class"x = x ]; then
11*6a54128fSAndroid Build Coastguard Worker	class=`echo $test_name | sed -e 's/e_\([^_]*\)_\(.*\)/\1/'`
12*6a54128fSAndroid Build Coastguard Worker	instance=`echo $test_name | sed -e 's/e_\([^_]*\)_\(.*\)/\2/'`
13*6a54128fSAndroid Build Coastguard Workerfi
14*6a54128fSAndroid Build Coastguard Workerif [ "$OUT"x = x ]; then
15*6a54128fSAndroid Build Coastguard Worker	OUT=$test_name.log
16*6a54128fSAndroid Build Coastguard Workerfi
17*6a54128fSAndroid Build Coastguard Workerif [ "$EXPECT"x = x ]; then
18*6a54128fSAndroid Build Coastguard Worker	EXPECT=$SRCDIR/progs/test_data/expect.$class
19*6a54128fSAndroid Build Coastguard Workerfi
20*6a54128fSAndroid Build Coastguard Worker
21*6a54128fSAndroid Build Coastguard Workerif [ "$class" = irel ]; then
22*6a54128fSAndroid Build Coastguard Worker	TEST_PROG=$TEST_REL
23*6a54128fSAndroid Build Coastguard Workerelif [ "$class" = brel ]; then
24*6a54128fSAndroid Build Coastguard Worker	TEST_PROG=$TEST_REL
25*6a54128fSAndroid Build Coastguard Workerelif [ "$class" = icount ]; then
26*6a54128fSAndroid Build Coastguard Worker	TEST_PROG=$TEST_ICOUNT
27*6a54128fSAndroid Build Coastguard Workerelse
28*6a54128fSAndroid Build Coastguard Worker	TEST_PROG=/bin/cat
29*6a54128fSAndroid Build Coastguard Workerfi
30*6a54128fSAndroid Build Coastguard Worker
31*6a54128fSAndroid Build Coastguard Workercat $SRCDIR/progs/test_data/$instance.setup $SRCDIR/progs/test_data/test.$class \
32*6a54128fSAndroid Build Coastguard Worker    | $TEST_PROG -f - 2>&1 | tr -d \\015 > $OUT
33*6a54128fSAndroid Build Coastguard Worker
34*6a54128fSAndroid Build Coastguard Workercmp -s $EXPECT $OUT
35*6a54128fSAndroid Build Coastguard Workerstatus=$?
36*6a54128fSAndroid Build Coastguard Worker
37*6a54128fSAndroid Build Coastguard Workerrm -f $test_name.failed $test_name.ok
38*6a54128fSAndroid Build Coastguard Worker
39*6a54128fSAndroid Build Coastguard Workerif [ "$status" = 0 ] ; then
40*6a54128fSAndroid Build Coastguard Worker    echo "$test_name: $test_description: ok"
41*6a54128fSAndroid Build Coastguard Worker    touch $test_name.ok
42*6a54128fSAndroid Build Coastguard Workerelse
43*6a54128fSAndroid Build Coastguard Worker    echo "$test_name: $test_description: failed"
44*6a54128fSAndroid Build Coastguard Worker    diff $DIFF_OPTS $EXPECT $OUT > $test_name.failed
45*6a54128fSAndroid Build Coastguard Workerfi
46*6a54128fSAndroid Build Coastguard Worker
47*6a54128fSAndroid Build Coastguard Workerunset EXPECT OUT class instance
48