Use lazy regex in lldb-mi tests

This patch also fixes the timing issue in MiBreakTestCase.test_lldbmi_break_insert_function test.

llvm-svn: 235189
This commit is contained in:
Ilia K 2015-04-17 13:21:34 +00:00
parent 91ba4b1af6
commit 908cba40b6
11 changed files with 72 additions and 71 deletions

View File

@ -80,7 +80,7 @@ class MiGdbSetShowTestCase(lldbmi_testcase.MiTestCaseBase):
it = self.expect(unexpected + [ "~\"argc=1\\\\r\\\\n" ])
if it < len(unexpected):
# generate error if it's not "~\"argc=1\\\\r\\\\n"
self.expect("$UNEXPECTED FOUND: %s.^" % unexpected[it], timeout = 0)
self.expect("$UNEXPECTED FOUND: %s\.^" % unexpected[it], timeout = 0)
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")

View File

@ -31,7 +31,7 @@ class MiBreakTestCase(lldbmi_testcase.MiTestCaseBase):
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=\"\?\?\",file=\".+\",fullname=\".+\",line=\"(-1|\d+)\",pending=\[\"printf\"\],times=\"0\",original-location=\"printf\"}")
self.expect("=breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"\?\?\",file=\".+?\",fullname=\".+?\",line=\"(-1|\d+)\",pending=\[\"printf\"\],times=\"0\",original-location=\"printf\"}")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
@lldbmi_test
@ -47,26 +47,27 @@ class MiBreakTestCase(lldbmi_testcase.MiTestCaseBase):
self.runCmd("-break-insert -f main")
#FIXME main wasn't resolved
#self.expect("\^done,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"main\",file=\"main.cpp\",fullname=\".+main.cpp\",line=\"15\",pending=\[\"main\"\],times=\"0\",original-location=\"main\"}")
self.expect("\^done,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"0xffffffffffffffff\",func=\"main\",file=\"main.cpp\",fullname=\".+main.cpp\",line=\"15\",pending=\[\"main\"\],times=\"0\",original-location=\"main\"}")
#self.expect("\^done,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"15\",pending=\[\"main\"\],times=\"0\",original-location=\"main\"}")
self.expect("\^done,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"0xffffffffffffffff\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"15\",pending=\[\"main\"\],times=\"0\",original-location=\"main\"}")
#FIXME main wasn't resolved, =breakpoint-created is treated as =breakpoint-modified
#self.expect("=breakpoint-created,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"main\",file=\"main.cpp\",fullname=\".+main.cpp\",line=\"15\",pending=\[\"main\"\],times=\"0\",original-location=\"main\"}")
self.expect("=breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"0xffffffffffffffff\",func=\"main\",file=\"main.cpp\",fullname=\".+main.cpp\",line=\"15\",pending=\[\"main\"\],times=\"0\",original-location=\"main\"}")
#self.expect("=breakpoint-created,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"15\",pending=\[\"main\"\],times=\"0\",original-location=\"main\"}")
self.expect("=breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"0xffffffffffffffff\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"15\",pending=\[\"main\"\],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=\"15\",pending=\[\"main\"\],times=\"0\",original-location=\"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=\"15\",pending=\[\"main\"\],times=\"0\",original-location=\"main\"}")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
self.runCmd("-break-insert printf")
#FIXME function name is unknown on Darwin
#self.expect("\^done,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"printf\",file=\".+\",fullname=\".+\",line=\"(-1|\d+)\",times=\"0\",original-location=\"printf\"}")
self.expect("\^done,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\".+\",file=\".+\",fullname=\".+\",line=\"(-1|\d+)\",times=\"0\",original-location=\"printf\"}")
#self.expect("\^done,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"printf\",file=\".+?\",fullname=\".+?\",line=\"(-1|\d+)\",times=\"0\",original-location=\"printf\"}")
self.expect("\^done,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\".+?\",file=\".+?\",fullname=\".+?\",line=\"(-1|\d+)\",times=\"0\",original-location=\"printf\"}")
#FIXME function name is unknown on Darwin, =breakpoint-created is treated as =breakpoint-modified
#self.expect("=breakpoint-created,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"printf\",file=\".+\",fullname=\".+\",line=\"(-1|\d+)\",times=\"0\",original-location=\"printf\"}")
self.expect("=breakpoint-modified,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\".+\",file=\".+\",fullname=\".+\",line=\"(-1|\d+)\",times=\"0\",original-location=\"printf\"}")
# FIXME function name is unknown on Darwin, duplicated messages are skipped in pexpect
#self.expect("=breakpoint-modified,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"printf\",file=\".+\",fullname=\".+\",line=\"(-1|\d+)\",times=\"0\",original-location=\"printf\"}")
#self.expect("=breakpoint-created,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"printf\",file=\".+?\",fullname=\".+?\",line=\"(-1|\d+)\",times=\"0\",original-location=\"printf\"}")
self.expect("=breakpoint-modified,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\".+?\",file=\".+?\",fullname=\".+?\",line=\"(-1|\d+)\",times=\"0\",original-location=\"printf\"}")
# FIXME function name is unknown on Darwin
#self.expect("=breakpoint-modified,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"printf\",file=\".+?\",fullname=\".+?\",line=\"(-1|\d+)\",times=\"0\",original-location=\"printf\"}")
self.expect("=breakpoint-modified,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\".+?\",file=\".+?\",fullname=\".+?\",line=\"(-1|\d+)\",times=\"0\",original-location=\"printf\"}")
self.runCmd("-exec-continue")
self.expect("\^running")

