[Lldb-commits] [lldb] r269793 - Allow custom formatting of session log file names.

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Tue May 17 11:02:34 PDT 2016


Author: zturner
Date: Tue May 17 13:02:34 2016
New Revision: 269793

URL: http://llvm.org/viewvc/llvm-project?rev=269793&view=rev
Log:
Allow custom formatting of session log file names.

Differential Revision: http://reviews.llvm.org/D20306

Modified:
    lldb/trunk/packages/Python/lldbsuite/test/configuration.py
    lldb/trunk/packages/Python/lldbsuite/test/dosep.py
    lldb/trunk/packages/Python/lldbsuite/test/dotest.py
    lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py
    lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
    lldb/trunk/test/CMakeLists.txt

Modified: lldb/trunk/packages/Python/lldbsuite/test/configuration.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/configuration.py?rev=269793&r1=269792&r2=269793&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/configuration.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/configuration.py Tue May 17 13:02:34 2016
@@ -100,6 +100,15 @@ regexp = None
 # run.  Use '-s session-dir-name' to specify a specific dir name.
 sdir_name = None
 
+# Valid options:
+# f - test file name (without extension)
+# n - test class name
+# m - test method name
+# a - architecture
+# c - compiler path
+# The default is to write all fields.
+session_file_format = 'fnmac'
+
 # Set this flag if there is any session info dumped during the test run.
 sdir_has_content = False
 

Modified: lldb/trunk/packages/Python/lldbsuite/test/dosep.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dosep.py?rev=269793&r1=269792&r2=269793&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/dosep.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/dosep.py Tue May 17 13:02:34 2016
@@ -426,6 +426,7 @@ def process_dir(root, files, dotest_argv
         script_file = main.__file__
         command = ([sys.executable, script_file] +
                    dotest_argv +
+                   ["-S", dotest_options.session_file_format] +
                    ["--inferior", "-p", base_name, root])
 
         timeout_name = os.path.basename(os.path.splitext(base_name)[0]).upper()

Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest.py?rev=269793&r1=269792&r2=269793&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/dotest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py Tue May 17 13:02:34 2016
@@ -321,6 +321,7 @@ def parseOptionsAndInitTestdirs():
         if args.s.startswith('-'):
             usage(parser)
         configuration.sdir_name = args.s
+    configuration.session_file_format = args.session_file_format
 
     if args.t:
         os.environ['LLDB_COMMAND_TRACE'] = 'YES'

Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py?rev=269793&r1=269792&r2=269793&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py Tue May 17 13:02:34 2016
@@ -11,6 +11,7 @@ import textwrap
 # Third-party modules
 
 # LLDB modules
+from . import configuration
 
 class ArgParseNamespace(object):
     pass
@@ -70,6 +71,7 @@ def create_parser():
     group.add_argument('--framework', metavar='framework-path', help='The path to LLDB.framework')
     group.add_argument('--executable', metavar='executable-path', help='The path to the lldb executable')
     group.add_argument('-s', metavar='name', help='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')
+    group.add_argument('-S', '--session-file-format', default=configuration.session_file_format, metavar='format', help='Specify session file name format.  See configuration.py for a description.')
     group.add_argument('-y', type=int, metavar='count', help="Specify the iteration count used to collect our benchmarks. An example is the number of times to do 'thread step-over' to measure stepping speed.")
     group.add_argument('-#', type=int, metavar='sharp', dest='sharp', help='Repeat the test suite for a specified number of times')
     group.add_argument('--channel', metavar='channel', dest='channels', action='append', help=textwrap.dedent("Specify the log channels (and optional categories) e.g. 'lldb all' or 'gdb-remote packets' if no categories are specified, 'default' is used"))

Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py?rev=269793&r1=269792&r2=269793&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Tue May 17 13:02:34 2016
@@ -962,19 +962,27 @@ class Base(unittest2.TestCase):
         if not os.path.isdir(dname):
             os.mkdir(dname)
 
-        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)
-
-        fname = "{}-{}-{}".format(self.id(), self.getArchitecture(), "_".join(compiler.split(os.path.sep)))
-        if len(fname) > 200:
-            fname = "{}-{}-{}".format(self.id(), self.getArchitecture(), compiler.split(os.path.sep)[-1])
-
+        components = []
         if prefix is not None:
-            fname = "{}-{}".format(prefix, fname)
+            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)
+                components.extend([x for x in compiler.split(os.path.sep) if x != ""])
+            elif c == 'a':
+                components.append(self.getArchitecture())
+            elif c == 'm':
+                components.append(self.testMethodName)
+        fname = "-".join(components)
 
         return os.path.join(dname, fname)
 

Modified: lldb/trunk/test/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/CMakeLists.txt?rev=269793&r1=269792&r2=269793&view=diff
==============================================================================
--- lldb/trunk/test/CMakeLists.txt (original)
+++ lldb/trunk/test/CMakeLists.txt Tue May 17 13:02:34 2016
@@ -38,6 +38,7 @@ set(LLDB_TEST_COMMON_ARGS
   ${CMAKE_BINARY_DIR}/bin/lldb${CMAKE_EXECUTABLE_SUFFIX}
   -s
   ${CMAKE_BINARY_DIR}/lldb-test-traces
+  -S nm
   -u CXXFLAGS
   -u CFLAGS
   )




More information about the lldb-commits mailing list