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
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@113868 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/class_types/TestClassTypes.py b/test/class_types/TestClassTypes.py
index 494e942..76af8c7 100644
--- a/test/class_types/TestClassTypes.py
+++ b/test/class_types/TestClassTypes.py
@@ -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
diff --git a/test/dotest.py b/test/dotest.py
index 13ad8ae..9a2e4bd 100755
--- a/test/dotest.py
+++ b/test/dotest.py
@@ -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):
diff --git a/test/lldbtest.py b/test/lldbtest.py
index ddbedfc..9322f4b 100644
--- a/test/lldbtest.py
+++ b/test/lldbtest.py
@@ -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")