[lldb] Fix TestAPILog.py for reproducer replay

With the log file being a build artifact we don't need to clean it up.
If this happens before the reproducer is captured, the file will be
missing from the reproducer root but being part of the mapping.
This commit is contained in:
Jonas Devlieghere 2020-08-21 10:02:14 -07:00
parent 50aae46331
commit 08249d7f72
1 changed files with 3 additions and 8 deletions

View File

@ -19,20 +19,15 @@ class APILogTestCase(TestBase):
"""Test API logging"""
logfile = self.getBuildArtifact("api-log.txt")
def cleanup():
if os.path.exists(logfile):
os.unlink(logfile)
if configuration.is_reproducer_replay():
logfile = self.getReproducerRemappedPath(logfile)
self.addTearDownHook(cleanup)
self.expect("log enable lldb api -f {}".format(logfile))
self.dbg.SetDefaultArchitecture(None)
self.dbg.GetScriptingLanguage(None)
target = self.dbg.CreateTarget(None)
if configuration.is_reproducer_replay():
logfile = self.getReproducerRemappedPath(logfile)
self.assertTrue(os.path.isfile(logfile))
with open(logfile, 'r') as f:
log = f.read()