aboutsummaryrefslogtreecommitdiff
path: root/lldb/packages/Python/lldbsuite/test/lldbtest.py
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/lldbtest.py')
-rw-r--r--lldb/packages/Python/lldbsuite/test/lldbtest.py46
1 files changed, 8 insertions, 38 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index 7ba3a15..53d1aa4 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -868,6 +868,11 @@ class Base(unittest2.TestCase):
# List of log files produced by the current test.
self.log_files = []
+ # Create the build directory.
+ # The logs are stored in the build directory, so we have to create it
+ # before creating the first log file.
+ self.makeBuildDir()
+
session_file = self.getLogBasenameForCurrentTest()+".log"
self.log_files.append(session_file)
@@ -930,8 +935,6 @@ class Base(unittest2.TestCase):
self.lib_lldb = lib
self.darwinWithFramework = self.platformIsDarwin()
- self.makeBuildDir()
-
def setAsync(self, value):
""" Sets async mode to True/False and ensures it is reset after the testcase completes."""
old_async = self.dbg.GetAsync()
@@ -1156,45 +1159,12 @@ class Base(unittest2.TestCase):
def getRerunArgs(self):
return " -f %s.%s" % (self.__class__.__name__, self._testMethodName)
- def getLogBasenameForCurrentTest(self, prefix=None):
+ def getLogBasenameForCurrentTest(self, prefix="Incomplete"):
"""
returns a partial path that can be used as the beginning of the name of multiple
log files pertaining to this test
-
- <session-dir>/<arch>-<compiler>-<test-file>.<test-class>.<test-method>
"""
- dname = os.path.join(configuration.test_src_root,
- os.environ["LLDB_SESSION_DIRNAME"])
- if not os.path.isdir(dname):
- os.mkdir(dname)
-
- components = []
- if prefix is not None:
- components.append(prefix)
- for c in configuration.session_file_format:
- if c == 'f':
- components.append(self.__class__.__module__)
- elif c == 'n':
- components.append(self.__class__.__name__)
- elif c == 'c':
- compiler = self.getCompiler()
-
- if compiler[1] == ':':
- compiler = compiler[2:]
- if os.path.altsep is not None:
- compiler = compiler.replace(os.path.altsep, os.path.sep)
- path_components = [x for x in compiler.split(os.path.sep) if x != ""]
-
- # Add at most 4 path components to avoid generating very long
- # filenames
- components.extend(path_components[-4:])
- elif c == 'a':
- components.append(self.getArchitecture())
- elif c == 'm':
- components.append(self.testMethodName)
- fname = "-".join(components)
-
- return os.path.join(dname, fname)
+ return os.path.join(self.getBuildDir(), prefix)
def dumpSessionInfo(self):
"""
@@ -1254,7 +1224,7 @@ class Base(unittest2.TestCase):
# process the log files
if prefix != 'Success' or lldbtest_config.log_success:
# keep all log files, rename them to include prefix
- src_log_basename = self.getLogBasenameForCurrentTest(None)
+ src_log_basename = self.getLogBasenameForCurrentTest()
dst_log_basename = self.getLogBasenameForCurrentTest(prefix)
for src in self.log_files:
if os.path.isfile(src):