From cbac8a106e869236542207615a8b95ea3a0160ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arttu=20Yl=C3=A4-Outinen?= Date: Thu, 14 Jun 2018 09:28:28 +0300 Subject: [PATCH] Disable valgrind in tests by default Changes tests so that valgrind is enabled only when the environment variable KVZ_TEST_VALGRIND is set and equal to "1". --- .travis.yml | 2 +- tests/util.sh | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index db8faa38..a401fffd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,7 +36,7 @@ script: - ./autogen.sh - ./configure --enable-werror - make --jobs=2 V=1 - - make check VERBOSE=1 + - make check KVZ_TEST_VALGRIND=1 VERBOSE=1 after_script: # Disable errors to work around Travis not knowing how to fix their stuff. diff --git a/tests/util.sh b/tests/util.sh index 89a1e0fc..bc12767d 100644 --- a/tests/util.sh +++ b/tests/util.sh @@ -34,9 +34,18 @@ valgrind_test() { prepare "${dimensions}" "${frames}" + # If $KVZ_TEST_VALGRIND is defined and equal to "1", run the test with + # valgrind. Otherwise, run without valgrind. + if [ "${KVZ_TEST_VALGRIND:-0}" = '1' ]; then + valgrind='valgrind --leak-check=full --error-exitcode=1 --' + else + valgrind='' + fi + + # No quotes for $valgrind because it expands to multiple (or zero) + # arguments. print_and_run \ - libtool execute \ - valgrind --leak-check=full --error-exitcode=1 -- \ + libtool execute $valgrind \ ../src/kvazaar -i "${yuvfile}" "--input-res=${dimensions}" -o "${hevcfile}" "$@" print_and_run \