[Lldb-commits] [lldb] r296870 - test: shorten test trace file names

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 3 05:49:38 PST 2017


Author: labath
Date: Fri Mar  3 07:49:38 2017
New Revision: 296870

URL: http://llvm.org/viewvc/llvm-project?rev=296870&view=rev
Log:
test: shorten test trace file names

Make sure we don't generate extremely long file names for test trace log
file, as this can cause path-too-long errors. As the compilers in the
android ndk are deeply nested, it's very easy to trigger these.

I chose to output at most 4 path components -- this should keep the full
path for common cases like /usr/bin/gcc with room to spare, and should
be enough to uniquely identify the compiler for more deeply nested
cases.

Modified:
    lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py

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=296870&r1=296869&r2=296870&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Fri Mar  3 07:49:38 2017
@@ -1119,8 +1119,11 @@ class Base(unittest2.TestCase):
                     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 != ""])
+                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':




More information about the lldb-commits mailing list