mirror of https://github.com/ArduPilot/ardupilot
autotest: correct Valgrind error detection
This commit is contained in:
parent
c76a772d26
commit
7c0c7b5cc3
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue