tests: update expect file for u_direct_io
[e2fsprogs.git] / tests / test_one.in
blob5d7607ad870559f70586deaf3096afab8cfc22d1
1 #!/bin/sh
2 # run a single regression test
4 export DD
6 LC_ALL=C
7 export LC_ALL
9 case "$1" in
10 --valgrind)
11 export USE_VALGRIND="valgrind -q --sim-hints=lax-ioctls"
12 shift;
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;
18 --skip-slow-tests)
19 SKIP_SLOW_TESTS=yes
20 shift;
22 esac
24 case "$1" in
25 *.failed|*.new|*.ok|*.log|*.tmp|*.slow) exit 0 ;;
26 esac
28 test_dir=$1
29 cmd_dir=$SRCDIR
31 if test "$TEST_CONFIG"x = x; then
32 TEST_CONFIG=$SRCDIR/test_config
35 . $TEST_CONFIG
37 test_name=`echo $test_dir | sed -e 's;.*/;;'`
39 if [ -f $test_dir ] ; then
40 exit 0;
42 if [ ! -d $test_dir ] ; then
43 echo "The test '$test_name' does not exist."
44 exit 0;
46 if [ -z "`ls $test_dir`" ]; then
47 exit 0
49 if [ -f $test_dir/name ]; then
50 test_description=`cat $test_dir/name`
51 else
52 test_description=
55 if [ -n "$SKIP_SLOW_TESTS" -a -f $test_dir/is_slow_test ]; then
56 echo "$test_name: $test_description: skipped (slow test)"
57 exit 0
60 rm -f $test_name.ok $test_name.failed $test_name.log $test_name.slow
61 #echo -e -n "$test_name: $test_description:\r"
63 TMPFILE=$(mktemp ${TMPDIR:-/tmp}/e2fsprogs-tmp-$test_name.XXXXXX)
64 [ "$SKIP_UNLINK" != "true" ] && trap 'rm -f $TMPFILE ; exit' 0 1 2 15
66 start=$SECONDS
67 if [ -f $test_dir/script ]; then
68 . $test_dir/script
69 else
70 test_base=`echo $test_name | sed -e 's/_.*//'`
71 default_script=$SRCDIR/defaults/${test_base}_script
72 if [ -f $default_script ]; then
73 . $SRCDIR/defaults/${test_base}_script
74 else
75 echo "$test_name: Missing test script $default_script!"
78 elapsed=$((SECONDS - start))
79 if [ $elapsed -gt 60 -a ! -f $test_dir/is_slow_test ]; then
80 echo "$test_name: *** took $elapsed seconds to finish ***" |
81 tee $test_name.slow
82 echo "$test_name: consider adding $test_dir/is_slow_test"
85 if [ "$SKIP_UNLINK" != "true" ] ; then
86 rm -f $TMPFILE