twister: error if valgrind executable not found

if --enable-valgrind is selected but no valgrind executable can be
found in PATH, exit with an error

Signed-off-by: Mikkel Jakobsen <mikkel.aunsbjerg@escolifesciences.com>
This commit is contained in:
Mikkel Jakobsen 2022-03-22 09:59:23 +01:00 committed by Anas Nashif
commit 78aa424f69
2 changed files with 5 additions and 1 deletions

View file

@ -578,7 +578,7 @@ class BinaryHandler(Handler):
command = [self.binary]
run_valgrind = False
if self.valgrind and shutil.which("valgrind"):
if self.valgrind:
command = ["valgrind", "--error-exitcode=2",
"--leak-check=full",
"--suppressions=" + ZEPHYR_BASE + "/scripts/valgrind.supp",

View file

@ -882,6 +882,10 @@ def main():
logger.error("west-flash requires device-testing to be enabled")
sys.exit(1)
if options.enable_valgrind and not shutil.which("valgrind"):
logger.error("valgrind enabled but valgrind executable not found")
sys.exit(1)
if options.coverage:
options.enable_coverage = True