summaryrefslogtreecommitdiffstats
path: root/cmake/scripts/test.sh
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/scripts/test.sh')
-rwxr-xr-xcmake/scripts/test.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/cmake/scripts/test.sh b/cmake/scripts/test.sh
new file mode 100755
index 0000000..cbf0de4
--- /dev/null
+++ b/cmake/scripts/test.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+# SPDX-FileCopyrightText: 2024 Rafael G. Martins <rafael@rafaelmartins.eng.br>
+# SPDX-License-Identifier: BSD-3-Clause
+
+set -Eeuo pipefail
+
+if [[ "${VARIANT:-}" = "memcheck" ]]; then
+ export VALGRIND=valgrind
+ export TESTS_ENVIRONMENT="
+ ${VALGRIND} \
+ --tool=memcheck \
+ --leak-check=full \
+ --leak-resolution=high \
+ --num-callers=20 \
+ --error-exitcode=1 \
+ --show-possibly-lost=no"
+fi
+
+if [[ "${1}" == *.sh ]]; then
+ exec "${@}"
+else
+ exec ${TESTS_ENVIRONMENT:-} "${@}"
+fi