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
This commit is contained in:
Johnny Chen 2010-09-14 22:01:40 +00:00
parent 22f6922505
commit 1aad5c61f8
3 changed files with 35 additions and 11 deletions

View File

@ -24,7 +24,6 @@ class ClassTypesTestCase(TestBase):
# rdar://problem/8378863 # rdar://problem/8378863
# "frame variable this" returns # "frame variable this" returns
# error: unable to find any variables named 'this' # error: unable to find any variables named 'this'
@unittest2.expectedFailure
def test_with_dwarf_and_run_command(self): def test_with_dwarf_and_run_command(self):
"""Test 'frame variable this' when stopped on a class constructor.""" """Test 'frame variable this' when stopped on a class constructor."""
self.buildDwarf() self.buildDwarf()
@ -69,15 +68,26 @@ class ClassTypesTestCase(TestBase):
filespec = target.GetExecutable() filespec = target.GetExecutable()
self.assertTrue(filespec.IsValid(), VALID_FILESPEC) self.assertTrue(filespec.IsValid(), VALID_FILESPEC)
breakpoint = target.BreakpointCreateByLocation(filespec, 73)
self.assertTrue(breakpoint.IsValid(), VALID_BREAKPOINT)
fsDir = filespec.GetDirectory() fsDir = filespec.GetDirectory()
fsFile = filespec.GetFilename() fsFile = filespec.GetFilename()
self.assertTrue(fsDir == os.getcwd() and fsFile == "a.out", self.assertTrue(fsDir == os.getcwd() and fsFile == "a.out",
"FileSpec matches the executable") "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__': if __name__ == '__main__':
import atexit import atexit

View File

@ -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 Running of this script also sets up the LLDB_TEST environment variable so that
individual test cases can locate their supporting files correctly. 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: else:
# Process possible trace and/or verbose flag. # Process possible trace and/or verbose flag.
index = 1 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'): if sys.argv[index].startswith('-d'):
delay = True delay = True
index += 1 index += 1
if sys.argv[index].startswith('-t'): elif sys.argv[index].startswith('-t'):
os.environ["LLDB_COMMAND_TRACE"] = "YES" os.environ["LLDB_COMMAND_TRACE"] = "YES"
index += 1 index += 1
if sys.argv[index].startswith('-v'): elif sys.argv[index].startswith('-v'):
verbose = 2 verbose = 2
index += 1 index += 1
@ -219,7 +232,7 @@ if ("LLDB_LOG" in os.environ):
res) res)
if not res.Succeeded(): if not res.Succeeded():
raise Exception('log enable failed (check LLDB_LOG env variable.') 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. # Use ${GDB_REMOTE_LOG} to specify the log file.
if ("GDB_REMOTE_LOG" in os.environ): if ("GDB_REMOTE_LOG" in os.environ):
if ("GDB_REMOTE_LOG_OPTION" in os.environ): if ("GDB_REMOTE_LOG_OPTION" in os.environ):

View File

@ -228,7 +228,7 @@ def system(*popenargs, **kwargs):
if 'stdout' in kwargs: if 'stdout' in kwargs:
raise ValueError('stdout argument not allowed, it will be overridden.') raise ValueError('stdout argument not allowed, it will be overridden.')
process = Popen(stdout=PIPE, *popenargs, **kwargs) process = Popen(stdout=PIPE, *popenargs, **kwargs)
output, unused_err = process.communicate() output, error = process.communicate()
retcode = process.poll() retcode = process.poll()
if traceAlways: if traceAlways:
@ -239,8 +239,9 @@ def system(*popenargs, **kwargs):
print >> sys.stderr print >> sys.stderr
print >> sys.stderr, "os command:", args print >> sys.stderr, "os command:", args
print >> sys.stderr, "output:", output print >> sys.stderr, "output:", output
print >> sys.stderr, "error:", unused_err print >> sys.stderr, "error (from os comand):", error
print >> sys.stderr, "retcode:", retcode print >> sys.stderr, "retcode (from os command):", retcode
print >> sys.stderr
if retcode: if retcode:
cmd = kwargs.get("args") cmd = kwargs.get("args")