View File

@ -20,7 +20,7 @@ class MiExecTestCase(lldbmi_testcase.MiTestCaseBase):
# Test that -exec-abort fails on invalid process
self.runCmd("-exec-abort")
self.expect("\^error,msg=\"Command 'exec-abort'. Invalid process during debug session\"")
self.expect("\^error,msg=\"Command 'exec-abort'\. Invalid process during debug session\"")
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@ -156,22 +156,22 @@ class MiExecTestCase(lldbmi_testcase.MiTestCaseBase):
# Test -exec-next
self.runCmd("-exec-next --thread 1 --frame 0")
self.expect("\^running")
self.expect("\*stopped,reason=\"end-stepping-range\".*main.cpp\",line=\"29\"")
self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"29\"")
# Test that --thread is optional
self.runCmd("-exec-next --frame 0")
self.expect("\^running")
self.expect("\*stopped,reason=\"end-stepping-range\".*main.cpp\",line=\"30\"")
self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"30\"")
# Test that --frame is optional
self.runCmd("-exec-next --thread 1")
self.expect("\^running")
self.expect("\*stopped,reason=\"end-stepping-range\".*main.cpp\",line=\"31\"")
self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"31\"")
# Test that both --thread and --frame are optional
self.runCmd("-exec-next")
self.expect("\^running")
self.expect("\*stopped,reason=\"end-stepping-range\".*main.cpp\",line=\"32\"")
self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"32\"")
# Test that an invalid --thread is handled
self.runCmd("-exec-next --thread 0")
@ -210,23 +210,23 @@ class MiExecTestCase(lldbmi_testcase.MiTestCaseBase):
# Test -exec-next-instruction
self.runCmd("-exec-next-instruction --thread 1 --frame 0")
self.expect("\^running")
self.expect("\*stopped,reason=\"end-stepping-range\".*main.cpp\",line=\"28\"")
self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"28\"")
# 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\"")
self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"28\"")
# 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\"")
self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"29\"")
# 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)\"")
# Test that an invalid --thread is handled
self.runCmd("-exec-next-instruction --thread 0")
@ -266,36 +266,36 @@ class MiExecTestCase(lldbmi_testcase.MiTestCaseBase):
# 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")
it = self.expect([ "\*stopped,reason=\"end-stepping-range\".+func=\"main\"",
"\*stopped,reason=\"end-stepping-range\".+func=\"((?!main).)+\"" ])
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\"")
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.*\"")
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")
self.expect("\^running")
self.expect("\*stopped,reason=\"end-stepping-range\".*main.cpp\",line=\"30\"")
self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"30\"")
# Test that -exec-step steps into s_MyFunction
# (and that --frame is optional)
self.runCmd("-exec-step --thread 1")
self.expect("\^running")
self.expect("\*stopped,reason=\"end-stepping-range\".*func=\".*s_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)
self.runCmd("-exec-step")
self.expect("\^running")
self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"g_MyFunction.*\"")
self.expect("\*stopped,reason=\"end-stepping-range\".+?func=\"g_MyFunction.*?\"")
# Test that an invalid --thread is handled
self.runCmd("-exec-step --thread 0")
@ -333,31 +333,31 @@ class MiExecTestCase(lldbmi_testcase.MiTestCaseBase):
# Test that -exec-next steps over printf
self.runCmd("-exec-next --thread 1 --frame 0")
self.expect("\^running")
self.expect("\*stopped,reason=\"end-stepping-range\".*main.cpp\",line=\"29\"")
self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"29\"")
# Test that -exec-step-instruction steps over non branching
# instruction
self.runCmd("-exec-step-instruction --thread 1 --frame 0")
self.expect("\^running")
self.expect("\*stopped,reason=\"end-stepping-range\".*main.cpp\"")
self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\"")
# Test that -exec-step-instruction steps into g_MyFunction
# instruction (and that --thread is optional)
self.runCmd("-exec-step-instruction --frame 0")
self.expect("\^running")
self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"g_MyFunction.*\"")
self.expect("\*stopped,reason=\"end-stepping-range\".+?func=\"g_MyFunction.*?\"")
# Test that -exec-step-instruction steps over non branching
# (and that --frame is optional)
self.runCmd("-exec-step-instruction --thread 1")
self.expect("\^running")
self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"g_MyFunction.*\"")
self.expect("\*stopped,reason=\"end-stepping-range\".+?func=\"g_MyFunction.*?\"")
# Test that -exec-step-instruction steps into g_MyFunction
# (and that both --thread and --frame are optional)
self.runCmd("-exec-step-instruction")
self.expect("\^running")
self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"g_MyFunction.*\"")
self.expect("\*stopped,reason=\"end-stepping-range\".+?func=\"g_MyFunction.*?\"")
# Test that an invalid --thread is handled
self.runCmd("-exec-step-instruction --thread 0")
@ -392,7 +392,7 @@ class MiExecTestCase(lldbmi_testcase.MiTestCaseBase):
# Test that -exec-finish returns from g_MyFunction
self.runCmd("-exec-finish --thread 1 --frame 0")
self.expect("\^running")
self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"main\"")
self.expect("\*stopped,reason=\"end-stepping-range\".+?func=\"main\"")
# Run to BP inside s_MyFunction call
self.runCmd("-break-insert s_MyFunction")
@ -411,13 +411,13 @@ class MiExecTestCase(lldbmi_testcase.MiTestCaseBase):
# s_MyFunction (and that --frame is optional)
self.runCmd("-exec-finish --thread 1")
self.expect("\^running")
self.expect("\*stopped,reason=\"end-stepping-range\".*func=\".*s_MyFunction.*\"")
self.expect("\*stopped,reason=\"end-stepping-range\".+?func=\".*?s_MyFunction.*?\"")
# Test that -exec-finish returns from s_MyFunction
# (and that both --thread and --frame are optional)
self.runCmd("-exec-finish")
self.expect("\^running")
self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"main\"")
self.expect("\*stopped,reason=\"end-stepping-range\".+?func=\"main\"")
# Test that an invalid --thread is handled
self.runCmd("-exec-finish --thread 0")
@ -440,7 +440,7 @@ class MiExecTestCase(lldbmi_testcase.MiTestCaseBase):
## Test that -exec-finish returns from printf
self.runCmd("-exec-finish --thread 1 --frame 0")
self.expect("\^running")
self.expect("\*stopped,reason=\"end-stepping-range\".*func=\"main\"")
self.expect("\*stopped,reason=\"end-stepping-range\".+?func=\"main\"")
if __name__ == '__main__':
unittest2.main()

