[Lldb-commits] [lldb] r112327 - in /lldb/trunk/test: array_types/TestArrayTypes.py bitfields/TestBitfields.py class_types/TestClassTypes.py dead-strip/TestDeadStrip.py enum_types/TestEnumTypes.py function_types/TestFunctionTypes.py global_variables/TestGlobalVariables.py lldbtest.py load_unload/TestLoadUnload.py macosx/universal/TestUniversal.py persistent_variables/TestPersistentVariables.py set_values/TestSetValues.py stl/TestSTL.py struct_types/TestStructTypes.py unsigned_types/TestUnsignedTypes.py

Johnny Chen johnny.chen at apple.com
Fri Aug 27 16:47:36 PDT 2010


Author: johnny
Date: Fri Aug 27 18:47:36 2010
New Revision: 112327

URL: http://llvm.org/viewvc/llvm-project?rev=112327&view=rev
Log:
Added a test case test_breakpoint_creation_by_filespec_python() which creates a
breakpoint by FileSpec and line number and exercises some FileSpec APIs.

Also, RUN_STOPPED is a bad assert name, RUN_SUCCEEDED is better.

Modified:
    lldb/trunk/test/array_types/TestArrayTypes.py
    lldb/trunk/test/bitfields/TestBitfields.py
    lldb/trunk/test/class_types/TestClassTypes.py
    lldb/trunk/test/dead-strip/TestDeadStrip.py
    lldb/trunk/test/enum_types/TestEnumTypes.py
    lldb/trunk/test/function_types/TestFunctionTypes.py
    lldb/trunk/test/global_variables/TestGlobalVariables.py
    lldb/trunk/test/lldbtest.py
    lldb/trunk/test/load_unload/TestLoadUnload.py
    lldb/trunk/test/macosx/universal/TestUniversal.py
    lldb/trunk/test/persistent_variables/TestPersistentVariables.py
    lldb/trunk/test/set_values/TestSetValues.py
    lldb/trunk/test/stl/TestSTL.py
    lldb/trunk/test/struct_types/TestStructTypes.py
    lldb/trunk/test/unsigned_types/TestUnsignedTypes.py

Modified: lldb/trunk/test/array_types/TestArrayTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/array_types/TestArrayTypes.py?rev=112327&r1=112326&r2=112327&view=diff
==============================================================================
--- lldb/trunk/test/array_types/TestArrayTypes.py (original)
+++ lldb/trunk/test/array_types/TestArrayTypes.py Fri Aug 27 18:47:36 2010
@@ -18,7 +18,7 @@
         self.expect("breakpoint set -f main.c -l 42", BREAKPOINT_CREATED,
             startstr = "Breakpoint created: 1: file ='main.c', line = 42, locations = 1")
 
-        self.runCmd("run", RUN_STOPPED)
+        self.runCmd("run", RUN_SUCCEEDED)
 
         # The stop reason of the thread should be breakpoint.
         self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
@@ -62,7 +62,7 @@
         breakpoint = target.BreakpointCreateByLocation("main.c", 42)
         self.assertTrue(breakpoint.IsValid(), VALID_BREAKPOINT)
 
-        self.runCmd("run", RUN_STOPPED)
+        self.runCmd("run", RUN_SUCCEEDED)
         # This does not work, and results in the process stopped at dyld_start?
         #process = target.LaunchProcess([''], [''], os.ctermid(), False)
 

Modified: lldb/trunk/test/bitfields/TestBitfields.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/bitfields/TestBitfields.py?rev=112327&r1=112326&r2=112327&view=diff
==============================================================================
--- lldb/trunk/test/bitfields/TestBitfields.py (original)
+++ lldb/trunk/test/bitfields/TestBitfields.py Fri Aug 27 18:47:36 2010
@@ -19,7 +19,7 @@
         self.expect("breakpoint set -f main.c -l 42", BREAKPOINT_CREATED,
             startstr = "Breakpoint created: 1: file ='main.c', line = 42, locations = 1")
 
-        self.runCmd("run", RUN_STOPPED)
+        self.runCmd("run", RUN_SUCCEEDED)
 
         # The stop reason of the thread should be breakpoint.
         self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
