blob: 877888246bfdd7456f1ea5622d5360f65d4da247 [file] [log] [blame]
Theodore Ts'oa418d3a1997-04-26 14:00:26 +00001#!/bin/sh
2#
3# Test script for e2fsck
4#
5
6if test "$1"x = x ; then
Andreas Dilger888b29d2001-08-04 02:23:14 -06007 TESTS=`ls -d $SRCDIR/[a-zA-Z]_* | egrep -v "\.failed|\.new"`
Theodore Ts'oa418d3a1997-04-26 14:00:26 +00008else
Theodore Ts'o1e3472c1997-04-29 14:53:37 +00009 TESTS=
10 for i
11 do
Theodore Ts'o521e3681997-04-29 17:48:10 +000012 case $i in
Andreas Dilger888b29d2001-08-04 02:23:14 -060013 *.failed|*.new) continue ;;
Theodore Ts'o521e3681997-04-29 17:48:10 +000014 [a-zA-Z]) TESTS="$TESTS $SRCDIR/${i}_*" ;;
15 *) TESTS="$TESTS $SRCDIR/$i" ;;
16 esac
Theodore Ts'o1e3472c1997-04-29 14:53:37 +000017 done
Theodore Ts'oa418d3a1997-04-26 14:00:26 +000018fi
19
20cmd_dir=$SRCDIR
Theodore Ts'oa418d3a1997-04-26 14:00:26 +000021
Theodore Ts'o5c576471997-04-29 15:29:49 +000022if test "$TEST_CONFIG"x = x; then
23 TEST_CONFIG=$SRCDIR/test_config
24fi
25
26. $TEST_CONFIG
Theodore Ts'oa418d3a1997-04-26 14:00:26 +000027
Theodore Ts'o1e3472c1997-04-29 14:53:37 +000028for test_dir in $TESTS
Theodore Ts'oa418d3a1997-04-26 14:00:26 +000029do
30 test_name=`echo $test_dir | sed -e 's;.*/;;'`
Theodore Ts'o93d29692000-05-25 16:40:54 +000031 if [ -f $test_dir ] ; then
32 continue;
33 fi
Theodore Ts'o19c78dc1997-04-29 16:17:09 +000034 if [ ! -d $test_dir ] ; then
35 echo "The test '$test_name' does not exist."
36 continue;
37 fi
Theodore Ts'oa418d3a1997-04-26 14:00:26 +000038 if [ -f $test_dir/name ]; then
39 test_description=`cat $test_dir/name`
Theodore Ts'o7d4343d2002-02-12 02:34:44 -050040 printf "%s: %s: " "$test_name" "$test_description"
Theodore Ts'oa418d3a1997-04-26 14:00:26 +000041 else
Theodore Ts'o7d4343d2002-02-12 02:34:44 -050042 printf "%s: " "$test_name"
Theodore Ts'oa418d3a1997-04-26 14:00:26 +000043 fi
44 if [ -f $test_dir/script ]; then
45 . $test_dir/script
46 else
47 test_base=`echo $test_name | sed -e 's/_.*//'`
48 default_script=$SRCDIR/defaults/${test_base}_script
49 if [ -f $default_script ]; then
50 . $SRCDIR/defaults/${test_base}_script
51 else
52 echo "Missing test script!"
53 fi
54 fi
55done
56
Theodore Ts'o1e3472c1997-04-29 14:53:37 +000057num_ok=`ls *.ok 2>/dev/null | wc -l`
Theodore Ts'oa418d3a1997-04-26 14:00:26 +000058num_failed=`ls *.failed 2>/dev/null | wc -l`
59
60echo "$num_ok tests succeeded $num_failed tests failed"
61