blob: d053fd71e90e07ca6ba2a935d7d724b68f96af37 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001#!/bin/sh
2# run a single regression test
3
4LC_ALL=C
5export LC_ALL
6
7case "$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 ;;
16esac
17
18case "$1" in
19 *.failed|*.new|*.ok|*.log|*.tmp) exit 0 ;;
20esac
21
22test_dir=$1
23cmd_dir=$SRCDIR
24
25if test "$TEST_CONFIG"x = x; then
26 TEST_CONFIG=$SRCDIR/test_config
27fi
28
29. $TEST_CONFIG
30
31TMPFILE=$(mktemp -t e2fsprogs-tmp.XXXXXX)
32
33test_name=`echo $test_dir | sed -e 's;.*/;;'`
34if [ -f $test_dir ] ; then
35 exit 0;
36fi
37if [ ! -d $test_dir ] ; then
38 echo "The test '$test_name' does not exist."
39 exit 0;
40fi
41if [ -z "`ls $test_dir`" ]; then
42 exit 0
43fi
44if [ -f $test_dir/name ]; then
45 test_description=`cat $test_dir/name`
46else
47 test_description=
48fi
49
50rm -f $test_name.ok $test_name.failed
51#echo -e -n "$test_name: $test_description:\r"
52
53if [ -f $test_dir/script ]; then
54 . $test_dir/script
55else
56 test_base=`echo $test_name | sed -e 's/_.*//'`
57 default_script=$SRCDIR/defaults/${test_base}_script
58 if [ -f $default_script ]; then
59 . $SRCDIR/defaults/${test_base}_script
60 else
61 echo "$test_name: Missing test script $default_script!"
62 fi
63 [ -f $test_name.failed ] && cat $test_name.failed
64fi
65
66if [ "$SKIP_UNLINK" != "true" ] ; then
67 rm -f $TMPFILE
68fi
69