diff options
Diffstat (limited to 'packages/Python/lldbsuite/test/tools/lldb-mi')
22 files changed, 204 insertions, 32 deletions
diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiExit.py b/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiExit.py index 86a0a65b05a7..6f814c13ec83 100644 --- a/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiExit.py +++ b/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiExit.py @@ -4,16 +4,16 @@ Test that the lldb-mi driver exits properly. from __future__ import print_function - - import lldbmi_testcase +from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil class MiExitTestCase(lldbmi_testcase.MiTestCaseBase): mydir = TestBase.compute_mydir(__file__) - @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows") + @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows") @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races def test_lldbmi_gdb_exit(self): """Test that '-gdb-exit' terminates local debug session and exits.""" @@ -37,7 +37,7 @@ class MiExitTestCase(lldbmi_testcase.MiTestCaseBase): import pexpect self.expect(pexpect.EOF) - @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows") + @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows") @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races def test_lldbmi_quit(self): """Test that 'quit' exits immediately.""" @@ -60,7 +60,7 @@ class MiExitTestCase(lldbmi_testcase.MiTestCaseBase): import pexpect self.expect(pexpect.EOF) - @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows") + @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows") @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races def test_lldbmi_q(self): """Test that 'q' exits immediately.""" diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiFile.py b/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiFile.py index 8b4eac156362..99a06f2711fa 100644 --- a/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiFile.py +++ b/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiFile.py @@ -7,7 +7,9 @@ from __future__ import print_function import lldbmi_testcase +from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil class MiFileTestCase(lldbmi_testcase.MiTestCaseBase): diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiGdbSetShow.py b/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiGdbSetShow.py index ab3eb1fb37de..9898ad4398fb 100644 --- a/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiGdbSetShow.py +++ b/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiGdbSetShow.py @@ -8,13 +8,15 @@ from __future__ import print_function import unittest2 import lldbmi_testcase +from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil class MiGdbSetShowTestCase(lldbmi_testcase.MiTestCaseBase): mydir = TestBase.compute_mydir(__file__) - @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows") + @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows") @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races def test_lldbmi_gdb_set_target_async_default(self): """Test that 'lldb-mi --interpreter' switches to async mode by default.""" @@ -33,7 +35,7 @@ class MiGdbSetShowTestCase(lldbmi_testcase.MiTestCaseBase): self.runCmd("-gdb-show target-async") self.expect("\^done,value=\"on\"") - @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows") + @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows") @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races @expectedFlakeyLinux("llvm.org/pr26028") # Fails in ~1% of cases def test_lldbmi_gdb_set_target_async_on(self): @@ -62,9 +64,9 @@ class MiGdbSetShowTestCase(lldbmi_testcase.MiTestCaseBase): self.expect("\*running") self.expect("@\"argc=1") - @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows") + @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows") @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races - @expectedFailureLinux # Failing in ~11/600 dosep runs (build 3120-3122) + @expectedFailureAll(oslist=["linux"], bugnumber="Failing in ~11/600 dosep runs (build 3120-3122)") def test_lldbmi_gdb_set_target_async_off(self): """Test that 'lldb-mi --interpreter' can execute commands in sync mode.""" @@ -87,7 +89,7 @@ class MiGdbSetShowTestCase(lldbmi_testcase.MiTestCaseBase): if it < len(unexpected): self.fail("unexpected found: %s" % unexpected[it]) - @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows") + @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows") @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races def test_lldbmi_gdb_show_target_async(self): """Test that 'lldb-mi --interpreter' in async mode by default.""" @@ -98,7 +100,7 @@ class MiGdbSetShowTestCase(lldbmi_testcase.MiTestCaseBase): self.runCmd("-gdb-show target-async") self.expect("\^done,value=\"on\"") - @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows") + @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows") @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races def test_lldbmi_gdb_show_language(self): """Test that 'lldb-mi --interpreter' can get current language.""" @@ -120,7 +122,7 @@ class MiGdbSetShowTestCase(lldbmi_testcase.MiTestCaseBase): self.runCmd("-gdb-show language") self.expect("\^done,value=\"c\+\+\"") - @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows") + @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows") @unittest2.expectedFailure("-gdb-set ignores unknown properties") def test_lldbmi_gdb_set_unknown(self): """Test that 'lldb-mi --interpreter' fails when setting an unknown property.""" @@ -131,7 +133,7 @@ class MiGdbSetShowTestCase(lldbmi_testcase.MiTestCaseBase): self.runCmd("-gdb-set unknown some_value") self.expect("\^error") - @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows") + @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows") @unittest2.expectedFailure("-gdb-show ignores unknown properties") def test_lldbmi_gdb_show_unknown(self): """Test that 'lldb-mi --interpreter' fails when showing an unknown property.""" @@ -143,7 +145,7 @@ class MiGdbSetShowTestCase(lldbmi_testcase.MiTestCaseBase): self.expect("\^error") - @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows") + @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows") @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots def test_lldbmi_gdb_set_ouptut_radix(self): diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiLibraryLoaded.py b/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiLibraryLoaded.py index 4d9c935576df..8e1d72aa19c6 100644 --- a/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiLibraryLoaded.py +++ b/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiLibraryLoaded.py @@ -7,7 +7,9 @@ from __future__ import print_function import lldbmi_testcase +from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil class MiLibraryLoadedTestCase(lldbmi_testcase.MiTestCaseBase): diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiPrompt.py b/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiPrompt.py index d810267d9489..50e108e9fa20 100644 --- a/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiPrompt.py +++ b/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiPrompt.py @@ -7,7 +7,9 @@ from __future__ import print_function import lldbmi_testcase +from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil class MiPromptTestCase(lldbmi_testcase.MiTestCaseBase): diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py b/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py index 020954ff9b41..c4a801c991a4 100644 --- a/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py +++ b/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py @@ -5,10 +5,11 @@ Test lldb-mi -break-xxx commands. from __future__ import print_function - import unittest2 import lldbmi_testcase +from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil class MiBreakTestCase(lldbmi_testcase.MiTestCaseBase): @@ -16,6 +17,7 @@ class MiBreakTestCase(lldbmi_testcase.MiTestCaseBase): @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races + @expectedFlakeyLinux("llvm.org/pr24717") def test_lldbmi_break_insert_function_pending(self): """Test that 'lldb-mi --interpreter' works for pending function breakpoints.""" @@ -244,3 +246,48 @@ class MiBreakTestCase(lldbmi_testcase.MiTestCaseBase): self.runCmd("-exec-continue") self.expect("\^running") self.expect("\*stopped,reason=\"exited-normally\"") + + @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows + @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races + def test_lldbmi_break_enable_disable(self): + """Test that 'lldb-mi --interpreter' works for enabling / disabling breakpoints.""" + + self.spawnLldbMi(args = None) + + self.runCmd("-file-exec-and-symbols %s" % self.myexe) + self.expect("\^done") + + self.runCmd("-break-insert main") + self.expect("\^done,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"main\"") + self.expect("=breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",times=\"0\",original-location=\"main\"}") + + self.runCmd("-exec-run") + self.expect("\^running") + self.expect("=breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",times=\"0\",original-location=\"main\"}") + self.expect("\*stopped,reason=\"breakpoint-hit\",disp=\"del\",bkptno=\"1\"") + + self.runCmd("-break-insert ns::foo1") + self.expect("\^done,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"ns::foo1\(\)\"") + self.expect("=breakpoint-modified,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"ns::foo1\(\)\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",times=\"0\",original-location=\"ns::foo1\"}") + + self.runCmd("-break-insert ns::foo2") + self.expect("\^done,bkpt={number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"ns::foo2\(\)\"") + self.expect("=breakpoint-modified,bkpt={number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"ns::foo2\(\)\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",times=\"0\",original-location=\"ns::foo2\"}") + + # disable the 2nd breakpoint + self.runCmd("-break-disable 2") + self.expect("\^done") + self.expect("=breakpoint-modified,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"n\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"ns::foo1\(\)\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",times=\"0\",original-location=\"ns::foo1\"}") + + # disable the 3rd breakpoint and re-enable + self.runCmd("-break-disable 3") + self.expect("\^done") + self.expect("=breakpoint-modified,bkpt={number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"n\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"ns::foo2\(\)\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",times=\"0\",original-location=\"ns::foo2\"}") + + self.runCmd("-break-enable 3") + self.expect("\^done") + self.expect("=breakpoint-modified,bkpt={number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"ns::foo2\(\)\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",times=\"0\",original-location=\"ns::foo2\"}") + + self.runCmd("-exec-continue") + self.expect("\^running") + self.expect("\*stopped,reason=\"breakpoint-hit\",disp=\"del\",bkptno=\"3\"") diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py b/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py index 742bbc8af6bd..a62b9a25400c 100644 --- a/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py +++ b/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py @@ -7,7 +7,9 @@ from __future__ import print_function import lldbmi_testcase +from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil class MiExecTestCase(lldbmi_testcase.MiTestCaseBase): @@ -15,7 +17,7 @@ class MiExecTestCase(lldbmi_testcase.MiTestCaseBase): @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races - @expectedFailureLinux # llvm.org/pr25000: lldb-mi does not receive broadcasted notification from Core/Process about process stopped + @expectedFailureAll(oslist=["linux"], bugnumber="llvm.org/pr25000: lldb-mi does not receive broadcasted notification from Core/Process about process stopped") def test_lldbmi_exec_run(self): """Test that 'lldb-mi --interpreter' can stop at entry.""" @@ -204,7 +206,7 @@ class MiExecTestCase(lldbmi_testcase.MiTestCaseBase): @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races - @expectedFailurei386 #xfail to get buildbot green, failing config: i386 binary running on ubuntu 14.04 x86_64 + @expectedFailureAll(archs=["i[3-6]86"], bugnumber="xfail to get buildbot green, failing config: i386 binary running on ubuntu 14.04 x86_64") def test_lldbmi_exec_next_instruction(self): """Test that 'lldb-mi --interpreter' works for instruction stepping.""" @@ -232,18 +234,20 @@ class MiExecTestCase(lldbmi_testcase.MiTestCaseBase): # Test that --thread is optional self.runCmd("-exec-next-instruction --frame 0") self.expect("\^running") - self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"28\"") + # Depending on compiler, it can stop at different line + self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"(28|29)\"") # Test that --frame is optional self.runCmd("-exec-next-instruction --thread 1") self.expect("\^running") - self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"29\"") + # Depending on compiler, it can stop at different line + self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"(29|30)\"") # Test that both --thread and --frame are optional self.runCmd("-exec-next-instruction") self.expect("\^running") # Depending on compiler, it can stop at different line - self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"(29|30)\"") + self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"(29|30|31)\"") # Test that an invalid --thread is handled self.runCmd("-exec-next-instruction --thread 0") diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py b/packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py index df9f54110f4b..a19387627c49 100644 --- a/packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py +++ b/packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py @@ -8,7 +8,9 @@ from __future__ import print_function import unittest2 import lldbmi_testcase +from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil class MiDataTestCase(lldbmi_testcase.MiTestCaseBase): diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/interpreter/TestMiCliSupport.py b/packages/Python/lldbsuite/test/tools/lldb-mi/interpreter/TestMiCliSupport.py index 562be912fbc1..d80bc7f94a65 100644 --- a/packages/Python/lldbsuite/test/tools/lldb-mi/interpreter/TestMiCliSupport.py +++ b/packages/Python/lldbsuite/test/tools/lldb-mi/interpreter/TestMiCliSupport.py @@ -7,7 +7,9 @@ from __future__ import print_function import lldbmi_testcase +from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil class MiCliSupportTestCase(lldbmi_testcase.MiTestCaseBase): diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/interpreter/TestMiInterpreterExec.py b/packages/Python/lldbsuite/test/tools/lldb-mi/interpreter/TestMiInterpreterExec.py index 93d9f25683b0..2bcaaad38f45 100644 --- a/packages/Python/lldbsuite/test/tools/lldb-mi/interpreter/TestMiInterpreterExec.py +++ b/packages/Python/lldbsuite/test/tools/lldb-mi/interpreter/TestMiInterpreterExec.py @@ -7,7 +7,9 @@ from __future__ import print_function import lldbmi_testcase +from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil class MiInterpreterExecTestCase(lldbmi_testcase.MiTestCaseBase): @@ -55,7 +57,7 @@ class MiInterpreterExecTestCase(lldbmi_testcase.MiTestCaseBase): @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races - @expectedFailureLinux # Failing in ~9/600 dosep runs (build 3120-3122) + @expectedFlakeyLinux(bugnumber="llvm.org/pr25470") def test_lldbmi_settings_set_target_run_args_before(self): """Test that 'lldb-mi --interpreter' can set target arguments by 'setting set target.run-args' command before than target was created.""" @@ -87,7 +89,7 @@ class MiInterpreterExecTestCase(lldbmi_testcase.MiTestCaseBase): @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races - @expectedFailureLinux # Failing in ~9/600 dosep runs (build 3120-3122) + @expectedFailureAll(oslist=["linux"], bugnumber="Failing in ~9/600 dosep runs (build 3120-3122)") def test_lldbmi_settings_set_target_run_args_after(self): """Test that 'lldb-mi --interpreter' can set target arguments by 'setting set target.run-args' command after than target was created.""" diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/signal/TestMiSignal.py b/packages/Python/lldbsuite/test/tools/lldb-mi/signal/TestMiSignal.py index 11e7b8a82f68..197bfa80b3a0 100644 --- a/packages/Python/lldbsuite/test/tools/lldb-mi/signal/TestMiSignal.py +++ b/packages/Python/lldbsuite/test/tools/lldb-mi/signal/TestMiSignal.py @@ -7,7 +7,9 @@ from __future__ import print_function import lldbmi_testcase +from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil class MiSignalTestCase(lldbmi_testcase.MiTestCaseBase): diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/stack/TestMiStack.py b/packages/Python/lldbsuite/test/tools/lldb-mi/stack/TestMiStack.py index 14dab38bb338..54ed91951333 100644 --- a/packages/Python/lldbsuite/test/tools/lldb-mi/stack/TestMiStack.py +++ b/packages/Python/lldbsuite/test/tools/lldb-mi/stack/TestMiStack.py @@ -7,7 +7,9 @@ from __future__ import print_function import lldbmi_testcase +from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil class MiStackTestCase(lldbmi_testcase.MiTestCaseBase): @@ -199,7 +201,20 @@ class MiStackTestCase(lldbmi_testcase.MiTestCaseBase): self.expect("\^done,locals=\[{name=\"test_str\",type=\"const char \*\",value=\".*?Rakaposhi.*?\"},{name=\"var_e\",type=\"int\",value=\"24\"},{name=\"ptr\",type=\"int \*\",value=\".*?\"}\]") self.runCmd("-stack-list-locals --simple-values") self.expect("\^done,locals=\[{name=\"test_str\",type=\"const char \*\",value=\".*?Rakaposhi.*?\"},{name=\"var_e\",type=\"int\",value=\"24\"},{name=\"ptr\",type=\"int \*\",value=\".*?\"}\]") + + # Test -stack-list-locals in a function with catch clause, + # having unnamed parameter + # Run to BP_catch_unnamed + line = line_number('main.cpp', '// BP_catch_unnamed') + self.runCmd("-break-insert --file main.cpp:%d" % line) + self.expect("\^done,bkpt={number=\"6\"") + self.runCmd("-exec-continue") + self.expect("\^running") + self.expect("\*stopped,reason=\"breakpoint-hit\"") + # Test -stack-list-locals: use --no-values + self.runCmd("-stack-list-locals --no-values") + self.expect("\^done,locals=\[name=\"i\",name=\"j\"\]") @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races def test_lldbmi_stack_list_variables(self): diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/stack/main.cpp b/packages/Python/lldbsuite/test/tools/lldb-mi/stack/main.cpp index e11f83e108ec..32db32d2fd16 100644 --- a/packages/Python/lldbsuite/test/tools/lldb-mi/stack/main.cpp +++ b/packages/Python/lldbsuite/test/tools/lldb-mi/stack/main.cpp @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +#include <exception> + struct inner { int var_d; @@ -114,6 +116,18 @@ int do_tests_with_args() return 0; } +void catch_unnamed_test() +{ + try + { + int i = 1, j = 2; + throw std::exception(); // BP_catch_unnamed + } + catch(std::exception&) + { + } +} + int main(int argc, char const *argv[]) { @@ -121,6 +135,7 @@ main(int argc, char const *argv[]) local_struct_test(); local_array_test(); local_pointer_test(); + catch_unnamed_test(); do_tests_with_args(); return 0; diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py b/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py index 8f02f1c1eca8..8ddb6b3a1509 100644 --- a/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py +++ b/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py @@ -4,10 +4,10 @@ Test lldb-mi startup options. from __future__ import print_function - - import lldbmi_testcase +from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil class MiStartupOptionsTestCase(lldbmi_testcase.MiTestCaseBase): diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/TestMiSymbol.py b/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/TestMiSymbol.py index 3566b2f220c2..859c096e336d 100644 --- a/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/TestMiSymbol.py +++ b/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/TestMiSymbol.py @@ -7,7 +7,9 @@ from __future__ import print_function import lldbmi_testcase +from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil class MiSymbolTestCase(lldbmi_testcase.MiTestCaseBase): @@ -15,7 +17,7 @@ class MiSymbolTestCase(lldbmi_testcase.MiTestCaseBase): @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races - @expectedFailureLinux # new failure after r256863 + @expectedFailureAll(oslist=["linux"], bugnumber="new failure after r256863") def test_lldbmi_symbol_list_lines_file(self): """Test that 'lldb-mi --interpreter' works for -symbol-list-lines when file exists.""" diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py b/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py index f8a6743eb16d..a40e49f70e7e 100644 --- a/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py +++ b/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py @@ -7,7 +7,9 @@ from __future__ import print_function import lldbmi_testcase +from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil class MiSyntaxTestCase(lldbmi_testcase.MiTestCaseBase): @@ -61,7 +63,7 @@ class MiSyntaxTestCase(lldbmi_testcase.MiTestCaseBase): @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races - @expectedFailureLinux # Failing in ~6/600 dosep runs (build 3120-3122) + @expectedFailureAll(oslist=["linux"], bugnumber="Failing in ~6/600 dosep runs (build 3120-3122)") def test_lldbmi_process_output(self): """Test that 'lldb-mi --interpreter' wraps process output correctly.""" diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/target/TestMiTarget.py b/packages/Python/lldbsuite/test/tools/lldb-mi/target/TestMiTarget.py index 73ef913691cf..2d47db03637c 100644 --- a/packages/Python/lldbsuite/test/tools/lldb-mi/target/TestMiTarget.py +++ b/packages/Python/lldbsuite/test/tools/lldb-mi/target/TestMiTarget.py @@ -4,10 +4,10 @@ Test lldb-mi -target-xxx commands. from __future__ import print_function - - import lldbmi_testcase +from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil class MiTargetTestCase(lldbmi_testcase.MiTestCaseBase): diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/threadinfo/Makefile b/packages/Python/lldbsuite/test/tools/lldb-mi/threadinfo/Makefile new file mode 100644 index 000000000000..b6fad6778428 --- /dev/null +++ b/packages/Python/lldbsuite/test/tools/lldb-mi/threadinfo/Makefile @@ -0,0 +1,7 @@ +LEVEL = ../../../make + +CXX_SOURCES := test_threadinfo.cpp + +ENABLE_THREADS := YES + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/threadinfo/TestMiThreadInfo.py b/packages/Python/lldbsuite/test/tools/lldb-mi/threadinfo/TestMiThreadInfo.py new file mode 100644 index 000000000000..7226f2e8d320 --- /dev/null +++ b/packages/Python/lldbsuite/test/tools/lldb-mi/threadinfo/TestMiThreadInfo.py @@ -0,0 +1,39 @@ +""" +Test lldb-mi -thread-info command. +""" + +from __future__ import print_function + +import lldbmi_testcase +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + +class MiThreadInfoTestCase(lldbmi_testcase.MiTestCaseBase): + + mydir = TestBase.compute_mydir(__file__) + + @skipIfWindows # pthreads not supported on Windows + @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races + def test_lldbmi_thread_info(self): + """Test that -thread-info prints thread info and the current-thread-id""" + + self.spawnLldbMi(args = None) + + # Load executable + self.runCmd("-file-exec-and-symbols %s" % self.myexe) + self.expect("\^done") + + self.runCmd("-break-insert ThreadProc") + self.expect("\^done") + + # Run to the breakpoint + self.runCmd("-exec-run") + self.expect("\^running") + self.expect("\*stopped,reason=\"breakpoint-hit\"") + + self.runCmd("-thread-info") + self.expect("\^done,threads=\[\{id=\"1\",(.*)\},\{id=\"2\",(.*)\],current-thread-id=\"2\"") + + self.runCmd("-gdb-quit") + diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/threadinfo/test_threadinfo.cpp b/packages/Python/lldbsuite/test/tools/lldb-mi/threadinfo/test_threadinfo.cpp new file mode 100644 index 000000000000..1f444ece8c21 --- /dev/null +++ b/packages/Python/lldbsuite/test/tools/lldb-mi/threadinfo/test_threadinfo.cpp @@ -0,0 +1,21 @@ +#include <cstdlib> +#include <iostream> +#include <thread> + +using namespace std; + +void +ThreadProc() +{ + int i = 0; + i++; +} + +int +main() +{ + thread t(ThreadProc); + t.join(); + + return 0; +} diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiGdbSetShowPrint.py b/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiGdbSetShowPrint.py index 067df6408bd4..5ce2b99bbdee 100644 --- a/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiGdbSetShowPrint.py +++ b/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiGdbSetShowPrint.py @@ -8,7 +8,9 @@ from __future__ import print_function import lldbmi_testcase +from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil class MiGdbSetShowTestCase(lldbmi_testcase.MiTestCaseBase): @@ -108,7 +110,7 @@ class MiGdbSetShowTestCase(lldbmi_testcase.MiTestCaseBase): self.expect("\^error,msg=\"The request ''print' expects option-name and \"on\" or \"off\"' failed.\"") @skipIfWindows #llvm.org/pr24452: Get lldb-mi working on Windows - @expectedFailureGcc("https://llvm.org/bugs/show_bug.cgi?id=23357") + @expectedFailureAll(compiler="gcc", bugnumber="llvm.org/pr23357") @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races def test_lldbmi_gdb_set_show_print_expand_aggregates(self): """Test that 'lldb-mi --interpreter' can expand aggregates everywhere.""" @@ -167,7 +169,7 @@ class MiGdbSetShowTestCase(lldbmi_testcase.MiTestCaseBase): self.expect("\^error,msg=\"The request ''print' expects option-name and \"on\" or \"off\"' failed.\"") @skipIfWindows #llvm.org/pr24452: Get lldb-mi working on Windows - @expectedFailureGcc("https://llvm.org/bugs/show_bug.cgi?id=23357") + @expectedFailureAll(compiler="gcc", bugnumber="llvm.org/pr23357") @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races def test_lldbmi_gdb_set_show_print_aggregate_field_names(self): """Test that 'lldb-mi --interpreter' can expand aggregates everywhere.""" diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py b/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py index 26f3a9c63bdc..51f02b9e4a74 100644 --- a/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py +++ b/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py @@ -7,7 +7,9 @@ from __future__ import print_function import lldbmi_testcase +from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil class MiVarTestCase(lldbmi_testcase.MiTestCaseBase): @@ -34,9 +36,9 @@ class MiVarTestCase(lldbmi_testcase.MiTestCaseBase): # Print non-existant variable self.runCmd("-var-create var1 * undef") - self.expect("\^error,msg=\"error: error: use of undeclared identifier \'undef\'\\\\nerror: 1 errors parsing expression\\\\n\"") + self.expect("\^error,msg=\"error: use of undeclared identifier \'undef\'\\\\n\"") self.runCmd("-data-evaluate-expression undef") - self.expect("\^error,msg=\"Could not evaluate expression\"") + self.expect("\^error,msg=\"error: use of undeclared identifier \'undef\'\\\\n\"") # Print global "g_MyVar", modify, delete and create again self.runCmd("-data-evaluate-expression g_MyVar") |