88WORKSPACE=$1
99BUILD_DIR=$2
1010TOOL=$3
11+ TESTS=$4
1112
1213function print_usage() {
13- echo " $( basename $0 ) - run all UMF tests and examples under a valgrind tool (memcheck, drd or helgrind)"
14- echo " This script looks for './test/umf_test-*' and './examples/umf_example_*' executables in the UMF build directory."
15- echo " Usage: $( basename $0 ) <workspace_dir> <build_dir> <memcheck|drd|helgrind>"
14+ echo " $( basename $0 ) - run UMF tests and examples under a valgrind tool (memcheck, drd or helgrind)"
15+ echo " Usage: $( basename $0 ) <workspace_dir> <build_dir> <memcheck|drd|helgrind> [tests_examples]"
16+ echo " Where:"
17+ echo
18+ echo " tests_examples - (optional) list of tests or examples to be run (paths relative to the <build_dir> build directory)."
19+ echo " If it is empty, all tests (./test/umf_test-*) and examples (./examples/umf_example_*)"
20+ echo " found in <build_dir> will be run."
1621}
1722
1823if ! valgrind --version > /dev/null; then
@@ -62,7 +67,7 @@ cd ${BUILD_DIR}
6267mkdir -p cpuid
6368
6469echo " Gathering data for hwloc so it can be run under valgrind:"
65- hwloc-gather-cpuid ./cpuid
70+ hwloc-gather-cpuid ./cpuid > /dev/null
6671
6772echo
6873echo " Working directory: $( pwd) "
@@ -71,7 +76,14 @@ echo "Running: \"valgrind $OPTION\" for the following tests:"
7176ANY_TEST_FAILED=0
7277rm -f umf_test-* .log umf_test-* .err
7378
74- for test in $( ls -1 ./test/umf_test-* ./examples/umf_example_* ) ; do
79+ [ " $TESTS " = " " ] && TESTS=$( ls -1 ./test/umf_test-* ./examples/umf_example_* )
80+
81+ for test in $TESTS ; do
82+ if [ ! -f $test ]; then
83+ echo
84+ echo " error: the $test (${BUILD_DIR} /$test ) file does not exist"
85+ exit 1
86+ fi
7587 [ ! -x $test ] && continue
7688 echo " $test - starting ..."
7789 echo -n " $test "
0 commit comments