@@ -10,8 +10,8 @@ BUILD_DIR=$2
1010TOOL=$3
1111
1212function print_usage() {
13- echo " $( basename $0 ) - run all UMF tests under a valgrind tool (memcheck, drd or helgrind)"
14- echo " This script looks for './test/umf_test-*' test executables in the UMF build directory."
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."
1515 echo " Usage: $( basename $0 ) <workspace_dir> <build_dir> <memcheck|drd|helgrind>"
1616}
1717
5858WORKSPACE=$( realpath $WORKSPACE )
5959BUILD_DIR=$( realpath $BUILD_DIR )
6060
61- cd ${BUILD_DIR} /test/
61+ cd ${BUILD_DIR}
6262mkdir -p cpuid
6363
6464echo " Gathering data for hwloc so it can be run under valgrind:"
@@ -71,74 +71,83 @@ echo "Running: \"valgrind $OPTION\" for the following tests:"
7171ANY_TEST_FAILED=0
7272rm -f umf_test-* .log umf_test-* .err
7373
74- for test in $( ls -1 umf_test-* ) ; do
74+ for test in $( ls -1 ./test/ umf_test-* ./examples/umf_example_ * ) ; do
7575 [ ! -x $test ] && continue
7676 echo " $test - starting ..."
7777 echo -n " $test "
7878 LOG=${test} .log
7979 ERR=${test} .err
80- SUP=" ${WORKSPACE} /test/supp/${TOOL} -${test} .supp"
80+ NAME=$( basename $test )
81+ SUP=" ${WORKSPACE} /test/supp/${TOOL} -${NAME} .supp"
8182 OPT_SUP=" "
82- [ -f ${SUP} ] && OPT_SUP=" --suppressions=${SUP} " && echo -n " (${TOOL} - ${test} .supp ) "
83+ [ -f ${SUP} ] && OPT_SUP=" --suppressions=${SUP} " && echo -n " ($( basename ${SUP} ) ) "
8384
8485 # skip tests incompatible with valgrind
8586 FILTER=" "
8687 case $test in
87- umf_test-disjointPool)
88+ ./test/ umf_test-disjointPool)
8889 if [ " $TOOL " = " helgrind" ]; then
8990 # skip because of the assert in helgrind:
9091 # Helgrind: hg_main.c:308 (lockN_acquire_reader): Assertion 'lk->kind == LK_rdwr' failed.
9192 echo " - SKIPPED (helgrind only)"
9293 continue ;
9394 fi
9495 ;;
95- umf_test-ipc_os_prov_* )
96+ ./test/ umf_test-ipc_os_prov_* )
9697 echo " - SKIPPED"
9798 continue ; # skip testing helper binaries used by the ipc_os_prov_* tests
9899 ;;
99- umf_test-ipc_devdax_prov_* )
100+ ./test/ umf_test-ipc_devdax_prov_* )
100101 echo " - SKIPPED"
101102 continue ; # skip testing helper binaries used by the ipc_devdax_prov_* tests
102103 ;;
103- umf_test-ipc_file_prov_* )
104+ ./test/ umf_test-ipc_file_prov_* )
104105 echo " - SKIPPED"
105106 continue ; # skip testing helper binaries used by the ipc_file_prov_* tests
106107 ;;
107- umf_test-memspace_host_all)
108+ ./test/ umf_test-memspace_host_all)
108109 FILTER=' --gtest_filter="-*allocsSpreadAcrossAllNumaNodes"'
109110 ;;
110- umf_test-provider_os_memory)
111+ ./test/ umf_test-provider_os_memory)
111112 FILTER=' --gtest_filter="-osProviderTest/umfIpcTest*"'
112113 ;;
113- umf_test-provider_os_memory_config)
114+ ./test/ umf_test-provider_os_memory_config)
114115 FILTER=' --gtest_filter="-*protection_flag_none:*protection_flag_read:*providerConfigTestNumaMode*"'
115116 ;;
116- umf_test-memspace_highest_capacity)
117+ ./test/ umf_test-memspace_highest_capacity)
117118 FILTER=' --gtest_filter="-*highestCapacityVerify*"'
118119 ;;
119- umf_test-provider_os_memory_multiple_numa_nodes)
120+ ./test/ umf_test-provider_os_memory_multiple_numa_nodes)
120121 FILTER=' --gtest_filter="-testNuma.checkModeInterleave*:testNumaNodesAllocations/testNumaOnEachNode.checkNumaNodesAllocations*:testNumaNodesAllocations/testNumaOnEachNode.checkModePreferred*:testNumaNodesAllocations/testNumaOnEachNode.checkModeInterleaveSingleNode*:testNumaNodesAllocationsAllCpus/testNumaOnEachCpu.checkModePreferredEmptyNodeset*:testNumaNodesAllocationsAllCpus/testNumaOnEachCpu.checkModeLocal*"'
121122 ;;
122- umf_test-memspace_highest_bandwidth)
123+ ./test/ umf_test-memspace_highest_bandwidth)
123124 FILTER=' --gtest_filter="-*allocLocalMt*"'
124125 ;;
125- umf_test-memspace_lowest_latency)
126+ ./test/ umf_test-memspace_lowest_latency)
126127 FILTER=' --gtest_filter="-*allocLocalMt*"'
127128 ;;
128- umf_test-memoryPool)
129+ ./test/ umf_test-memoryPool)
129130 FILTER=' --gtest_filter="-*allocMaxSize*"'
130131 ;;
132+ ./examples/umf_example_ipc_ipcapi_* )
133+ echo " - SKIPPED"
134+ continue ; # skip testing helper binaries used by the umf_example_ipc_ipcapi_* examples
135+ ;;
131136 esac
132137
133138 [ " $FILTER " != " " ] && echo -n " ($FILTER ) "
134139
135140 LAST_TEST_FAILED=0
136-
137- if ! HWLOC_CPUID_PATH=./cpuid valgrind $OPTION $OPT_SUP --gen-suppressions=all ./$test $FILTER > $LOG 2>&1 ; then
141+ set +e
142+ HWLOC_CPUID_PATH=./cpuid valgrind $OPTION $OPT_SUP --gen-suppressions=all $test $FILTER > $LOG 2>&1
143+ RET=$?
144+ set -e
145+ # 125 is the return code when the test is skipped
146+ if [ $RET -ne 0 -a $RET -ne 125 ]; then
138147 LAST_TEST_FAILED=1
139148 ANY_TEST_FAILED=1
140- echo " (valgrind FAILED) "
141- echo " Command: HWLOC_CPUID_PATH=./cpuid valgrind $OPTION $OPT_SUP --gen-suppressions=all ./ $test $FILTER >$LOG 2>&1"
149+ echo " (valgrind FAILED RV= $RET ) "
150+ echo " Command: HWLOC_CPUID_PATH=./cpuid valgrind $OPTION $OPT_SUP --gen-suppressions=all $test $FILTER >$LOG 2>&1"
142151 echo " Output:"
143152 cat $LOG
144153 echo " ====================="
@@ -147,7 +156,7 @@ for test in $(ls -1 umf_test-*); do
147156 # grep for "ERROR SUMMARY" with errors (there can be many lines with "ERROR SUMMARY")
148157 grep -e " ERROR SUMMARY:" $LOG | grep -v -e " ERROR SUMMARY: 0 errors from 0 contexts" > $ERR || true
149158 if [ $LAST_TEST_FAILED -eq 0 -a $( cat $ERR | wc -l) -eq 0 ]; then
150- echo " - OK"
159+ [ $RET -eq 0 ] && echo " - OK" || echo " - SKIPPED "
151160 rm -f $LOG $ERR
152161 else
153162 echo " - FAILED!"
0 commit comments