summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/api/log/TestAPILog.py
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2019-09-16 23:49:42 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2019-09-16 23:49:42 +0000
commit71b32e4175d111e1d2a62bf681b5c49e92ff163a (patch)
tree3c5db4b3e4ba4769ddc6c00ff61996612904cdb8 /lldb/packages/Python/lldbsuite/test/api/log/TestAPILog.py
parent0a0ea7ec99d4768a15ddbc0e5bfa66e3974e9bfd (diff)
downloadbcm5719-llvm-71b32e4175d111e1d2a62bf681b5c49e92ff163a.tar.gz
bcm5719-llvm-71b32e4175d111e1d2a62bf681b5c49e92ff163a.zip
[test] Fail gracefully if the regex doesn't match
This test is failing on the Fedora bot (staging). Rather than failing with an IndexError, we should trigger an assert and dump the log when the regex doesn't match. llvm-svn: 372052
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/api/log/TestAPILog.py')
-rw-r--r--lldb/packages/Python/lldbsuite/test/api/log/TestAPILog.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/api/log/TestAPILog.py b/lldb/packages/Python/lldbsuite/test/api/log/TestAPILog.py
index bc42c5e3985..f6fccad8d2c 100644
--- a/lldb/packages/Python/lldbsuite/test/api/log/TestAPILog.py
+++ b/lldb/packages/Python/lldbsuite/test/api/log/TestAPILog.py
@@ -34,15 +34,20 @@ class APILogTestCase(TestBase):
with open(logfile, 'r') as f:
log = f.read()
- # Find the debugger addr.
+ # Find the SBDebugger's address.
debugger_addr = re.findall(
r"lldb::SBDebugger::GetScriptingLanguage\(const char \*\) \(0x([0-9a-fA-F]+),",
- log)[0]
+ log)
- get_scripting_language = 'lldb::SBDebugger::GetScriptingLanguage(const char *) (0x{}, "")'.format(
- debugger_addr)
- create_target = 'lldb::SBDebugger::CreateTarget(const char *) (0x{}, "")'.format(
- debugger_addr)
+ # Make sure we've found a match.
+ self.assertTrue(debugger_addr, log)
+ # Make sure the GetScriptingLanguage matches.
+ get_scripting_language = 'lldb::SBDebugger::GetScriptingLanguage(const char *) (0x{}, "")'.format(
+ debugger_addr[0])
self.assertTrue(get_scripting_language in log, log)
+
+ # Make sure the address matches.
+ create_target = 'lldb::SBDebugger::CreateTarget(const char *) (0x{}, "")'.format(
+ debugger_addr[0])
self.assertTrue(create_target in log, log)
OpenPOWER on IntegriCloud