@@ -63,7 +63,7 @@
         breakpoint = target.BreakpointCreateByLocation("main.c", 42)
         self.assertTrue(breakpoint.IsValid(), VALID_BREAKPOINT)
 
-        self.runCmd("run", RUN_STOPPED)
+        self.runCmd("run", RUN_SUCCEEDED)
         # This does not work, and results in the process stopped at dyld_start?
         #process = target.LaunchProcess([''], [''], os.ctermid(), False)
 

Modified: lldb/trunk/test/class_types/TestClassTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/class_types/TestClassTypes.py?rev=112327&r1=112326&r2=112327&view=diff
==============================================================================
--- lldb/trunk/test/class_types/TestClassTypes.py (original)
+++ lldb/trunk/test/class_types/TestClassTypes.py Fri Aug 27 18:47:36 2010
@@ -18,7 +18,7 @@
         self.expect("breakpoint set -f main.cpp -l 73", BREAKPOINT_CREATED,
             startstr = "Breakpoint created: 1: file ='main.cpp', line = 73, locations = 1")
 
-        self.runCmd("run", RUN_STOPPED)
+        self.runCmd("run", RUN_SUCCEEDED)
 
         # The stop reason of the thread should be breakpoint.
         self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
@@ -33,6 +33,25 @@
         self.expect("variable list this", VARIABLES_DISPLAYED_CORRECTLY,
             startstr = '(class C *const) this = ')
 
+    def test_breakpoint_creation_by_filespec_python(self):
+        """Use Python APIs to create a breakpoint by (filespec, line)."""
+        exe = os.path.join(os.getcwd(), "a.out")
+
+        target = self.dbg.CreateTarget(exe)
+        self.assertTrue(target.IsValid(), VALID_TARGET)
+
+        filespec = target.GetExecutable()
+        self.assertTrue(filespec.IsValid(), VALID_FILESPEC)
+
+        breakpoint = target.BreakpointCreateByLocation(filespec, 73)
+        self.assertTrue(breakpoint.IsValid(), VALID_BREAKPOINT)
+
+        fsDir = filespec.GetDirectory()
+        fsFile = filespec.GetFilename()
+
+        self.assertTrue(fsDir == os.getcwd() and fsFile == "a.out",
+                        "FileSpec matches the executable")
+
 
 if __name__ == '__main__':
     import atexit

Modified: lldb/trunk/test/dead-strip/TestDeadStrip.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dead-strip/TestDeadStrip.py?rev=112327&r1=112326&r2=112327&view=diff
==============================================================================
--- lldb/trunk/test/dead-strip/TestDeadStrip.py (original)
+++ lldb/trunk/test/dead-strip/TestDeadStrip.py Fri Aug 27 18:47:36 2010
@@ -28,7 +28,7 @@
         self.expect("breakpoint set -s a.out -n f3", BREAKPOINT_CREATED,
             startstr = "Breakpoint created: 3: name = 'f3', module = a.out, locations = 1")
 
-        self.runCmd("run", RUN_STOPPED)
+        self.runCmd("run", RUN_SUCCEEDED)
 
         # The stop reason of the thread should be breakpoint (breakpoint #1).
         self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,

Modified: lldb/trunk/test/enum_types/TestEnumTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/enum_types/TestEnumTypes.py?rev=112327&r1=112326&r2=112327&view=diff
==============================================================================
--- lldb/trunk/test/enum_types/TestEnumTypes.py (original)
+++ lldb/trunk/test/enum_types/TestEnumTypes.py Fri Aug 27 18:47:36 2010
@@ -18,7 +18,7 @@
         self.expect("breakpoint set -f main.c -l 26", BREAKPOINT_CREATED,
             startstr = "Breakpoint created: 1: file ='main.c', line = 26, locations = 1")
 
-        self.runCmd("run", RUN_STOPPED)
+        self.runCmd("run", RUN_SUCCEEDED)
 
         # The stop reason of the thread should be breakpoint.
         self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,

