xref: /aosp_15_r20/external/e2fsprogs/tests/test_script.in (revision 6a54128f25917bfc36a8a6e9d722c04a0b4641b6)
1*6a54128fSAndroid Build Coastguard Worker#!/bin/sh
2*6a54128fSAndroid Build Coastguard Worker# Run all or specified test scripts
3*6a54128fSAndroid Build Coastguard Worker#
4*6a54128fSAndroid Build Coastguard Worker
5*6a54128fSAndroid Build Coastguard Workercase "$1" in
6*6a54128fSAndroid Build Coastguard Worker    --valgrind)
7*6a54128fSAndroid Build Coastguard Worker    	export USE_VALGRIND="valgrind -q --sim-hints=lax-ioctls"
8*6a54128fSAndroid Build Coastguard Worker	shift
9*6a54128fSAndroid Build Coastguard Worker	;;
10*6a54128fSAndroid Build Coastguard Worker    --valgrind-leakcheck)
11*6a54128fSAndroid Build Coastguard Worker    	export USE_VALGRIND="valgrind --sim-hints=lax-ioctls --leak-check=full --show-reachable=yes --log-file=/tmp/valgrind-%p.log"
12*6a54128fSAndroid Build Coastguard Worker	shift
13*6a54128fSAndroid Build Coastguard Worker	;;
14*6a54128fSAndroid Build Coastguard Worker    --failed)
15*6a54128fSAndroid Build Coastguard Worker	DO_FAILED=yes
16*6a54128fSAndroid Build Coastguard Worker	shift
17*6a54128fSAndroid Build Coastguard Worker	;;
18*6a54128fSAndroid Build Coastguard Workeresac
19*6a54128fSAndroid Build Coastguard Worker
20*6a54128fSAndroid Build Coastguard WorkerTESTS=
21*6a54128fSAndroid Build Coastguard Worker
22*6a54128fSAndroid Build Coastguard Workerif test -n "$DO_FAILED"; then
23*6a54128fSAndroid Build Coastguard Worker    FAILED=$(find . -maxdepth 1 -name \*.failed)
24*6a54128fSAndroid Build Coastguard Worker    if test -z "$FAILED" ; then
25*6a54128fSAndroid Build Coastguard Worker	echo " "
26*6a54128fSAndroid Build Coastguard Worker	echo "No (more) failed tests!"
27*6a54128fSAndroid Build Coastguard Worker	echo " "
28*6a54128fSAndroid Build Coastguard Worker    fi
29*6a54128fSAndroid Build Coastguard Worker    for fname in $FAILED ; do
30*6a54128fSAndroid Build Coastguard Worker	TESTS="$TESTS $SRCDIR/${fname%%.failed}"
31*6a54128fSAndroid Build Coastguard Worker    done
32*6a54128fSAndroid Build Coastguard Workerfi
33*6a54128fSAndroid Build Coastguard Worker
34*6a54128fSAndroid Build Coastguard Workerfor i; do
35*6a54128fSAndroid Build Coastguard Worker  case $i in
36*6a54128fSAndroid Build Coastguard Worker	[a-zA-Z])	TESTS="$TESTS $SRCDIR/${i}_*" ;;
37*6a54128fSAndroid Build Coastguard Worker	*)		TESTS="$TESTS $SRCDIR/$i" ;;
38*6a54128fSAndroid Build Coastguard Worker  esac
39*6a54128fSAndroid Build Coastguard Workerdone
40*6a54128fSAndroid Build Coastguard Worker
41*6a54128fSAndroid Build Coastguard Workerif test "$TESTS"x = x ; then
42*6a54128fSAndroid Build Coastguard Worker    if test -n "$DO_FAILED"; then
43*6a54128fSAndroid Build Coastguard Worker	exit 0
44*6a54128fSAndroid Build Coastguard Worker    fi
45*6a54128fSAndroid Build Coastguard Worker    TESTS=`ls -d $SRCDIR/[a-zA-Z]_*`
46*6a54128fSAndroid Build Coastguard Workerfi
47*6a54128fSAndroid Build Coastguard Worker
48*6a54128fSAndroid Build Coastguard Workerfor test_dir in $TESTS; do
49*6a54128fSAndroid Build Coastguard Worker	./test_one $test_dir
50*6a54128fSAndroid Build Coastguard Workerdone
51*6a54128fSAndroid Build Coastguard Worker
52*6a54128fSAndroid Build Coastguard Worker$SRCDIR/test_post
53