Theodore Ts'o | a418d3a | 1997-04-26 14:00:26 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # |
| 3 | # Test script for e2fsck |
| 4 | # |
| 5 | |
| 6 | if test "$1"x = x ; then |
Andreas Dilger | 888b29d | 2001-08-04 02:23:14 -0600 | [diff] [blame] | 7 | TESTS=`ls -d $SRCDIR/[a-zA-Z]_* | egrep -v "\.failed|\.new"` |
Theodore Ts'o | a418d3a | 1997-04-26 14:00:26 +0000 | [diff] [blame] | 8 | else |
Theodore Ts'o | 1e3472c | 1997-04-29 14:53:37 +0000 | [diff] [blame] | 9 | TESTS= |
| 10 | for i |
| 11 | do |
Theodore Ts'o | 521e368 | 1997-04-29 17:48:10 +0000 | [diff] [blame] | 12 | case $i in |
Andreas Dilger | 888b29d | 2001-08-04 02:23:14 -0600 | [diff] [blame] | 13 | *.failed|*.new) continue ;; |
Theodore Ts'o | 521e368 | 1997-04-29 17:48:10 +0000 | [diff] [blame] | 14 | [a-zA-Z]) TESTS="$TESTS $SRCDIR/${i}_*" ;; |
| 15 | *) TESTS="$TESTS $SRCDIR/$i" ;; |
| 16 | esac |
Theodore Ts'o | 1e3472c | 1997-04-29 14:53:37 +0000 | [diff] [blame] | 17 | done |
Theodore Ts'o | a418d3a | 1997-04-26 14:00:26 +0000 | [diff] [blame] | 18 | fi |
| 19 | |
| 20 | cmd_dir=$SRCDIR |
Theodore Ts'o | a418d3a | 1997-04-26 14:00:26 +0000 | [diff] [blame] | 21 | |
Theodore Ts'o | 5c57647 | 1997-04-29 15:29:49 +0000 | [diff] [blame] | 22 | if test "$TEST_CONFIG"x = x; then |
| 23 | TEST_CONFIG=$SRCDIR/test_config |
| 24 | fi |
| 25 | |
| 26 | . $TEST_CONFIG |
Theodore Ts'o | a418d3a | 1997-04-26 14:00:26 +0000 | [diff] [blame] | 27 | |
Theodore Ts'o | 1e3472c | 1997-04-29 14:53:37 +0000 | [diff] [blame] | 28 | for test_dir in $TESTS |
Theodore Ts'o | a418d3a | 1997-04-26 14:00:26 +0000 | [diff] [blame] | 29 | do |
| 30 | test_name=`echo $test_dir | sed -e 's;.*/;;'` |
Theodore Ts'o | 93d2969 | 2000-05-25 16:40:54 +0000 | [diff] [blame] | 31 | if [ -f $test_dir ] ; then |
| 32 | continue; |
| 33 | fi |
Theodore Ts'o | 19c78dc | 1997-04-29 16:17:09 +0000 | [diff] [blame] | 34 | if [ ! -d $test_dir ] ; then |
| 35 | echo "The test '$test_name' does not exist." |
| 36 | continue; |
| 37 | fi |
Theodore Ts'o | a418d3a | 1997-04-26 14:00:26 +0000 | [diff] [blame] | 38 | if [ -f $test_dir/name ]; then |
| 39 | test_description=`cat $test_dir/name` |
Theodore Ts'o | 7d4343d | 2002-02-12 02:34:44 -0500 | [diff] [blame] | 40 | printf "%s: %s: " "$test_name" "$test_description" |
Theodore Ts'o | a418d3a | 1997-04-26 14:00:26 +0000 | [diff] [blame] | 41 | else |
Theodore Ts'o | 7d4343d | 2002-02-12 02:34:44 -0500 | [diff] [blame] | 42 | printf "%s: " "$test_name" |
Theodore Ts'o | a418d3a | 1997-04-26 14:00:26 +0000 | [diff] [blame] | 43 | 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 |
| 55 | done |
| 56 | |
Theodore Ts'o | 1e3472c | 1997-04-29 14:53:37 +0000 | [diff] [blame] | 57 | num_ok=`ls *.ok 2>/dev/null | wc -l` |
Theodore Ts'o | a418d3a | 1997-04-26 14:00:26 +0000 | [diff] [blame] | 58 | num_failed=`ls *.failed 2>/dev/null | wc -l` |
| 59 | |
| 60 | echo "$num_ok tests succeeded $num_failed tests failed" |
| 61 | |