1a418d3ad819323f871005d253f7f9ac378e78ba5Theodore Ts'o#!/bin/sh
2f3331df6bb5d380efd72e07fc9b40c998b355412Andreas Dilger# Run all or specified test scripts
3a418d3ad819323f871005d253f7f9ac378e78ba5Theodore Ts'o#
437f009ae2216b52ff27fb05e5f42c37a651763dcTheodore Ts'o
5f3331df6bb5d380efd72e07fc9b40c998b355412Andreas Dilgercase "$1" in
6cfe7ba49782892747f212b7a541820975a86b37dTheodore Ts'o    --valgrind)
735efa44d491357dcca91a243bbd4a4d9926fee88Theodore Ts'o    	export USE_VALGRIND="valgrind -q --sim-hints=lax-ioctls"
8ded919125a9e4a89d856984e1bfa21f70a8092ddTheodore Ts'o	shift
958d29ed48a14154ef9887fb0d8c436cb72d63e23Theodore Ts'o	;;
1058d29ed48a14154ef9887fb0d8c436cb72d63e23Theodore Ts'o    --valgrind-leakcheck)
1158d29ed48a14154ef9887fb0d8c436cb72d63e23Theodore Ts'o    	export USE_VALGRIND="valgrind --sim-hints=lax-ioctls --leak-check=full --show-reachable=yes --log-file=/tmp/valgrind-%p.log"
12ded919125a9e4a89d856984e1bfa21f70a8092ddTheodore Ts'o	shift
13ded919125a9e4a89d856984e1bfa21f70a8092ddTheodore Ts'o	;;
14ded919125a9e4a89d856984e1bfa21f70a8092ddTheodore Ts'o    --failed)
15ded919125a9e4a89d856984e1bfa21f70a8092ddTheodore Ts'o	DO_FAILED=yes
16ded919125a9e4a89d856984e1bfa21f70a8092ddTheodore Ts'o	shift
1758d29ed48a14154ef9887fb0d8c436cb72d63e23Theodore Ts'o	;;
18cfe7ba49782892747f212b7a541820975a86b37dTheodore Ts'oesac
19cfe7ba49782892747f212b7a541820975a86b37dTheodore Ts'o
20ded919125a9e4a89d856984e1bfa21f70a8092ddTheodore Ts'oTESTS=
21ded919125a9e4a89d856984e1bfa21f70a8092ddTheodore Ts'o
22ded919125a9e4a89d856984e1bfa21f70a8092ddTheodore Ts'oif test -n "$DO_FAILED"; then
23ded919125a9e4a89d856984e1bfa21f70a8092ddTheodore Ts'o    FAILED=$(find . -maxdepth 1 -name \*.failed)
24ded919125a9e4a89d856984e1bfa21f70a8092ddTheodore Ts'o    if test -z "$FAILED" ; then
25ded919125a9e4a89d856984e1bfa21f70a8092ddTheodore Ts'o	echo " "
26ded919125a9e4a89d856984e1bfa21f70a8092ddTheodore Ts'o	echo "No (more) failed tests!"
27ded919125a9e4a89d856984e1bfa21f70a8092ddTheodore Ts'o	echo " "
28ded919125a9e4a89d856984e1bfa21f70a8092ddTheodore Ts'o    fi
29ded919125a9e4a89d856984e1bfa21f70a8092ddTheodore Ts'o    for fname in $FAILED ; do
30ded919125a9e4a89d856984e1bfa21f70a8092ddTheodore Ts'o	TESTS="$TESTS $SRCDIR/${fname%%.failed}"
31ded919125a9e4a89d856984e1bfa21f70a8092ddTheodore Ts'o    done
32ded919125a9e4a89d856984e1bfa21f70a8092ddTheodore Ts'ofi
33ded919125a9e4a89d856984e1bfa21f70a8092ddTheodore Ts'o
34ded919125a9e4a89d856984e1bfa21f70a8092ddTheodore Ts'ofor i; do
35ded919125a9e4a89d856984e1bfa21f70a8092ddTheodore Ts'o  case $i in
36521e36857227b21e7ab47b0a97f788d2af9f9717Theodore Ts'o	[a-zA-Z])	TESTS="$TESTS $SRCDIR/${i}_*" ;;
37521e36857227b21e7ab47b0a97f788d2af9f9717Theodore Ts'o	*)		TESTS="$TESTS $SRCDIR/$i" ;;
38ded919125a9e4a89d856984e1bfa21f70a8092ddTheodore Ts'o  esac
39ded919125a9e4a89d856984e1bfa21f70a8092ddTheodore Ts'odone
40ded919125a9e4a89d856984e1bfa21f70a8092ddTheodore Ts'o
41ded919125a9e4a89d856984e1bfa21f70a8092ddTheodore Ts'oif test "$TESTS"x = x ; then
42ded919125a9e4a89d856984e1bfa21f70a8092ddTheodore Ts'o    if test -n "DO_FAILED"; then
43ded919125a9e4a89d856984e1bfa21f70a8092ddTheodore Ts'o	exit 0
44ded919125a9e4a89d856984e1bfa21f70a8092ddTheodore Ts'o    fi
45ded919125a9e4a89d856984e1bfa21f70a8092ddTheodore Ts'o    TESTS=`ls -d $SRCDIR/[a-zA-Z]_*`
46a418d3ad819323f871005d253f7f9ac378e78ba5Theodore Ts'ofi
47a418d3ad819323f871005d253f7f9ac378e78ba5Theodore Ts'o
48f3331df6bb5d380efd72e07fc9b40c998b355412Andreas Dilgerfor test_dir in $TESTS; do
49f3331df6bb5d380efd72e07fc9b40c998b355412Andreas Dilger	./test_one $test_dir
502fa1679adb2be88cddcdc98bed325ac0ce72ef93Lukas Czernerdone
512fa1679adb2be88cddcdc98bed325ac0ce72ef93Lukas Czerner
52f3331df6bb5d380efd72e07fc9b40c998b355412Andreas Dilger$SRCDIR/test_post
53