Whamcloud - gitweb
Add 64-bit byte swapping functions
[tools/e2fsprogs.git] / tests / test_script.in
1 #!/bin/sh
2 #
3 # Test script for e2fsck
4 #
5
6 case "$1" in 
7     --valgrind)
8         export USE_VALGRIND="valgrind -q --weird-hacks=lax-ioctls"
9         shift;
10 esac
11
12 if test "$1"x = x ; then
13   TESTS=`ls -d $SRCDIR/[a-zA-Z]_* | $EGREP -v "\.failed|\.new"`
14 else
15   TESTS=
16   for i 
17   do
18     case $i in
19         *.failed|*.new) continue ;;
20         [a-zA-Z])       TESTS="$TESTS $SRCDIR/${i}_*" ;;
21         *)              TESTS="$TESTS $SRCDIR/$i" ;;
22     esac
23   done
24 fi
25
26 cmd_dir=$SRCDIR
27
28 if test "$TEST_CONFIG"x = x; then
29         TEST_CONFIG=$SRCDIR/test_config
30 fi
31
32 . $TEST_CONFIG
33
34 for test_dir in $TESTS
35 do
36         test_name=`echo $test_dir | sed -e 's;.*/;;'`
37         if [ -f $test_dir ] ; then
38             continue;
39         fi
40         if [ ! -d $test_dir ] ; then
41                 echo "The test '$test_name' does not exist."
42                 continue;
43         fi
44         if [ -f $test_dir/name ]; then
45                 test_description=`cat $test_dir/name`
46                 printf "%s: %s: " "$test_name" "$test_description"
47         else
48                 printf "%s: " "$test_name"
49         fi
50         if [ -f $test_dir/script ]; then
51                 . $test_dir/script
52         else
53                 test_base=`echo $test_name | sed -e 's/_.*//'`
54                 default_script=$SRCDIR/defaults/${test_base}_script
55                 if [ -f $default_script ]; then
56                         . $SRCDIR/defaults/${test_base}_script
57                 else
58                         echo "Missing test script!"
59                 fi
60         fi
61 done
62
63 num_ok=`ls *.ok 2>/dev/null | wc -l`
64 num_failed=`ls *.failed 2>/dev/null | wc -l`
65
66 echo "$num_ok tests succeeded   $num_failed tests failed"
67
68 test "$num_failed" -eq 0 || exit 1