@@ -59,7 +59,8 @@ def create_makefiles(self,
59
59
path_to_src = None ,
60
60
generator = None ,
61
61
coverage_output_type = None ,
62
- debug = False ):
62
+ debug = False ,
63
+ valgrind = False ):
63
64
"""
64
65
Create Makefiles and prepare targets with CMake.
65
66
@@ -94,6 +95,12 @@ def create_makefiles(self,
94
95
if coverage_output_type :
95
96
args .append ("-DCOVERAGE:STRING=%s" % coverage_output_type )
96
97
98
+ if valgrind :
99
+ args .append ("-DVALGRIND=1" )
100
+ args .append ("-DMEMORYCHECK_COMMAND_OPTIONS=\" --track-origins=yes\" \" --leak-check=full\" \" --show-reachable=yes\" \" --error-exitcode=1\" " )
101
+ else :
102
+ args .append ("-DVALGRIND=0" )
103
+
97
104
if path_to_src is not None :
98
105
args .append (path_to_src )
99
106
@@ -118,7 +125,7 @@ def build_tests(self):
118
125
"Building unit tests failed." ,
119
126
"Unit tests built successfully." )
120
127
121
- def run_tests (self , filter_regex = None ):
128
+ def run_tests (self , filter_regex = None , valgrind = False ):
122
129
"""
123
130
Run unit tests.
124
131
@@ -127,11 +134,16 @@ def run_tests(self, filter_regex=None):
127
134
"""
128
135
129
136
args = [self .make_program , "test" ]
130
-
131
- if filter_regex :
132
- args .append ("ARGS=-R %s -V -D ExperimentalTest" % filter_regex )
137
+ if valgrind :
138
+ if filter_regex :
139
+ args .append ("ARGS=-R %s -V -D ExperimentalMemCheck" % filter_regex )
140
+ else :
141
+ args .append ("ARGS=-V -D ExperimentalMemCheck" )
133
142
else :
134
- args .append ("ARGS=-V -D ExperimentalTest" )
143
+ if filter_regex :
144
+ args .append ("ARGS=-R %s -V -D ExperimentalTest" % filter_regex )
145
+ else :
146
+ args .append ("ARGS=-V -D ExperimentalTest" )
135
147
136
148
if logging .getLogger ().getEffectiveLevel () == logging .DEBUG :
137
149
args .append ("VERBOSE=1" )
0 commit comments