View File

@ -36,7 +36,7 @@ class MiDataTestCase(lldbmi_testcase.MiTestCaseBase):
# Test -data-disassemble: try to disassemble some address
self.runCmd("-data-disassemble -s %#x -e %#x -- 0" % (addr, addr + 0x10))
self.expect("\^done,asm_insns=\[{address=\"0x0*%x\",func-name=\"main\",offset=\"0\",size=\"[1-9]+\",inst=\".+\"}," % addr)
self.expect("\^done,asm_insns=\[{address=\"0x0*%x\",func-name=\"main\",offset=\"0\",size=\"[1-9]+\",inst=\".+?\"}," % addr)
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@ -99,11 +99,11 @@ class MiDataTestCase(lldbmi_testcase.MiTestCaseBase):
# Test -data-list-register-names: try to get all registers
self.runCmd("-data-list-register-names")
self.expect("\^done,register-names=\[\".+\",")
self.expect("\^done,register-names=\[\".+?\",")
# Test -data-list-register-names: try to get specified registers
self.runCmd("-data-list-register-names 0")
self.expect("\^done,register-names=\[\".+\"\]")
self.expect("\^done,register-names=\[\".+?\"\]")
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")

View File

@ -151,9 +151,9 @@ class MiCliSupportTestCase(lldbmi_testcase.MiTestCaseBase):
self.runCmd("thread step-in")
self.expect("\^done")
it = self.expect([ "~\"argc=1\\\\r\\\\n\"",
"\*stopped,reason=\"end-stepping-range\".+func=\"((?!main).)+\"" ])
"\*stopped,reason=\"end-stepping-range\".+?func=\"(?!main).+?\"" ])
if it == 0:
self.expect("\*stopped,reason=\"end-stepping-range\".+func=\"main\"")
self.expect("\*stopped,reason=\"end-stepping-range\".+?func=\"main\"")
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")

