[Lldb-commits] [lldb] r240325 - Enhance lldb-mi arguments test (MI)
Dawn Perchik
dawn at burble.org
Mon Jun 22 13:41:58 PDT 2015
Author: dperchik
Date: Mon Jun 22 15:41:57 2015
New Revision: 240325
URL: http://llvm.org/viewvc/llvm-project?rev=240325&view=rev
Log:
Enhance lldb-mi arguments test (MI)
SUMMARY:
Add additional arguments to lldb-mi args tests to make sure arguments with quotes are handled correctly.
Reviewers: ki.stfu
Subscribers: lldb-commits
Test Plan:
./dotest.py --executable lldb -f MiInterpreterExecTestCase.test_lldbmi_settings_set_target_run_args_before
./dotest.py --executable lldb -f MiInterpreterExecTestCase.test_lldbmi_settings_set_target_run_args_after
Differential Revision: http://reviews.llvm.org/D10523
Modified:
lldb/trunk/test/tools/lldb-mi/interpreter/TestMiInterpreterExec.py
lldb/trunk/test/tools/lldb-mi/interpreter/main.cpp
Modified: lldb/trunk/test/tools/lldb-mi/interpreter/TestMiInterpreterExec.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/interpreter/TestMiInterpreterExec.py?rev=240325&r1=240324&r2=240325&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/interpreter/TestMiInterpreterExec.py (original)
+++ lldb/trunk/test/tools/lldb-mi/interpreter/TestMiInterpreterExec.py Mon Jun 22 15:41:57 2015
@@ -61,8 +61,8 @@ class MiInterpreterExecTestCase(lldbmi_t
self.spawnLldbMi(args = None)
# Test that "settings set target.run-args" passes arguments to executable
- #FIXME: "--arg1 \"2nd arg\" third_arg fourth=\"4th arg\"" causes an error
- self.runCmd("-interpreter-exec console \"setting set target.run-args arg1\"")
+ #FIXME: --arg1 causes an error
+ self.runCmd("-interpreter-exec console \"setting set target.run-args arg1 \\\"2nd arg\\\" third_arg fourth=\\\"4th arg\\\"\"")
self.expect("\^done")
# Load executable
@@ -74,7 +74,15 @@ class MiInterpreterExecTestCase(lldbmi_t
self.expect("\^running")
# Test that arguments were passed properly
- self.expect("@\"argc=2\\\\r\\\\n\"")
+ self.expect("@\"argc=5\\\\r\\\\n\"")
+ self.expect("@\"argv.0.=.*lldb-mi")
+ self.expect("@\"argv.1.=arg1\\\\r\\\\n\"")
+ self.expect("@\"argv.2.=2nd arg\\\\r\\\\n\"")
+ self.expect("@\"argv.3.=third_arg\\\\r\\\\n\"")
+ self.expect("@\"argv.4.=fourth=4th arg\\\\r\\\\n\"")
+
+ # Test that program exited normally
+ self.expect("\*stopped,reason=\"exited-normally\"")
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
@@ -89,16 +97,35 @@ class MiInterpreterExecTestCase(lldbmi_t
self.expect("\^done")
# Test that "settings set target.run-args" passes arguments to executable
- #FIXME: "--arg1 \"2nd arg\" third_arg fourth=\"4th arg\"" causes an error
- self.runCmd("-interpreter-exec console \"setting set target.run-args arg1\"")
+ #FIXME: --arg1 causes an error
+ self.runCmd("-interpreter-exec console \"setting set target.run-args arg1 \\\"2nd arg\\\" third_arg fourth=\\\"4th arg\\\"\"")
self.expect("\^done")
- # Run
+ # Run to BP_printf
+ line = line_number('main.cpp', '// BP_printf')
+ self.runCmd("-break-insert main.cpp:%d" % line)
+ self.expect("\^done,bkpt={number=\"1\"")
self.runCmd("-exec-run")
- self.expect("\^running")
+ self.expect("\^running");
+ self.expect("\*stopped,reason=\"breakpoint-hit\"")
+
+ # Run to BP_return
+ line = line_number('main.cpp', '// BP_return')
+ self.runCmd("-break-insert main.cpp:%d" % line)
+ self.expect("\^done,bkpt={number=\"2\"")
+ self.runCmd("-exec-continue")
+ self.expect("\^running");
# Test that arguments were passed properly
- self.expect("@\"argc=2\\\\r\\\\n\"")
+ self.expect("@\"argc=5\\\\r\\\\n\"")
+ self.expect("@\"argv.0.=.*lldb-mi")
+ self.expect("@\"argv.1.=arg1\\\\r\\\\n\"")
+ self.expect("@\"argv.2.=2nd arg\\\\r\\\\n\"")
+ self.expect("@\"argv.3.=third_arg\\\\r\\\\n\"")
+ self.expect("@\"argv.4.=fourth=4th arg\\\\r\\\\n\"")
+
+ # Hit BP_return
+ self.expect("\*stopped,reason=\"breakpoint-hit\"")
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
Modified: lldb/trunk/test/tools/lldb-mi/interpreter/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/interpreter/main.cpp?rev=240325&r1=240324&r2=240325&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/interpreter/main.cpp (original)
+++ lldb/trunk/test/tools/lldb-mi/interpreter/main.cpp Mon Jun 22 15:41:57 2015
@@ -12,6 +12,8 @@
int
main(int argc, char const *argv[])
{
- printf("argc=%d\n", argc);
- return 0;
+ printf("argc=%d\n", argc); // BP_printf
+ for (int i = 0; i < argc; ++i)
+ printf("argv[%d]=%s\n", i, argv[i]);
+ return 0; // BP_return
}
More information about the lldb-commits
mailing list