[Lldb-commits] [lldb] r232024 - Limit the lenght of the file name of the log file for tests

Tamas Berghammer tberghammer at google.com
Thu Mar 12 03:24:12 PDT 2015

Author: tberghammer
Date: Thu Mar 12 05:24:11 2015
New Revision: 232024

URL: http://llvm.org/viewvc/llvm-project?rev=232024&view=rev
Limit the lenght of the file name of the log file for tests

If a test have very long name and the compiler specified with (a long)
full path then the name of the log file name can exceed 255 characters.
This change replace the full compiler path with just the compiler name
if the prior would cause a too long file name.

Differential revision: http://reviews.llvm.org/D8252


Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=232024&r1=232023&r2=232024&view=diff
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Thu Mar 12 05:24:11 2015
@@ -1333,8 +1333,11 @@ class Base(unittest2.TestCase):
         if compiler[1] == ':':
             compiler = compiler[2:]
-        fname = os.path.join(dname, "%s-%s-%s-%s.log" % (prefix, self.getArchitecture(), "_".join(compiler.split(os.path.sep)), self.id()))
-        with open(fname, "w") as f:
+        fname = "%s-%s-%s-%s.log" % (prefix, self.getArchitecture(), "_".join(compiler.split(os.path.sep)), self.id())
+        if len(fname) > 255:
+            fname = "%s-%s-%s-%s.log" % (prefix, self.getArchitecture(), compiler.split(os.path.sep)[-1], self.id())
+        pname = os.path.join(dname, fname)
+        with open(pname, "w") as f:
             import datetime
             print >> f, "Session info generated @", datetime.datetime.now().ctime()
             print >> f, self.session.getvalue()

More information about the lldb-commits mailing list