Skip to content

Commit 39f6d26

Browse files
committed
autotest: correct Valgrind error detection
1 parent 1e47205 commit 39f6d26

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Tools/autotest/vehicle_test_suite.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1666,6 +1666,16 @@ def __str__(self):
16661666
return ret
16671667

16681668

1669+
class ValgrindFailedResult(Result):
1670+
'''a custom Result to allow passing of Vaglrind failures around'''
1671+
def __init__(self):
1672+
super(ValgrindFailedResult, self).__init__(None)
1673+
self.passed = False
1674+
1675+
def __str__(self):
1676+
return "Valgrind error detected"
1677+
1678+
16691679
class TestSuite(ABC):
16701680
"""Base abstract class.
16711681
It implements the common function for all vehicle types.
@@ -11823,6 +11833,7 @@ def run_tests(self, tests) -> List[Result]:
1182311833
valgrind_log = util.valgrind_log_filepath(binary=self.binary,
1182411834
model=self.frame)
1182511835
files = glob.glob("*" + valgrind_log)
11836+
valgrind_failed = False
1182611837
for valgrind_log in files:
1182711838
os.chmod(valgrind_log, 0o644)
1182811839
if os.path.getsize(valgrind_log) > 0:
@@ -11831,6 +11842,9 @@ def run_tests(self, tests) -> List[Result]:
1183111842
os.path.basename(valgrind_log)))
1183211843
self.progress("Valgrind log: moving %s to %s" % (valgrind_log, target))
1183311844
shutil.move(valgrind_log, target)
11845+
valgrind_failed = True
11846+
if valgrind_failed:
11847+
result_list.append(ValgrindFailedResult())
1183411848

1183511849
return result_list
1183611850

0 commit comments

Comments
 (0)