| 1 | #!/bin/sh |
| 2 | # List the test cases or, if run with the -d option, the test case directories. |
| 3 | # Currently used by CMakeLists.txt to populate its list of dependencies for |
| 4 | # the "alltests" target. Should be run with the working directory set to the |
| 5 | # top of the tree with the source code for the test cases (i.e. the location of |
| 6 | # this script). |
| 7 | |
| 8 | printdir="" |
| 9 | if test $# -gt 0 ; then |
| 10 | if test $# -eq 1 && test x"$1" = x-d ; then |
| 11 | printdir=yes |
| 12 | else |
| 13 | echo "list-tests: invalid argument(s)" >&2 |
| 14 | echo "usage: list-tests [-d]" >&2 |
| 15 | exit 1 |
| 16 | fi |
| 17 | fi |
| 18 | currdir=`pwd` |
| 19 | # Need to suppress extra output if make is GNU make. |
| 20 | GNUMAKEFLAGS=--no-print-directory |
| 21 | export GNUMAKEFLAGS |
| 22 | for suite in `find . -mindepth 2 -maxdepth 2 -name suite.mk \! -type d -print` ; do |
| 23 | tempmk=/var/tmp/list-tests-$$.mk |
| 24 | cat >${tempmk} <<EOF |
| 25 | include $suite |
| 26 | |
| 27 | all: |
| 28 | @echo \${TESTPROGS} |
| 29 | EOF |
| 30 | for x in `make -I ${currdir} -f $tempmk`; do |
| 31 | if test -n "$printdir" ; then |
| 32 | echo `dirname $x` |
| 33 | break |
| 34 | fi |
| 35 | echo "$x" |
| 36 | done |
| 37 | rm ${tempmk} |
| 38 | done |