summaryrefslogtreecommitdiffstats
path: root/cmake/scripts/test.sh
blob: cbf0de4579b7b97e497720fdee0ebbc66270b083 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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