[Lldb-commits] [PATCH] Limit the length of the file name of the log file for tests

Tamas Berghammer tberghammer at google.com
Wed Mar 11 07:17:07 PDT 2015


Hi clayborg,

Limit the length 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.

http://reviews.llvm.org/D8252

Files:
  test/lldbtest.py

Index: test/lldbtest.py
===================================================================
--- test/lldbtest.py
+++ test/lldbtest.py
@@ -1318,8 +1318,11 @@
         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()

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8252.21716.patch
Type: text/x-patch
Size: 918 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150311/dd2fb8d8/attachment.bin>


More information about the lldb-commits mailing list