View File

@ -147,9 +147,9 @@ class MiInterpreterExecTestCase(lldbmi_testcase.MiTestCaseBase):
self.runCmd("-interpreter-exec console \"thread step-in\"")
self.expect("\^done")
it = self.expect([ "~\"argc=1\\\\r\\\\n\"",
"\*stopped,reason=\"end-stepping-range\".+func=\"((?!main).)+\"" ])
"\*stopped,reason=\"end-stepping-range\".+?func=\"(?!main).+?\"" ])
if it == 0:
self.expect("\*stopped,reason=\"end-stepping-range\".+func=\"main\"")
self.expect("\*stopped,reason=\"end-stepping-range\".+?func=\"main\"")
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")

View File

@ -37,7 +37,7 @@ class MiSignalTestCase(lldbmi_testcase.MiTestCaseBase):
# Test that -exec-interrupt can interrupt an execution
self.runCmd("-exec-interrupt")
self.expect("\*stopped,reason=\"signal-received\",signal-name=\"SIGINT\",signal-meaning=\"Interrupt\",.*thread-id=\"1\",stopped-threads=\"all\"")
self.expect("\*stopped,reason=\"signal-received\",signal-name=\"SIGINT\",signal-meaning=\"Interrupt\",.+?thread-id=\"1\",stopped-threads=\"all\"")
# Continue (to loop forever)
self.runCmd("-exec-continue")
@ -111,7 +111,7 @@ class MiSignalTestCase(lldbmi_testcase.MiTestCaseBase):
self.expect("\^done")
# Test that *stopped is printed
self.expect("\*stopped,reason=\"signal-received\",signal-name=\"SIGINT\",signal-meaning=\"Interrupt\",.*thread-id=\"1\",stopped-threads=\"all\"")
self.expect("\*stopped,reason=\"signal-received\",signal-name=\"SIGINT\",signal-meaning=\"Interrupt\",.+?thread-id=\"1\",stopped-threads=\"all\"")
# Exit
self.runCmd("-gdb-exit")

View File

