]> git.ipfire.org Git - thirdparty/e2fsprogs.git/blame - tests/test_one.in
Drop use of -pedantic when doing gcc-wall
[thirdparty/e2fsprogs.git] / tests / test_one.in
CommitLineData
f3331df6
AD
1#!/bin/sh
2# run a single regression test
3
ec3a69bb
MA
4export DD
5
f3331df6
AD
6LC_ALL=C
7export LC_ALL
8
9case "$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 ;;
11b8ef8b
TT
18 --skip-slow-tests)
19 SKIP_SLOW_TESTS=yes
20 shift;
21 ;;
f3331df6
AD
22esac
23
24case "$1" in
eec6f838 25 *.failed|*.new|*.ok|*.log|*.tmp|*.slow) exit 0 ;;
f3331df6
AD
26esac
27
28test_dir=$1
29cmd_dir=$SRCDIR
30
31if test "$TEST_CONFIG"x = x; then
32 TEST_CONFIG=$SRCDIR/test_config
33fi
34
35. $TEST_CONFIG
36
f3331df6 37test_name=`echo $test_dir | sed -e 's;.*/;;'`
358c94ab 38
f3331df6
AD
39if [ -f $test_dir ] ; then
40 exit 0;
41fi
42if [ ! -d $test_dir ] ; then
43 echo "The test '$test_name' does not exist."
44 exit 0;
45fi
46if [ -z "`ls $test_dir`" ]; then
47 exit 0
48fi
49if [ -f $test_dir/name ]; then
50 test_description=`cat $test_dir/name`
51else
52 test_description=
53fi
54
11b8ef8b
TT
55if [ -n "$SKIP_SLOW_TESTS" -a -f $test_dir/is_slow_test ]; then
56 echo "$test_name: $test_description: skipped (slow test)"
57 exit 0
58fi
59
b7454eb8 60rm -f $test_name.ok $test_name.failed $test_name.log $test_name.slow
f3331df6
AD
61#echo -e -n "$test_name: $test_description:\r"
62
845eac42 63TMPFILE=$(mktemp ${TMPDIR:-/tmp}/e2fsprogs-tmp-$test_name.XXXXXX)
03fdf306 64[ "$SKIP_UNLINK" != "true" ] && trap 'rm -f $TMPFILE ; exit' 0 1 2 15
845eac42 65
c8fd5f23 66start=$SECONDS
f3331df6
AD
67if [ -f $test_dir/script ]; then
68 . $test_dir/script
69else
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!"
76 fi
f3331df6 77fi
c8fd5f23
AD
78elapsed=$((SECONDS - start))
79if [ $elapsed -gt 60 -a ! -f $test_dir/is_slow_test ]; then
eec6f838
AD
80 echo "$test_name: *** took $elapsed seconds to finish ***" |
81 tee $test_name.slow
c8fd5f23
AD
82 echo "$test_name: consider adding $test_dir/is_slow_test"
83fi
f3331df6
AD
84
85if [ "$SKIP_UNLINK" != "true" ] ; then
86 rm -f $TMPFILE
87fi
88