autotest: correct Valgrind error detection

This commit is contained in:
Peter Barker 2024-05-31 11:52:17 +10:00 committed by Andrew Tridgell
parent ceecc2e205
commit 8ef16e91c3
1 changed files with 14 additions and 0 deletions

View File

@ -1491,6 +1491,16 @@ class Result(object):
return ret
class ValgrindFailedResult(Result):
'''a custom Result to allow passing of Vaglrind failures around'''
def __init__(self):
super(ValgrindFailedResult, self).__init__(None)
self.passed = False
def __str__(self):
return "Valgrind error detected"
class TestSuite(ABC):
"""Base abstract class.
It implements the common function for all vehicle types.
@ -11646,6 +11656,7 @@ switch value'''
valgrind_log = util.valgrind_log_filepath(binary=self.binary,
model=self.frame)
files = glob.glob("*" + valgrind_log)
valgrind_failed = False
for valgrind_log in files:
os.chmod(valgrind_log, 0o644)
if os.path.getsize(valgrind_log) > 0:
@ -11654,6 +11665,9 @@ switch value'''
os.path.basename(valgrind_log)))
self.progress("Valgrind log: moving %s to %s" % (valgrind_log, target))
shutil.move(valgrind_log, target)
valgrind_failed = True
if valgrind_failed:
result_list.append(ValgrindFailedResult())
return result_list