@ -59,7 +59,7 @@ class MiStackTestCase(lldbmi_testcase.MiTestCaseBase):
self.runCmd("-stack-list-arguments 0 -1 0")
#self.expect("\^error")
self.runCmd("-stack-list-arguments 0 0")
self.expect("\^error,msg=\"Command 'stack-list-arguments'. Thread frame range invalid\"")
self.expect("\^error,msg=\"Command 'stack-list-arguments'\. Thread frame range invalid\"")
# Test that an invalid high-frame is handled
# FIXME: -1 is treated as unsigned int
@ -68,11 +68,11 @@ class MiStackTestCase(lldbmi_testcase.MiTestCaseBase):
# Test that a missing low-frame or high-frame is handled
self.runCmd("-stack-list-arguments 0 0")
self.expect("\^error,msg=\"Command 'stack-list-arguments'. Thread frame range invalid\"")
self.expect("\^error,msg=\"Command 'stack-list-arguments'\. Thread frame range invalid\"")
# Test that an invalid low-frame is handled
self.runCmd("-stack-list-arguments 0 0")
self.expect("\^error,msg=\"Command 'stack-list-arguments'. Thread frame range invalid\"")
self.expect("\^error,msg=\"Command 'stack-list-arguments'\. Thread frame range invalid\"")
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@ -191,15 +191,15 @@ class MiStackTestCase(lldbmi_testcase.MiTestCaseBase):
# Test -stack-list-locals: use 1 or --all-values
self.runCmd("-stack-list-locals 1")
self.expect("\^done,locals=\[{name=\"test_str\",value=\".*Rakaposhi.*\"},{name=\"var_e\",value=\"24\"},{name=\"ptr\",value=\".*\"}\]")
self.expect("\^done,locals=\[{name=\"test_str\",value=\".*?Rakaposhi.*?\"},{name=\"var_e\",value=\"24\"},{name=\"ptr\",value=\".*?\"}\]")
self.runCmd("-stack-list-locals --all-values")
self.expect("\^done,locals=\[{name=\"test_str\",value=\".*Rakaposhi.*\"},{name=\"var_e\",value=\"24\"},{name=\"ptr\",value=\".*\"}\]")
self.expect("\^done,locals=\[{name=\"test_str\",value=\".*?Rakaposhi.*?\"},{name=\"var_e\",value=\"24\"},{name=\"ptr\",value=\".*?\"}\]")
# Test -stack-list-locals: use 2 or --simple-values
self.runCmd("-stack-list-locals 2")
self.expect("\^done,locals=\[{name=\"test_str\",value=\".*Rakaposhi.*\"},{name=\"var_e\",value=\"24\"},{name=\"ptr\",value=\".*\"}\]")
self.expect("\^done,locals=\[{name=\"test_str\",value=\".*?Rakaposhi.*?\"},{name=\"var_e\",value=\"24\"},{name=\"ptr\",value=\".*?\"}\]")
self.runCmd("-stack-list-locals --simple-values")
self.expect("\^done,locals=\[{name=\"test_str\",value=\".*Rakaposhi.*\"},{name=\"var_e\",value=\"24\"},{name=\"ptr\",value=\".*\"}\]")
self.expect("\^done,locals=\[{name=\"test_str\",value=\".*?Rakaposhi.*?\"},{name=\"var_e\",value=\"24\"},{name=\"ptr\",value=\".*?\"}\]")
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@ -246,7 +246,7 @@ class MiStackTestCase(lldbmi_testcase.MiTestCaseBase):
# Test that -stack-info-frame fails when program isn't running
self.runCmd("-stack-info-frame")
self.expect("\^error,msg=\"Command 'stack-info-frame'. Invalid process during debug session\"")
self.expect("\^error,msg=\"Command 'stack-info-frame'\. Invalid process during debug session\"")
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@ -261,7 +261,7 @@ class MiStackTestCase(lldbmi_testcase.MiTestCaseBase):
# Test that -stack-info-frame works when program was stopped on BP
self.runCmd("-stack-info-frame")
self.expect("\^done,frame=\{level=\"0\",addr=\".+\",func=\"main\",file=\"main\.cpp\",fullname=\".*main\.cpp\",line=\"\d+\"\}")
self.expect("\^done,frame=\{level=\"0\",addr=\"0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\"\}")
# Select frame #1
self.runCmd("-stack-select-frame 1")
@ -269,7 +269,7 @@ class MiStackTestCase(lldbmi_testcase.MiTestCaseBase):
# Test that -stack-info-frame works when specified frame was selected
self.runCmd("-stack-info-frame")
self.expect("\^done,frame=\{level=\"1\",addr=\".+\",func=\".+\",file=\"\?\?\",fullname=\"\?\?\",line=\"-1\"\}")
self.expect("\^done,frame=\{level=\"1\",addr=\"0x[0-9a-f]+\",func=\".+?\",file=\"\?\?\",fullname=\"\?\?\",line=\"-1\"\}")
# Test that -stack-info-frame fails when an argument is specified
#FIXME: unknown argument is ignored
@ -297,7 +297,7 @@ class MiStackTestCase(lldbmi_testcase.MiTestCaseBase):
# Test stack frame: get frame #0 info
self.runCmd("-stack-list-frames 0 0")
self.expect("\^done,stack=\[frame=\{level=\"0\",addr=\".+\",func=\"main\",file=\"main\.cpp\",fullname=\".*main\.cpp\",line=\".+\"\}\]")
self.expect("\^done,stack=\[frame=\{level=\"0\",addr=\"0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\"\}\]")
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@ -320,15 +320,15 @@ class MiStackTestCase(lldbmi_testcase.MiTestCaseBase):
# Test that -stack-select-frame requires 1 mandatory argument
self.runCmd("-stack-select-frame")
self.expect("\^error,msg=\"Command 'stack-select-frame'. Command Args. Missing options, 1 or more required\"")
self.expect("\^error,msg=\"Command 'stack-select-frame'\. Command Args\. Missing options, 1 or more required\"")
# Test that -stack-select-frame fails on invalid frame number
self.runCmd("-stack-select-frame 99")
self.expect("\^error,msg=\"Command 'stack-select-frame'. Frame ID invalid\"")
self.expect("\^error,msg=\"Command 'stack-select-frame'\. Frame ID invalid\"")
# Test that current frame is #0
self.runCmd("-stack-info-frame")
self.expect("\^done,frame=\{level=\"0\",addr=\".+\",func=\"main\",file=\"main\.cpp\",fullname=\".*main\.cpp\",line=\"\d+\"\}")
self.expect("\^done,frame=\{level=\"0\",addr=\"0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\"\}")
# Test that -stack-select-frame can select the selected frame
self.runCmd("-stack-select-frame 0")
@ -336,7 +336,7 @@ class MiStackTestCase(lldbmi_testcase.MiTestCaseBase):
# Test that current frame is still #0
self.runCmd("-stack-info-frame")
self.expect("\^done,frame=\{level=\"0\",addr=\".+\",func=\"main\",file=\"main\.cpp\",fullname=\".*main\.cpp\",line=\"\d+\"\}")
self.expect("\^done,frame=\{level=\"0\",addr=\"0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\"\}")
# Test that -stack-select-frame can select frame #1 (parent frame)
self.runCmd("-stack-select-frame 1")
@ -347,7 +347,7 @@ class MiStackTestCase(lldbmi_testcase.MiTestCaseBase):
# 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|\d+)\"\}")
self.expect("\^done,frame=\{level=\"1\",addr=\"0x[0-9a-f]+\",func=\".+?\",file=\".+?\",fullname=\".+?\",line=\"(-1|\d+)\"\}")
# Test that -stack-select-frame can select frame #0 (child frame)
self.runCmd("-stack-select-frame 0")
@ -355,7 +355,7 @@ class MiStackTestCase(lldbmi_testcase.MiTestCaseBase):
# Test that current frame is #0 and it has the same information
self.runCmd("-stack-info-frame")
self.expect("\^done,frame=\{level=\"0\",addr=\".+\",func=\"main\",file=\"main\.cpp\",fullname=\".*main\.cpp\",line=\"\d+\"\}")
self.expect("\^done,frame=\{level=\"0\",addr=\"0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\"\}")
if __name__ == '__main__':
unittest2.main()

