diff options
Diffstat (limited to 'lldb/test/stl/TestSTL.py')
-rw-r--r-- | lldb/test/stl/TestSTL.py | 50 |
1 files changed, 16 insertions, 34 deletions
diff --git a/lldb/test/stl/TestSTL.py b/lldb/test/stl/TestSTL.py index 0cad84ddf23..e89c5ad6761 100644 --- a/lldb/test/stl/TestSTL.py +++ b/lldb/test/stl/TestSTL.py @@ -14,58 +14,40 @@ class TestSTL(TestBase): @unittest2.expectedFailure def test_step_into_stl(self): """Test that we can successfully step into an STL function.""" - res = self.res exe = os.path.join(os.getcwd(), "a.out") + # The following two lines, if uncommented, will enable loggings. #self.ci.HandleCommand("log enable -f /tmp/lldb.log lldb default", res) #self.assertTrue(res.Succeeded()) - self.ci.HandleCommand("file " + exe, res) - self.assertTrue(res.Succeeded(), CURRENT_EXECUTABLE_SET) + + self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) # Break on line 13 of main.cpp. - self.ci.HandleCommand("breakpoint set -f main.cpp -l 13", res) - self.assertTrue(res.Succeeded(), CMD_MSG('breakpoint set')) - self.assertTrue(res.GetOutput().startswith( - "Breakpoint created: 1: file ='main.cpp', line = 13, locations = 1" - ), - BREAKPOINT_CREATED) + self.expect("breakpoint set -f main.cpp -l 13", BREAKPOINT_CREATED, + startstr = "Breakpoint created: 1: file ='main.cpp', line = 13, locations = 1") - self.ci.HandleCommand("run", res) - self.runStarted = True - self.assertTrue(res.Succeeded(), RUN_STOPPED) + self.runCmd("run", RUN_STOPPED) # Stop at 'std::string hello_world ("Hello World!");'. - self.ci.HandleCommand("thread list", res) - #print "thread list ->", res.GetOutput() - self.assertTrue(res.Succeeded(), CMD_MSG('thread list')) - output = res.GetOutput() - self.assertTrue(output.find('main.cpp:13') > 0 and - output.find('stop reason = breakpoint') > 0, - STOPPED_DUE_TO_BREAKPOINT) + self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, + substrs = ['main.cpp:13', + 'stop reason = breakpoint']) # The breakpoint should have a hit count of 1. - self.ci.HandleCommand("breakpoint list", res) - self.assertTrue(res.Succeeded(), CMD_MSG('breakpoint list')) - self.assertTrue(res.GetOutput().find(' resolved, hit count = 1') > 0, - BREAKPOINT_HIT_ONCE) + self.expect("breakpoint list", BREAKPOINT_HIT_ONCE, + substrs = [' resolved, hit count = 1']) # Now do 'thread step-in', we should stop on the basic_string template. - self.ci.HandleCommand("thread step-in", res) - #print "thread step-in:", res.GetOutput() - # # This assertion currently always fails. # This might be related: rdar://problem/8247112. # - self.assertTrue(res.Succeeded(), CMD_MSG("thread step-in")) + #self.runCmd("thread step-in", verbose=True) + self.runCmd("thread step-in") - self.ci.HandleCommand("thread backtrace", res) - print "thread backtrace:", res.GetOutput() - self.assertTrue(res.Succeeded(), CMD_MSG('thread backtarce')) - output = res.GetOutput() - self.assertTrue(output.find('[inlined]') > 0 and - output.find('basic_string.h'), - "Command 'thread backtrace' shows we stepped in STL") + self.expect("thread backtrace", "We have stepped in STL", + substrs = ['[inlined]', + 'basic_string.h']) if __name__ == '__main__': |