kbd/tests/unittest.at
Alexey Gladkov c9debc0b77
tests: Make memcheck optional
In some cases, it is not possible to use valgrind (e.g. on systems with
AVX512). There may be other restrictions on the use of this utility.

A separate configure option is added to leave the possibility to perform
tests but without memory check.

Link: https://github.com/legionus/kbd/issues/133
Signed-off-by: Alexey Gladkov <legion@kernel.org>
2025-06-01 17:23:21 +02:00

14 lines
459 B
Plaintext

AT_ARG_OPTION(memcheck, [AS_HELP_STRING([--memcheck], [check memory leaks during tests])])
m4_define([UNITTEST_RUN_MEMCHECK],[[
libtool --mode=execute -- "$abs_srcdir"/valgrind.sh memcheck $1 || exit $?;
cat stdout ||:;
sed '/==[0-9]\+== .*/d' stderr >&2 ||:
]])
m4_define([UNITTEST_MEMCHECK],[
AS_IF([test "x$at_arg_memcheck" != "xfalse"],
[AT_CHECK([UNITTEST_RUN_MEMCHECK([$1])],[$2],[$3],[$4],[$5],[$6])],
[AT_CHECK([$1],[$2],[$3],[$4],[$5],[$6])])
])