View File

@ -49,7 +49,7 @@ class MiStartupOptionsTestCase(lldbmi_testcase.MiTestCaseBase):
# Test that the executable isn't loaded when unknown file was specified
self.expect("-file-exec-and-symbols \"%s\"" % path)
self.expect("\^error,msg=\"Command 'file-exec-and-symbols'. Target binary '%s' is invalid. error: unable to find executable for '%s'\"" % (path, path))
self.expect("\^error,msg=\"Command 'file-exec-and-symbols'\. Target binary '%s' is invalid\. error: unable to find executable for '%s'\"" % (path, path))
# Test that lldb-mi is ready when executable was loaded
self.expect(self.child_prompt, exactly = True)
@ -123,7 +123,7 @@ class MiStartupOptionsTestCase(lldbmi_testcase.MiTestCaseBase):
# Test that the executable isn't loaded when file was specified using unknown path
self.expect("-file-exec-and-symbols \"%s\"" % path)
self.expect("\^error,msg=\"Command 'file-exec-and-symbols'. Target binary '%s' is invalid. error: unable to find executable for '%s'\"" % (path, path))
self.expect("\^error,msg=\"Command 'file-exec-and-symbols'\. Target binary '%s' is invalid\. error: unable to find executable for '%s'\"" % (path, path))
# Test that lldb-mi is ready when executable was loaded
self.expect(self.child_prompt, exactly = True)

