From 1aad5c61f82b8c8032f66bf22a39408a8c3bfd53 Mon Sep 17 00:00:00 2001 From: Johnny Chen Date: Tue, 14 Sep 2010 22:01:40 +0000 Subject: [PATCH] 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 llvm-svn: 113868 --- lldb/test/class_types/TestClassTypes.py | 18 ++++++++++++++---- lldb/test/dotest.py | 21 +++++++++++++++++---- lldb/test/lldbtest.py | 7 ++++--- 3 files changed, 35 insertions(+), 11 deletions(-) diff --git a/lldb/test/class_types/TestClassTypes.py b/lldb/test/class_types/TestClassTypes.py index 494e942d0598..76af8c7dac90 100644 --- a/lldb/test/class_types/TestClassTypes.py +++ b/lldb/test/class_types/TestClassTypes.py @@ -24,7 +24,6 @@ class ClassTypesTestCase(TestBase): # 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 @@ class ClassTypesTestCase(TestBase): 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 diff --git a/lldb/test/dotest.py b/lldb/test/dotest.py index 13ad8ae84db3..9a2e4bd778f1 100755 --- a/lldb/test/dotest.py +++ b/lldb/test/dotest.py @@ -70,6 +70,15 @@ args : specify a list of directory names to search for python Test*.py scripts 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 @@ def initTestdirs(): 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 @@ if ("LLDB_LOG" in os.environ): 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): diff --git a/lldb/test/lldbtest.py b/lldb/test/lldbtest.py index ddbedfc9a6b3..9322f4b6b423 100644 --- a/lldb/test/lldbtest.py +++ b/lldb/test/lldbtest.py @@ -228,7 +228,7 @@ def system(*popenargs, **kwargs): 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 @@ def system(*popenargs, **kwargs): 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")