Whamcloud - gitweb
libext2fs: write_journal_inode should check iterate return value
[tools/e2fsprogs.git] / tests / test_one.in
1 #!/bin/sh
2 # run a single regression test
3
4 LC_ALL=C
5 export LC_ALL
6
7 case "$1" in
8     --valgrind)
9         export USE_VALGRIND="valgrind -q --sim-hints=lax-ioctls"
10         shift;
11         ;;
12     --valgrind-leakcheck)
13         export USE_VALGRIND="valgrind --sim-hints=lax-ioctls --leak-check=full --show-reachable=yes --log-file=/tmp/valgrind-%p.log"
14         shift;
15         ;;
16 esac
17
18 case "$1" in
19     *.failed|*.new|*.ok|*.log|*.tmp)    exit 0 ;;
20 esac
21
22 test_dir=$1
23 cmd_dir=$SRCDIR
24
25 if test "$TEST_CONFIG"x = x; then
26         TEST_CONFIG=$SRCDIR/test_config
27 fi
28
29 . $TEST_CONFIG
30
31 test_name=`echo $test_dir | sed -e 's;.*/;;'`
32
33 TMPFILE=$(mktemp ${TMPDIR:-/tmp}/e2fsprogs-tmp-$test_name.XXXXXX)
34 trap 'rm -f $TMPFILE ; exit' 1 2 15
35
36 if [ -f $test_dir ] ; then
37         exit 0;
38 fi
39 if [ ! -d $test_dir ] ; then
40         echo "The test '$test_name' does not exist."
41         exit 0;
42 fi
43 if [ -z "`ls $test_dir`" ]; then
44         exit 0
45 fi
46 if [ -f $test_dir/name ]; then
47         test_description=`cat $test_dir/name`
48 else
49         test_description=
50 fi
51
52 rm -f $test_name.ok $test_name.failed
53 #echo -e -n "$test_name: $test_description:\r"
54
55 if [ -f $test_dir/script ]; then
56         . $test_dir/script
57 else
58         test_base=`echo $test_name | sed -e 's/_.*//'`
59         default_script=$SRCDIR/defaults/${test_base}_script
60         if [ -f $default_script ]; then
61                 . $SRCDIR/defaults/${test_base}_script
62         else
63                 echo "$test_name: Missing test script $default_script!"
64         fi
65         [ -f $test_name.failed ] && cat $test_name.failed
66 fi
67
68 if [ "$SKIP_UNLINK" != "true" ] ; then
69         rm -f $TMPFILE
70 fi
71