forked from OSchip/llvm-project
Add an option '-s session-dir-name' to overwrite the default timestamp-named
directory used to dump the session info for test failures/errors. Example: /Volumes/data/lldb/svn/trunk/test $ ./dotest.py -s jason -v array_types Session info for test errors or failures will go into directory jason ---------------------------------------------------------------------- Collected 4 tests test_with_dsym_and_python_api (TestArrayTypes.ArrayTypesTestCase) Use Python APIs to inspect variables with array types. ... ok test_with_dsym_and_run_command (TestArrayTypes.ArrayTypesTestCase) Test 'frame variable var_name' on some variables with array types. ... ok test_with_dwarf_and_python_api (TestArrayTypes.ArrayTypesTestCase) Use Python APIs to inspect variables with array types. ... ok test_with_dwarf_and_run_command (TestArrayTypes.ArrayTypesTestCase) Test 'frame variable var_name' on some variables with array types. ... FAIL ====================================================================== FAIL: test_with_dwarf_and_run_command (TestArrayTypes.ArrayTypesTestCase) Test 'frame variable var_name' on some variables with array types. ---------------------------------------------------------------------- Traceback (most recent call last): File "/Volumes/data/lldb/svn/trunk/test/array_types/TestArrayTypes.py", line 27, in test_with_dwarf_and_run_command self.array_types() File "/Volumes/data/lldb/svn/trunk/test/array_types/TestArrayTypes.py", line 62, in array_types 'stop reason = breakpoint']) File "/Volumes/data/lldb/svn/trunk/test/lldbtest.py", line 594, in expect self.runCmd(str, trace = (True if trace else False), check = not error) File "/Volumes/data/lldb/svn/trunk/test/lldbtest.py", line 564, in runCmd msg if msg else CMD_MSG(cmd, True)) AssertionError: False is not True : Command 'thread list' returns successfully ---------------------------------------------------------------------- Ran 4 tests in 3.086s FAILED (failures=1) /Volumes/data/lldb/svn/trunk/test $ ls jason TestArrayTypes.ArrayTypesTestCase.test_with_dwarf_and_run_command.log /Volumes/data/lldb/svn/trunk/test $ head -10 jason/TestArrayTypes.ArrayTypesTestCase.test_with_dwarf_and_run_command.log Session info generated @ Thu Oct 21 09:54:15 2010 os command: [['/bin/sh', '-c', 'make clean; make MAKE_DSYM=NO']] stdout: rm -rf "a.out" "a.out.dSYM" main.o main.d cc -arch x86_64 -gdwarf-2 -O0 -c -o main.o main.c cc -arch x86_64 -gdwarf-2 -O0 main.o -o "a.out" stderr: None retcode: 0 /Volumes/data/lldb/svn/trunk/test $ llvm-svn: 117028
This commit is contained in:
parent
270b2ef0e7
commit
096011eebf
|
@ -106,7 +106,7 @@ class ClassTypesTestCase(TestBase):
|
|||
self.assertTrue(fsDir == os.getcwd() and fsFile == "a.out",
|
||||
"FileSpec matches the executable")
|
||||
|
||||
bpfilespec = lldb.SBFileSpec("main.cpp")
|
||||
bpfilespec = lldb.SBFileSpec("main.cpp", False)
|
||||
|
||||
breakpoint = target.BreakpointCreateByLocation(bpfilespec, self.line)
|
||||
self.assertTrue(breakpoint.IsValid(), VALID_BREAKPOINT)
|
||||
|
|
|
@ -75,6 +75,11 @@ regexp = None
|
|||
# not exist yet.
|
||||
rdir = None
|
||||
|
||||
# By default, recorded session info for errored/failed test are dumped into its
|
||||
# own file under a session directory named after the timestamp of the test suite
|
||||
# run. Use '-s session-dir-name' to specify a specific dir name.
|
||||
sdir_name = None
|
||||
|
||||
# Default verbosity is 0.
|
||||
verbose = 0
|
||||
|
||||
|
@ -107,6 +112,9 @@ where options:
|
|||
-r : specify a dir to relocate the tests and their intermediate files to;
|
||||
the directory must not exist before running this test driver;
|
||||
no cleanup of intermediate test files is performed in this case
|
||||
-s : specify the name of the dir created to store the session files of tests
|
||||
with errored or failed status; if not specified, the test driver uses the
|
||||
timestamp as the session dir name
|
||||
-t : trace lldb command execution and result
|
||||
-v : do verbose mode of unittest framework
|
||||
-w : insert some wait time (currently 0.5 sec) between consecutive test cases
|
||||
|
@ -162,6 +170,7 @@ def parseOptionsAndInitTestdirs():
|
|||
global skipLongRunningTest
|
||||
global regexp
|
||||
global rdir
|
||||
global sdir_name
|
||||
global verbose
|
||||
global testdirs
|
||||
|
||||
|
@ -223,6 +232,13 @@ def parseOptionsAndInitTestdirs():
|
|||
print "Relocated directory:", rdir, "must not exist!"
|
||||
usage()
|
||||
index += 1
|
||||
elif sys.argv[index].startswith('-s'):
|
||||
# Increment by 1 to fetch the session dir name.
|
||||
index += 1
|
||||
if index >= len(sys.argv) or sys.argv[index].startswith('-'):
|
||||
usage()
|
||||
sdir_name = sys.argv[index]
|
||||
index += 1
|
||||
elif sys.argv[index].startswith('-t'):
|
||||
os.environ["LLDB_COMMAND_TRACE"] = "YES"
|
||||
index += 1
|
||||
|
@ -518,17 +534,18 @@ lldbLoggings()
|
|||
# Install the control-c handler.
|
||||
unittest2.signals.installHandler()
|
||||
|
||||
# Now get a timestamp string and export it as LLDB_TIMESTAMP environment var.
|
||||
# This will be useful when/if we want to dump the session info of individual
|
||||
# test cases later on.
|
||||
# If sdir_name is not specified through the '-s sdir_name' option, get a
|
||||
# timestamp string and export it as LLDB_SESSION_DIR environment var. This will
|
||||
# be used when/if we want to dump the session info of individual test cases
|
||||
# later on.
|
||||
#
|
||||
# See also TestBase.dumpSessionInfo() in lldbtest.py.
|
||||
import datetime
|
||||
raw_timestamp = str(datetime.datetime.today())
|
||||
usec_position = raw_timestamp.rfind('.')
|
||||
if usec_position != -1:
|
||||
raw_timestamp = raw_timestamp[:usec_position]
|
||||
os.environ["LLDB_TIMESTAMP"] = raw_timestamp.replace(' ', '-')
|
||||
if not sdir_name:
|
||||
import datetime
|
||||
timestamp = datetime.datetime.now().strftime("%Y-%m-%d_%H:%M:%S")
|
||||
sdir_name = timestamp
|
||||
os.environ["LLDB_SESSION_DIRNAME"] = sdir_name
|
||||
sys.stderr.write("\nSession info for test errors or failures will go into directory %s\n" % sdir_name)
|
||||
|
||||
#
|
||||
# Invoke the default TextTestRunner to run the test suite, possibly iterating
|
||||
|
|
|
@ -459,11 +459,13 @@ class TestBase(unittest2.TestCase):
|
|||
print >> self.session, err
|
||||
|
||||
dname = os.path.join(os.environ["LLDB_TEST"],
|
||||
os.environ["LLDB_TIMESTAMP"])
|
||||
os.environ["LLDB_SESSION_DIRNAME"])
|
||||
if not os.path.isdir(dname):
|
||||
os.mkdir(dname)
|
||||
fname = os.path.join(dname, "%s.log" % self.id())
|
||||
with open(fname, "w") as f:
|
||||
import datetime
|
||||
print >> f, "Session info generated @", datetime.datetime.now().ctime()
|
||||
print >> f, self.session.getvalue()
|
||||
|
||||
def setTearDownCleanup(self, dictionary=None):
|
||||
|
|
Loading…
Reference in New Issue