summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.editorconfig2
-rw-r--r--CMakeLists.txt2
-rwxr-xr-xbuild-aux/valgrind15
-rwxr-xr-xlib9p/tests/runtest4
-rw-r--r--libcr/CMakeLists.txt2
5 files changed, 21 insertions, 4 deletions
diff --git a/.editorconfig b/.editorconfig
index 3e9bbc8..23d17cc 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -48,7 +48,7 @@ _mode = gitignore
[{build-aux/lint-{generic,unknown},build-aux/embed-sources.h.gen}]
_mode = sh
-[{build-aux/lint-{bin,h},build-aux/get-dscname,libusb/include/libusb/tusb_helpers.h.gen}]
+[{build-aux/lint-{bin,h},build-aux/get-dscname,build-aux/valgrind,libusb/include/libusb/tusb_helpers.h.gen}]
_mode = bash
[build-aux/stack.c.gen]
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 22756c1..9fa048f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -112,7 +112,7 @@ function(add_lib_test arg_libname arg_testname)
target_include_directories("${arg_testname}" PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/tests)
add_test(
NAME "${arg_libname}/${arg_testname}"
- COMMAND valgrind --error-exitcode=2 "./${arg_testname}"
+ COMMAND "${CMAKE_SOURCE_DIR}/build-aux/valgrind" "./${arg_testname}"
)
endif()
endfunction()
diff --git a/build-aux/valgrind b/build-aux/valgrind
new file mode 100755
index 0000000..728faca
--- /dev/null
+++ b/build-aux/valgrind
@@ -0,0 +1,15 @@
+#!/bin/env bash
+# build-aux/valgrind - Wrapper around valgrind to keep flags consistent
+#
+# Copyright (C) 2025 Luke T. Shumaker <lukeshu@lukeshu.com>
+# SPDX-License-Identifier: AGPL-3.0-or-later
+
+exec \
+ valgrind \
+ --error-exitcode=2 \
+ --leak-check=full \
+ --show-leak-kinds=all \
+ --errors-for-leak-kinds=all \
+ --show-error-list=all \
+ -- \
+ "$@"
diff --git a/lib9p/tests/runtest b/lib9p/tests/runtest
index 379ea6d..95f3218 100755
--- a/lib9p/tests/runtest
+++ b/lib9p/tests/runtest
@@ -7,8 +7,10 @@
set -euE -o pipefail
set -x
+build_aux=$(realpath --canonicalize-missing -- "${BASH_SOURCE[0]}/../../../build-aux")
+
port=$(python -c 'import socket; s=socket.socket(); s.bind(("", 0)); print(s.getsockname()[1]); s.close()')
-valgrind --error-exitcode=2 ./tests/test_server/test_server "$port" &
+"${build_aux}/valgrind" ./tests/test_server/test_server "$port" &
server_pid=$!
# shellcheck disable=SC2064
trap "kill $server_pid || true; wait $server_pid || true" EXIT
diff --git a/libcr/CMakeLists.txt b/libcr/CMakeLists.txt
index 80a4ece..2e66020 100644
--- a/libcr/CMakeLists.txt
+++ b/libcr/CMakeLists.txt
@@ -30,7 +30,7 @@ function(add_libcr_matrix_test n defs)
if ("CONFIG_COROUTINE_VALGRIND=1" IN_LIST defs)
add_test(
NAME "libcr/test_matrix${n}"
- COMMAND valgrind --error-exitcode=2 "./test_matrix${n}"
+ COMMAND "${CMAKE_SOURCE_DIR}/build-aux/valgrind" "./test_matrix${n}"
)
else()
add_test(