1 #!/bin/sh 2 # 3 # Test script for e2fsck 4 # 5 6 LC_ALL=C 7 export LC_ALL 8 9 case "$1" in 10 --valgrind) 11 export USE_VALGRIND="valgrind -q --sim-hints=lax-ioctls" 12 shift; 13 ;; 14 --valgrind-leakcheck) 15 export USE_VALGRIND="valgrind --sim-hints=lax-ioctls --leak-check=full --show-reachable=yes --log-file=/tmp/valgrind-%p.log" 16 shift; 17 ;; 18 esac 19 20 if test "$1"x = x ; then 21 TESTS=`ls -d $SRCDIR/[a-zA-Z]_* | $EGREP -v "\.failed|\.new"` 22 else 23 TESTS= 24 for i 25 do 26 case $i in 27 *.failed|*.new) continue ;; 28 [a-zA-Z]) TESTS="$TESTS $SRCDIR/${i}_*" ;; 29 *) TESTS="$TESTS $SRCDIR/$i" ;; 30 esac 31 done 32 fi 33 34 cmd_dir=$SRCDIR 35 36 if test "$TEST_CONFIG"x = x; then 37 TEST_CONFIG=$SRCDIR/test_config 38 fi 39 40 . $TEST_CONFIG 41 42 for test_dir in $TESTS 43 do 44 test_name=`echo $test_dir | sed -e 's;.*/;;'` 45 if [ -f $test_dir ] ; then 46 continue; 47 fi 48 if [ ! -d $test_dir ] ; then 49 echo "The test '$test_name' does not exist." 50 continue; 51 fi 52 if [ -z "`ls $test_dir`" ]; then 53 continue 54 fi 55 if [ -f $test_dir/name ]; then 56 test_description=`cat $test_dir/name` 57 printf "%s: %s: " "$test_name" "$test_description" 58 else 59 printf "%s: " "$test_name" 60 fi 61 if [ -f $test_dir/script ]; then 62 . $test_dir/script 63 else 64 test_base=`echo $test_name | sed -e 's/_.*//'` 65 default_script=$SRCDIR/defaults/${test_base}_script 66 if [ -f $default_script ]; then 67 . $SRCDIR/defaults/${test_base}_script 68 else 69 echo "Missing test script!" 70 fi 71 fi 72 done 73 74 num_ok=`ls *.ok 2>/dev/null | wc -l` 75 num_failed=`ls *.failed 2>/dev/null | wc -l` 76 77 echo "$num_ok tests succeeded $num_failed tests failed" 78 79 test "$num_failed" -eq 0 || exit 1 80