File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ usage() {
1313 echo " -c [gcc]|clang compiler to use"
1414 echo " -m [meson]|muon use meson or muon"
1515 echo " -t [armhf]|ppc64le|s390x cross compile target"
16+ echo " -x run test with valgrind"
1617 echo " "
1718 echo " configs with meson:"
1819 echo " [default] default settings"
@@ -33,7 +34,9 @@ BUILDTYPE=release
3334CROSS_TARGET=armhf
3435CC=${CC:- " gcc" }
3536
36- while getopts " b:c:m:t:" o; do
37+ use_valgrind=0
38+
39+ while getopts " b:c:m:t:x" o; do
3740 case " ${o} " in
3841 b)
3942 BUILDTYPE=" ${OPTARG} "
@@ -47,6 +50,9 @@ while getopts "b:c:m:t:" o; do
4750 t)
4851 CROSS_TARGET=" ${OPTARG} "
4952 ;;
53+ x)
54+ use_valgrind=1
55+ ;;
5056 * )
5157 usage
5258 exit 1
@@ -125,8 +131,17 @@ build_meson() {
125131}
126132
127133test_meson () {
128- " ${MESON} " test \
129- -C " ${BUILDDIR} "
134+ local args=(-C " ${BUILDDIR} " )
135+
136+ if [ " ${use_valgrind:- 0} " -eq 1 ]; then
137+ if command -v valgrind > /dev/null 2>&1 ; then
138+ args+=(--wrapper valgrind)
139+ else
140+ echo " Warning: valgrind requested but not found; running without it." >&2
141+ fi
142+ fi
143+
144+ " ${MESON} " test " ${args[@]} "
130145}
131146
132147test_meson_coverage () {
You can’t perform that action at this time.
0 commit comments