Modified: lldb/trunk/test/function_types/TestFunctionTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/function_types/TestFunctionTypes.py?rev=112327&r1=112326&r2=112327&view=diff
==============================================================================
--- lldb/trunk/test/function_types/TestFunctionTypes.py (original)
+++ lldb/trunk/test/function_types/TestFunctionTypes.py Fri Aug 27 18:47:36 2010
@@ -18,7 +18,7 @@
         self.expect("breakpoint set -f main.c -l 21", BREAKPOINT_CREATED,
             startstr = "Breakpoint created: 1: file ='main.c', line = 21, locations = 1")
 
-        self.runCmd("run", RUN_STOPPED)
+        self.runCmd("run", RUN_SUCCEEDED)
 
         # The stop reason of the thread should be breakpoint.
         self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,

Modified: lldb/trunk/test/global_variables/TestGlobalVariables.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/global_variables/TestGlobalVariables.py?rev=112327&r1=112326&r2=112327&view=diff
==============================================================================
--- lldb/trunk/test/global_variables/TestGlobalVariables.py (original)
+++ lldb/trunk/test/global_variables/TestGlobalVariables.py Fri Aug 27 18:47:36 2010
@@ -18,7 +18,7 @@
         self.expect("breakpoint set -f main.c -l 20", BREAKPOINT_CREATED,
             startstr = "Breakpoint created: 1: file ='main.c', line = 20, locations = 1")
 
-        self.runCmd("run", RUN_STOPPED)
+        self.runCmd("run", RUN_SUCCEEDED)
 
         # The stop reason of the thread should be breakpoint.
         self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,

Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=112327&r1=112326&r2=112327&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Fri Aug 27 18:47:36 2010
@@ -117,7 +117,7 @@
 
 CURRENT_EXECUTABLE_SET = "Current executable set successfully"
 
-RUN_STOPPED = "Process is launched and then stopped successfully"
+RUN_SUCCEEDED = "Process is launched successfully"
 
 RUN_COMPLETED = "Process exited successfully"
 
@@ -135,6 +135,8 @@
 
 VALID_BREAKPOINT = "Got a valid breakpoint"
 
+VALID_FILESPEC = "Got a valid filespec"
+
 VALID_PROCESS = "Got a valid process"
 
 VALID_TARGET = "Got a valid target"

Modified: lldb/trunk/test/load_unload/TestLoadUnload.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/load_unload/TestLoadUnload.py?rev=112327&r1=112326&r2=112327&view=diff
==============================================================================
--- lldb/trunk/test/load_unload/TestLoadUnload.py (original)
+++ lldb/trunk/test/load_unload/TestLoadUnload.py Fri Aug 27 18:47:36 2010
@@ -20,7 +20,7 @@
         self.expect("breakpoint set -n a_function", BREAKPOINT_CREATED,
             startstr = "Breakpoint created: 1: name = 'a_function', locations = 0 (pending)")
 
-        self.runCmd("run", RUN_STOPPED)
+        self.runCmd("run", RUN_SUCCEEDED)
 
         # The stop reason of the thread should be breakpoint and at a_function.
         self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,

Modified: lldb/trunk/test/macosx/universal/TestUniversal.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/universal/TestUniversal.py?rev=112327&r1=112326&r2=112327&view=diff
==============================================================================
--- lldb/trunk/test/macosx/universal/TestUniversal.py (original)
+++ lldb/trunk/test/macosx/universal/TestUniversal.py Fri Aug 27 18:47:36 2010
@@ -25,7 +25,7 @@
             startstr = "Breakpoint created: 1: file ='main.c', line = 5, locations = 1")
 
         # We should be able to launch the x86_64 executable.
-        self.runCmd("run", RUN_STOPPED)
+        self.runCmd("run", RUN_SUCCEEDED)
 
         # Check whether we have a 64-bit process launched.
         target = self.dbg.GetSelectedTarget()
@@ -46,7 +46,7 @@
             startstr = "Breakpoint created: 1: file ='main.c', line = 5, locations = 1")
 
         # We should be able to launch the i386 executable as well.
