Skip to content

Commit 9544998

Browse files
committed
Run only given tests/examples under valgrind
Signed-off-by: Lukasz Dorau <[email protected]>
1 parent 7ae4fe1 commit 9544998

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

test/test_valgrind.sh

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,16 @@ set -e
88
WORKSPACE=$1
99
BUILD_DIR=$2
1010
TOOL=$3
11+
TESTS=$4
1112

1213
function 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

1823
if ! valgrind --version > /dev/null; then
@@ -71,7 +76,14 @@ echo "Running: \"valgrind $OPTION\" for the following tests:"
7176
ANY_TEST_FAILED=0
7277
rm -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

Comments
 (0)