[Lldb-commits] [lldb] r113868 - in /lldb/trunk/test: class_types/TestClassTypes.py dotest.py lldbtest.py

Johnny Chen johnny.chen at apple.com
Tue Sep 14 15:01:40 PDT 2010


Author: johnny
Date: Tue Sep 14 17:01:40 2010
New Revision: 113868

URL: http://llvm.org/viewvc/llvm-project?rev=113868&view=rev
Log:
Removed the expectedFailure decorator from test_with_dwarf_and_run_command() test case
as it now passes.  Added some extra tests to breakpoint_creation_by_filespec_python().

More clarification for the "os command" output and error as defined in
lldbtest.system() function.

Cleaned up the option processing of the test driver (dotest.py) and fixed the comment
about enabling gdb-remote logging.  Example:

$ GDB_REMOTE_LOG=/tmp/log.txt ./dotest.py -v -t enum_types

Modified:
    lldb/trunk/test/class_types/TestClassTypes.py
    lldb/trunk/test/dotest.py
    lldb/trunk/test/lldbtest.py

Modified: lldb/trunk/test/class_types/TestClassTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/class_types/TestClassTypes.py?rev=113868&r1=113867&r2=113868&view=diff
==============================================================================
--- lldb/trunk/test/class_types/TestClassTypes.py (original)
+++ lldb/trunk/test/class_types/TestClassTypes.py Tue Sep 14 17:01:40 2010
@@ -24,7 +24,6 @@
     # rdar://problem/8378863
     # "frame variable this" returns
     # error: unable to find any variables named 'this'
-    @unittest2.expectedFailure
     def test_with_dwarf_and_run_command(self):
         """Test 'frame variable this' when stopped on a class constructor."""
         self.buildDwarf()
@@ -69,15 +68,26 @@
         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")
 
+        bpfilespec = lldb.SBFileSpec("main.cpp")
+
+        breakpoint = target.BreakpointCreateByLocation(bpfilespec, 73)
+        self.assertTrue(breakpoint.IsValid(), VALID_BREAKPOINT)
+
+        # Verify the breakpoint just created.
+        self.expect("breakpoint list", BREAKPOINT_CREATED,
+            substrs = ['main.cpp:73'])
+
+        self.runCmd("run", RUN_SUCCEEDED)
+
+        # We should be stopped on the breakpoint with a hit count of 1.
+        self.assertTrue(breakpoint.GetHitCount() == 1)
+
 
 if __name__ == '__main__':
     import atexit

Modified: lldb/trunk/test/dotest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dotest.py?rev=113868&r1=113867&r2=113868&view=diff
==============================================================================
--- lldb/trunk/test/dotest.py (original)
+++ lldb/trunk/test/dotest.py Tue Sep 14 17:01:40 2010
@@ -70,6 +70,15 @@
 
 Running of this script also sets up the LLDB_TEST environment variable so that
 individual test cases can locate their supporting files correctly.
+
+Environment variables related to loggings:
+
+o LLDB_LOG: if defined, specifies the log file pathname for the 'lldb' subsystem
+  with a default option of 'event process' if LLDB_LOG_OPTION is not defined.
+
+o GDB_REMOTE_LOG: if defined, specifies the log file pathname for the
+  'process.gdb-remote' subsystem with a default option of 'packets' if
+  GDB_REMOTE_LOG_OPTION is not defined.
 """
 
 
@@ -126,14 +135,18 @@
     else:
         # Process possible trace and/or verbose flag.
         index = 1
-        for i in range(1, len(sys.argv) - 1):
+        for i in range(1, len(sys.argv)):
+            if not sys.argv[index].startswith('-'):
+                # End of option processing.
+                break
+
             if sys.argv[index].startswith('-d'):
                 delay = True
                 index += 1
-            if sys.argv[index].startswith('-t'):
+            elif sys.argv[index].startswith('-t'):
                 os.environ["LLDB_COMMAND_TRACE"] = "YES"
                 index += 1
-            if sys.argv[index].startswith('-v'):
+            elif sys.argv[index].startswith('-v'):
                 verbose = 2
                 index += 1
 
@@ -219,7 +232,7 @@
         res)
     if not res.Succeeded():
         raise Exception('log enable failed (check LLDB_LOG env variable.')
-# Ditto for gdb-remote logging if ${LLDB_LOG} environment variable is defined.
+# Ditto for gdb-remote logging if ${GDB_REMOTE_LOG} environment variable is defined.
 # Use ${GDB_REMOTE_LOG} to specify the log file.
 if ("GDB_REMOTE_LOG" in os.environ):
     if ("GDB_REMOTE_LOG_OPTION" in os.environ):

Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=113868&r1=113867&r2=113868&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Tue Sep 14 17:01:40 2010
@@ -228,7 +228,7 @@
     if 'stdout' in kwargs:
         raise ValueError('stdout argument not allowed, it will be overridden.')
     process = Popen(stdout=PIPE, *popenargs, **kwargs)
-    output, unused_err = process.communicate()
+    output, error = process.communicate()
     retcode = process.poll()
 
     if traceAlways:
@@ -239,8 +239,9 @@
         print >> sys.stderr
         print >> sys.stderr, "os command:", args
         print >> sys.stderr, "output:", output
-        print >> sys.stderr, "error:", unused_err
-        print >> sys.stderr, "retcode:", retcode
+        print >> sys.stderr, "error (from os comand):", error
+        print >> sys.stderr, "retcode (from os command):", retcode
+        print >> sys.stderr
 
     if retcode:
         cmd = kwargs.get("args")





More information about the lldb-commits mailing list