-        self.runCmd("run", RUN_STOPPED)
+        self.runCmd("run", RUN_SUCCEEDED)
 
         # Check whether we have a 32-bit process launched.
         target = self.dbg.GetSelectedTarget()

Modified: lldb/trunk/test/persistent_variables/TestPersistentVariables.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/persistent_variables/TestPersistentVariables.py?rev=112327&r1=112326&r2=112327&view=diff
==============================================================================
--- lldb/trunk/test/persistent_variables/TestPersistentVariables.py (original)
+++ lldb/trunk/test/persistent_variables/TestPersistentVariables.py Fri Aug 27 18:47:36 2010
@@ -17,7 +17,7 @@
 
         self.runCmd("breakpoint set --name main")
 
-        self.runCmd("run", RUN_STOPPED)
+        self.runCmd("run", RUN_SUCCEEDED)
 
         self.runCmd("expr int $i = 5; $i + 1")
         # $0 = (int)6

Modified: lldb/trunk/test/set_values/TestSetValues.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/set_values/TestSetValues.py?rev=112327&r1=112326&r2=112327&view=diff
==============================================================================
--- lldb/trunk/test/set_values/TestSetValues.py (original)
+++ lldb/trunk/test/set_values/TestSetValues.py Fri Aug 27 18:47:36 2010
@@ -30,7 +30,7 @@
         self.expect("breakpoint set -f main.c -l 85", BREAKPOINT_CREATED,
             startstr = "Breakpoint created: 5: file ='main.c', line = 85, locations = 1")
 
-        self.runCmd("run", RUN_STOPPED)
+        self.runCmd("run", RUN_SUCCEEDED)
 
         # The stop reason of the thread should be breakpoint.
         self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,

Modified: lldb/trunk/test/stl/TestSTL.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/stl/TestSTL.py?rev=112327&r1=112326&r2=112327&view=diff
==============================================================================
--- lldb/trunk/test/stl/TestSTL.py (original)
+++ lldb/trunk/test/stl/TestSTL.py Fri Aug 27 18:47:36 2010
@@ -26,7 +26,7 @@
         self.expect("breakpoint set -f main.cpp -l 13", BREAKPOINT_CREATED,
             startstr = "Breakpoint created: 1: file ='main.cpp', line = 13, locations = 1")
 
-        self.runCmd("run", RUN_STOPPED)
+        self.runCmd("run", RUN_SUCCEEDED)
 
         # Stop at 'std::string hello_world ("Hello World!");'.
         self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,

Modified: lldb/trunk/test/struct_types/TestStructTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/struct_types/TestStructTypes.py?rev=112327&r1=112326&r2=112327&view=diff
==============================================================================
--- lldb/trunk/test/struct_types/TestStructTypes.py (original)
+++ lldb/trunk/test/struct_types/TestStructTypes.py Fri Aug 27 18:47:36 2010
@@ -22,7 +22,7 @@
         self.expect("breakpoint set -f main.c -l 14", BREAKPOINT_CREATED,
             startstr = "Breakpoint created: 1: file ='main.c', line = 14, locations = 1")
 
-        self.runCmd("run", RUN_STOPPED)
+        self.runCmd("run", RUN_SUCCEEDED)
 
         # We should be stopped on the first executable statement within the
         # function where the original breakpoint was attempted.

Modified: lldb/trunk/test/unsigned_types/TestUnsignedTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/unsigned_types/TestUnsignedTypes.py?rev=112327&r1=112326&r2=112327&view=diff
==============================================================================
--- lldb/trunk/test/unsigned_types/TestUnsignedTypes.py (original)
+++ lldb/trunk/test/unsigned_types/TestUnsignedTypes.py Fri Aug 27 18:47:36 2010
@@ -21,7 +21,7 @@
         self.expect("breakpoint set -f main.cpp -l 19", BREAKPOINT_CREATED,
             startstr = "Breakpoint created: 1: file ='main.cpp', line = 19, locations = 1")
 
-        self.runCmd("run", RUN_STOPPED)
+        self.runCmd("run", RUN_SUCCEEDED)
 
         # The stop reason of the thread should be breakpoint.
         self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,





More information about the lldb-commits mailing list