2 # Copyright (c) 2002, Intel Corporation. All rights reserved.
3 # Created by: inaky.perez-gonzalez REMOVE-THIS AT intel DOT com
4 # This file is licensed under the GPL license. For the full content
5 # of this license, see the COPYING file at the top level of this
8 # Added FreeBSD compatibility changes by Craig Rodrigues
13 Usage: $(basename $0) [OPTIONs] DIRECTORY
15 Lists the tests (source/binary) available from the DIRECTORY directory
18 --buildable List only tests that require building
19 --execs List only tests that are executable
20 If you just want to build a test, but not run it,
21 do not include a main function into the .c file or
22 name it something including the "-buildonly" string.
23 --fmake Find functional makefiles.
24 --smake Find stress makefiles.
25 --frun Find functional run.sh files.
26 --srun Find stress run.sh files.
27 --help Show this help and exit
29 Filenames need to follow some standarized format for them to be picked
30 up by this tool. This might change in the future. So far, the ones
33 NUMBER-NUMBER.c [requires compilation]
34 NUMBER-NUMBER.sh [does not require compilation]
35 NUMBER-buildonly.c [requires compilation]
36 NAME.sh [does not require compilation]
38 Note that the [requires compilation] tags will mean that the actual
39 test name for TEST.c after compiling will be TEST. Currently it does
40 not support TESTs compiled from many different sources.
49 # Go through the cmd line options
54 buildable="( -name [0-9]*-*.c ! -name [0-9]*-[0-9]*.sh )";
59 execs="( ( -name [0-9]*-[0-9]*.c -o -name [0-9]*-[0-9]*.sh ) -a ! -name *-buildonly* )";
63 find functional/ -maxdepth 2 -mindepth 2 -type f -name "Makefile" -exec dirname '{}' ';'
67 find functional/ -maxdepth 2 -mindepth 2 -type f -name "run.sh" -exec dirname '{}' ';'
71 find stress/ -maxdepth 2 -mindepth 2 -type f -name "Makefile" -exec dirname '{}' ';'
75 find stress/ -maxdepth 2 -mindepth 2 -type f -name "run.sh" -exec dirname '{}' ';'
83 echo "Unknown option $1" 1>&2;
93 # Need the DIRECTORY arg ...
96 echo "Error: no root directory specified" 1>&2
101 # Simple version right now, just locate all:
104 # Force something .c or .sh
106 # IF --execs, force it has no "-buildonly"
107 # If --buildable, remove the .sh files
108 find "$WHERE" -type f \
110 \( -name "[0-9]*-*.c" -o -name "[0-9]*-[0-9]*.sh" \) \
111 ! -name \*.o ! -name \*~ \
114 | if [ $print_execs -eq 1 ]
116 sed -e 's/\.c$/.test/' -e 's/\.sh$/.test/'