Skip to content

Commit 142581c

Browse files
author
Antti Kauppila
committed
Added error handling in case Valgrind tool not found
1 parent 25a6e9d commit 142581c

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

UNITTESTS/unit_test/get_tools.py

+7
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ def get_cmake_tool():
5353

5454
return _get_program(["cmake"])
5555

56+
def get_valgrind_tool():
57+
"""
58+
Get Valgrind program
59+
"""
60+
61+
return _get_program(["valgrind"])
62+
5663
def get_cxx_tool():
5764
"""
5865
Get C++ compiler

UNITTESTS/unit_test/test.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
from .get_tools import get_make_tool, \
2929
get_cmake_tool, \
3030
get_cxx_tool, \
31-
get_c_tool
31+
get_c_tool, \
32+
get_valgrind_tool
3233
from .settings import DEFAULT_CMAKE_GENERATORS
3334

3435
class UnitTestTool(object):
@@ -96,6 +97,11 @@ def create_makefiles(self,
9697
args.append("-DCOVERAGE:STRING=%s" % coverage_output_type)
9798

9899
if valgrind:
100+
valgrind = get_valgrind_tool()
101+
if valgrind is None:
102+
logging.error(
103+
"No Valgrind found in Path. Install all the required tools.\n")
104+
sys.exit(1)
99105
args.append("-DVALGRIND=1")
100106
args.append("-DMEMORYCHECK_COMMAND_OPTIONS=\"--track-origins=yes\" \"--leak-check=full\" \"--show-reachable=yes\" \"--error-exitcode=1\"")
101107
else:

0 commit comments

Comments
 (0)