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 [arm]|ppc64le|s390x cross compile target"
16+ echo " -x run test with valgrind"
1617 echo " "
1718 echo " configs with meson:"
1819 echo " [default] default settings"
@@ -35,7 +36,9 @@ BUILDTYPE=release
3536CROSS_TARGET=arm
3637CC=${CC:- " gcc" }
3738
38- while getopts " b:c:m:t:" o; do
39+ use_valgrind=0
40+
41+ while getopts " b:c:m:t:x" o; do
3942 case " ${o} " in
4043 b)
4144 BUILDTYPE=" ${OPTARG} "
@@ -49,6 +52,9 @@ while getopts "b:c:m:t:" o; do
4952 t)
5053 CROSS_TARGET=" ${OPTARG} "
5154 ;;
55+ x)
56+ use_valgrind=1
57+ ;;
5258 * )
5359 usage
5460 exit 1
@@ -144,8 +150,17 @@ build_meson() {
144150}
145151
146152test_meson () {
147- " ${MESON} " test \
148- -C " ${BUILDDIR} "
153+ local args=(-C " ${BUILDDIR} " )
154+
155+ if [ " ${use_valgrind:- 0} " -eq 1 ]; then
156+ if command -v valgrind > /dev/null 2>&1 ; then
157+ args+=(--wrapper valgrind)
158+ else
159+ echo " Warning: valgrind requested but not found; running without it." >&2
160+ fi
161+ fi
162+
163+ " ${MESON} " test " ${args[@]} "
149164}
150165
151166test_meson_coverage () {
You can’t perform that action at this time.
0 commit comments