From 71b32e4175d111e1d2a62bf681b5c49e92ff163a Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Mon, 16 Sep 2019 23:49:42 +0000 Subject: [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 --- .../Python/lldbsuite/test/api/log/TestAPILog.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'lldb/packages/Python/lldbsuite/test/api/log/TestAPILog.py') 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) -- cgit v1.2.3