[Lldb-commits] [lldb] r231072 - Fix and enable some tests on Linux (MI)
Ilia K
ki.stfu at gmail.com
Tue Mar 3 07:32:40 PST 2015
Author: ki.stfu
Date: Tue Mar 3 09:32:39 2015
New Revision: 231072
URL: http://llvm.org/viewvc/llvm-project?rev=231072&view=rev
Log:
Fix and enable some tests on Linux (MI)
Summary:
Fix and enable some lldb-mi tests on Linux:
Fixed:
# MiExecInterpreterTestCase.test_lldbmi_thread_step_in
# MiExecTestCase.test_lldbmi_exec_step
# MiStackTestCase.test_lldbmi_stack_info_frame tests.
Also I enabled the following tests on Linux:
# MiExecTestCase.test_lldbmi_exec_step_instruction
# MiSignalTestCase.test_lldbmi_stopped_when_interrupted
All test pass on OS X and Linux.
Reviewers: abidh, vharron, clayborg
Reviewed By: clayborg
Subscribers: vharron, lldb-commits, clayborg, abidh
Differential Revision: http://reviews.llvm.org/D7987
Modified:
lldb/trunk/test/tools/lldb-mi/TestMiInterpreterExec.py
lldb/trunk/test/tools/lldb-mi/control/TestMiExec.py
lldb/trunk/test/tools/lldb-mi/signal/TestMiSignal.py
lldb/trunk/test/tools/lldb-mi/stack/TestMiStack.py
Modified: lldb/trunk/test/tools/lldb-mi/TestMiInterpreterExec.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/TestMiInterpreterExec.py?rev=231072&r1=231071&r2=231072&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/TestMiInterpreterExec.py (original)
+++ lldb/trunk/test/tools/lldb-mi/TestMiInterpreterExec.py Tue Mar 3 09:32:39 2015
@@ -139,12 +139,16 @@ class MiInterpreterExecTestCase(lldbmi_t
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
- # Test that "thread step-in" steps in
- #FIXME: is this supposed to step into printf?
+ # Test that "thread step-in" steps into (or not) printf depending on debug info
+ # Note that message is different in Darwin and Linux:
+ # Darwin: "*stopped,reason=\"end-stepping-range\",frame={addr=\"0x[0-9a-f]+\",func=\"main\",args=[{name=\"argc\",value=\"1\"},{name=\"argv\",value="0x[0-9a-f]+\"}],file=\"main.cpp\",fullname=\".+main.cpp\",line=\"\d\"},thread-id=\"1\",stopped-threads=\"all\"
+ # Linux: "*stopped,reason=\"end-stepping-range\",frame={addr="0x[0-9a-f]+\",func=\"__printf\",args=[{name=\"format\",value=\"0x[0-9a-f]+\"}],file=\"printf.c\",fullname=\".+printf.c\",line="\d+"},thread-id=\"1\",stopped-threads=\"all\"
self.runCmd("-interpreter-exec console \"thread step-in\"")
self.expect("\^done")
- self.expect("~\"argc=1\\\\r\\\\n\"")
- self.expect("\*stopped,reason=\"end-stepping-range\"")
+ it = self.expect([ "~\"argc=1\\\\r\\\\n\"",
+ "\*stopped,reason=\"end-stepping-range\".+func=\"((?!main).)+\"" ])
+ if it == 0:
+ self.expect("\*stopped,reason=\"end-stepping-range\".+func=\"main\"")
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
Modified: lldb/trunk/test/tools/lldb-mi/control/TestMiExec.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/control/TestMiExec.py?rev=231072&r1=231071&r2=231072&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/control/TestMiExec.py (original)
+++ lldb/trunk/test/tools/lldb-mi/control/TestMiExec.py Tue Mar 3 09:32:39 2015
@@ -263,22 +263,25 @@ class MiExecTestCase(lldbmi_testcase.MiT
# Warning: the following is sensative to the lines in the source
- # Test that -exec-step does not step into printf (which
- # has no debug info)
- #FIXME: is this supposed to step into printf?
+ # Test that -exec-step steps into (or not) printf depending on debug info
+ # Note that message is different in Darwin and Linux:
+ # Darwin: "*stopped,reason=\"end-stepping-range\",frame={addr=\"0x[0-9a-f]+\",func=\"main\",args=[{name=\"argc\",value=\"1\"},{name=\"argv\",value="0x[0-9a-f]+\"}],file=\"main.cpp\",fullname=\".+main.cpp\",line=\"\d\"},thread-id=\"1\",stopped-threads=\"all\"
+ # Linux: "*stopped,reason=\"end-stepping-range\",frame={addr="0x[0-9a-f]+\",func=\"__printf\",args=[{name=\"format\",value=\"0x[0-9a-f]+\"}],file=\"printf.c\",fullname=\".+printf.c\",line="\d+"},thread-id=\"1\",stopped-threads=\"all\"
self.runCmd("-exec-step --thread 1 --frame 0")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.cpp\",line=\"29\"")
+ it = self.expect([ "\*stopped,reason=\"end-stepping-range\".+func=\"main\"",
+ "\*stopped,reason=\"end-stepping-range\".+func=\"((?!main).)+\"" ])
+ # Exit from printf if needed
+ if it == 1:
+ self.runCmd("-exec-finish")
+ self.expect("\^running")
+ self.expect("\*stopped,reason=\"end-stepping-range\".+func=\"main\"")
# Test that -exec-step steps into g_MyFunction and back out
# (and that --thread is optional)
self.runCmd("-exec-step --frame 0")
self.expect("\^running")
self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"g_MyFunction\(\)\"")
- #FIXME: is this supposed to step into printf?
- self.runCmd("-exec-step --frame 0")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"g_MyFunction\(\)\"")
# Use -exec-finish here to make sure that control reaches the caller.
# -exec-step can keep us in the g_MyFunction for gcc
self.runCmd("-exec-finish --frame 0")
@@ -286,15 +289,10 @@ class MiExecTestCase(lldbmi_testcase.MiT
self.expect("\*stopped,reason=\"end-stepping-range\".*main.cpp\",line=\"30\"")
# Test that -exec-step steps into s_MyFunction
- self.runCmd("-exec-step --frame 0")
- self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"s_MyFunction\(\)\"")
-
- # Test that -exec-step steps into g_MyFunction
# (and that --frame is optional)
self.runCmd("-exec-step --thread 1")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"g_MyFunction\(\)\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"s_MyFunction\(\)\"")
# Test that -exec-step steps into g_MyFunction from inside
# s_MyFunction (and that both --thread and --frame are optional)
@@ -315,7 +313,7 @@ class MiExecTestCase(lldbmi_testcase.MiT
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin due to calling convention assumptions")
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_exec_step_instruction(self):
"""Test that 'lldb-mi --interpreter' works for instruction stepping into."""
Modified: lldb/trunk/test/tools/lldb-mi/signal/TestMiSignal.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/signal/TestMiSignal.py?rev=231072&r1=231071&r2=231072&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/signal/TestMiSignal.py (original)
+++ lldb/trunk/test/tools/lldb-mi/signal/TestMiSignal.py Tue Mar 3 09:32:39 2015
@@ -16,7 +16,7 @@ class MiSignalTestCase(lldbmi_testcase.M
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
- @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ @skipIfFreeBSD # llvm.org/pr22411: Fails on FreeBSD apparently due to thread race conditions
def test_lldbmi_stopped_when_interrupt(self):
"""Test that 'lldb-mi --interpreter' interrupt and resume a looping app."""
@@ -70,8 +70,9 @@ class MiSignalTestCase(lldbmi_testcase.M
# Test that *stopped is printed
# Note that message is different in Darwin and Linux:
# Darwin: "*stopped,reason=\"signal-received\",signal-name=\"SIGINT\",signal-meaning=\"Interrupt\",frame={level=\"0\",addr=\"0x[0-9a-f]+\",func=\"_dyld_start\",file=\"??\",fullname=\"??\",line=\"-1\"},thread-id=\"1\",stopped-threads=\"all\"
- # Linux: "*stopped,reason=\"end-stepping-range\",frame={addr=\"0x[0-9a-f]+\",func=\"??\",args=\[\],file=\"??\",fullname=\"??\",line=\"-1\"},thread-id=\"1\",stopped-threads=\"all\"
- self.expect("\*stopped,reason=\"(signal-received|end-stepping-range)\",.+,thread-id=\"1\",stopped-threads=\"all\"")
+ # Linux: "*stopped,reason=\"end-stepping-range\",frame={addr=\"0x[0-9a-f]+\",func=\"??\",args=[],file=\"??\",fullname=\"??\",line=\"-1\"},thread-id=\"1\",stopped-threads=\"all\"
+ self.expect([ "\*stopped,reason=\"signal-received\",signal-name=\"SIGINT\",signal-meaning=\"Interrupt\",frame=\{level=\"0\",addr=\"0x[0-9a-f]+\",func=\"_dyld_start\",file=\"\?\?\",fullname=\"\?\?\",line=\"-1\"\},thread-id=\"1\",stopped-threads=\"all\"",
+ "\*stopped,reason=\"end-stepping-range\",frame={addr=\"0x[0-9a-f]+\",func=\"\?\?\",args=\[\],file=\"\?\?\",fullname=\"\?\?\",line=\"-1\"},thread-id=\"1\",stopped-threads=\"all\"" ])
# Run to main to make sure we have not exited the application
self.runCmd("-break-insert -f main")
@@ -150,7 +151,11 @@ class MiSignalTestCase(lldbmi_testcase.M
self.expect("\^running")
# Test that *stopped is printed
- self.expect("\*stopped,reason=\"exception-received\",exception=\"(EXC_BAD_ACCESS \(code=1, address=0x0\)|invalid address \(fault address: 0x0\))\",thread-id=\"1\",stopped-threads=\"all\"")
+ # Note that message is different in Darwin and Linux:
+ # Darwin: "*stopped,reason=\"exception-received\",exception=\"EXC_BAD_ACCESS (code=1, address=0x0)\",thread-id=\"1\",stopped-threads=\"all\""
+ # Linux: "*stopped,reason=\"exception-received\",exception=\"invalid address (fault address: 0x0)\",thread-id=\"1\",stopped-threads=\"all\""
+ self.expect([ "\*stopped,reason=\"exception-received\",exception=\"EXC_BAD_ACCESS \(code=1, address=0x0\)\",thread-id=\"1\",stopped-threads=\"all\"",
+ "\*stopped,reason=\"exception-received\",exception=\"invalid address \(fault address: 0x0\)\",thread-id=\"1\",stopped-threads=\"all\"" ])
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
Modified: lldb/trunk/test/tools/lldb-mi/stack/TestMiStack.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/stack/TestMiStack.py?rev=231072&r1=231071&r2=231072&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/stack/TestMiStack.py (original)
+++ lldb/trunk/test/tools/lldb-mi/stack/TestMiStack.py Tue Mar 3 09:32:39 2015
@@ -320,8 +320,11 @@ class MiStackTestCase(lldbmi_testcase.Mi
self.expect("\^done")
# Test that current frame is #1
+ # Note that message is different in Darwin and Linux:
+ # Darwin: "^done,frame={level=\"1\",addr=\"0x[0-9a-f]+\",func=\"start\",file=\"??\",fullname=\"??\",line=\"-1\"}"
+ # Linux: "^done,frame={level=\"1\",addr=\"0x[0-9a-f]+\",func=\".+\",file=\".+\",fullname=\".+\",line=\"\d+\"}"
self.runCmd("-stack-info-frame")
- self.expect("\^done,frame=\{level=\"1\",addr=\".+\",func=\".+\",file=\"\?\?\",fullname=\"\?\?\",line=\"-1\"\}")
+ self.expect("\^done,frame=\{level=\"1\",addr=\".+\",func=\".+\",file=\".+\",fullname=\".+\",line=\"(-1|\d+)\"\}")
# Test that -stack-select-frame can select frame #0 (child frame)
self.runCmd("-stack-select-frame 0")
More information about the lldb-commits
mailing list