View File

@ -41,11 +41,11 @@ class MiSymbolTestCase(lldbmi_testcase.MiTestCaseBase):
# Test that -symbol-list-lines fails when file doesn't exist
self.runCmd("-symbol-list-lines unknown_file")
self.expect("\^error,message=\"warning: No source filenames matched 'unknown_file'. error: no source filenames matched any command arguments \"")
self.expect("\^error,message=\"warning: No source filenames matched 'unknown_file'\. error: no source filenames matched any command arguments \"")
# Test that -symbol-list-lines fails when file is specified using relative path
self.runCmd("-symbol-list-lines ./main.cpp")
self.expect("\^error,message=\"warning: No source filenames matched './main.cpp'. error: no source filenames matched any command arguments \"")
self.expect("\^error,message=\"warning: No source filenames matched '\./main\.cpp'\. error: no source filenames matched any command arguments \"")
# Test that -symbol-list-lines works when file is specified using absolute path
import os
@ -55,7 +55,7 @@ class MiSymbolTestCase(lldbmi_testcase.MiTestCaseBase):
# Test that -symbol-list-lines fails when file doesn't exist
self.runCmd("-symbol-list-lines unknown_dir/main.cpp")
self.expect("\^error,message=\"warning: No source filenames matched 'unknown_dir/main.cpp'. error: no source filenames matched any command arguments \"")
self.expect("\^error,message=\"warning: No source filenames matched 'unknown_dir/main\.cpp'\. error: no source filenames matched any command arguments \"")
if __name__ == '__main__':
unittest2.main()

View File

@ -113,9 +113,9 @@ class MiVarTestCase(lldbmi_testcase.MiTestCaseBase):
self.runCmd("-data-evaluate-expression \"argv[0]\"")
self.expect("\^done,value=\"0x[0-9a-f]+\"")
self.runCmd("-var-create var6 * \"argv[0]\"")
self.expect("\^done,name=\"var6\",numchild=\"1\",value=\"0x[0-9a-f]+ \\\\\\\".*%s\\\\\\\"\",type=\"const char \*\",thread-id=\"1\",has_more=\"0\"" % self.myexe)
self.expect("\^done,name=\"var6\",numchild=\"1\",value=\"0x[0-9a-f]+ \\\\\\\".*?%s\\\\\\\"\",type=\"const char \*\",thread-id=\"1\",has_more=\"0\"" % self.myexe)
self.runCmd("-var-evaluate-expression var6")
self.expect("\^done,value=\"0x[0-9a-f]+ \\\\\\\".*%s\\\\\\\"\"" % self.myexe)
self.expect("\^done,value=\"0x[0-9a-f]+ \\\\\\\".*?%s\\\\\\\"\"" % self.myexe)
self.runCmd("-var-show-attributes var6")
self.expect("\^done,status=\"editable\"")
self.runCmd("-var-list-children --all-values var6")