119c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o#
219c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o# Default script for testing the relocation library routines 
319c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o# (irel -- inode relocation and brel -- block relocation)
419c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o#
519c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o
619c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'oif [ -f $test_dir/setup ]; then
719c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	. $test_dir/setup
819c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'ofi
919c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o
1019c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'oif [ "$class"x = x ]; then
11521e36857227b21e7ab47b0a97f788d2af9f9717Theodore Ts'o	class=`echo $test_name | sed -e 's/e_\([^_]*\)_\(.*\)/\1/'`
12521e36857227b21e7ab47b0a97f788d2af9f9717Theodore Ts'o	instance=`echo $test_name | sed -e 's/e_\([^_]*\)_\(.*\)/\2/'`
1319c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'ofi
1419c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'oif [ "$OUT"x = x ]; then
1519c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o	OUT=$test_name.log
1619c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'ofi
1719c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'oif [ "$EXPECT"x = x ]; then
18521e36857227b21e7ab47b0a97f788d2af9f9717Theodore Ts'o	EXPECT=$SRCDIR/progs/test_data/expect.$class
1919c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'ofi
2019c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o
21521e36857227b21e7ab47b0a97f788d2af9f9717Theodore Ts'oif [ "$class" = irel ]; then
22521e36857227b21e7ab47b0a97f788d2af9f9717Theodore Ts'o	TEST_PROG=$TEST_REL
23521e36857227b21e7ab47b0a97f788d2af9f9717Theodore Ts'oelif [ "$class" = brel ]; then
24521e36857227b21e7ab47b0a97f788d2af9f9717Theodore Ts'o	TEST_PROG=$TEST_REL
25521e36857227b21e7ab47b0a97f788d2af9f9717Theodore Ts'oelif [ "$class" = icount ]; then
26521e36857227b21e7ab47b0a97f788d2af9f9717Theodore Ts'o	TEST_PROG=$TEST_ICOUNT
27521e36857227b21e7ab47b0a97f788d2af9f9717Theodore Ts'oelse
28521e36857227b21e7ab47b0a97f788d2af9f9717Theodore Ts'o	TEST_PROG=/bin/cat
29521e36857227b21e7ab47b0a97f788d2af9f9717Theodore Ts'ofi
30521e36857227b21e7ab47b0a97f788d2af9f9717Theodore Ts'o
31521e36857227b21e7ab47b0a97f788d2af9f9717Theodore Ts'ocat $SRCDIR/progs/test_data/$instance.setup $SRCDIR/progs/test_data/test.$class \
32ed78c021c3b111d8ab9a51aef5d5156e3004083fTheodore Ts'o    | $TEST_PROG -f - 2>&1 | tr -d \\015 > $OUT 
3319c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o
3419c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'ocmp -s $EXPECT $OUT
3519c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'ostatus=$?
3619c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o
3719c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'orm -f $test_name.failed $test_name.ok
3819c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o
3919c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'oif [ "$status" = 0 ] ; then
40e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    echo "$test_name: $test_description: ok"
4119c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o    touch $test_name.ok
4219c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'oelse
43e0ed7404719a9ddd2ba427a80db5365c8bad18c0JP Abgrall    echo "$test_name: $test_description: failed"
44d82f890355274ee7ede4ed0465b0d232da78d03cTheodore Ts'o    diff $DIFF_OPTS $EXPECT $OUT > $test_name.failed
4519c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'ofi
4619c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'o
4719c78dc07fce2d6f39b5e541562afc3ca1ea38ffTheodore Ts'ounset EXPECT OUT class instance
48