[test-suite] r258282 - lit.cfg: Fix most violations reported by pep8 tool, NFC

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 19 19:57:23 PST 2016


Author: matze
Date: Tue Jan 19 21:57:23 2016
New Revision: 258282

URL: http://llvm.org/viewvc/llvm-project?rev=258282&view=rev
Log:
lit.cfg: Fix most violations reported by pep8 tool, NFC

Modified:
    test-suite/trunk/lit.cfg

Modified: test-suite/trunk/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/lit.cfg?rev=258282&r1=258281&r2=258282&view=diff
==============================================================================
--- test-suite/trunk/lit.cfg (original)
+++ test-suite/trunk/lit.cfg Tue Jan 19 21:57:23 2016
@@ -1,17 +1,22 @@
+import glob
+import lit
 import lit.formats
 import lit.util
-import lit
-import os, glob, re
-import shlex
+import os
 import pipes
+import re
+import shlex
 from lit.formats import FileBasedTest
-from lit.TestRunner import executeScript, executeScriptInternal, parseIntegratedTestScriptCommands, getDefaultSubstitutions, applySubstitutions, getTempPaths
+from lit.TestRunner import executeScript, executeScriptInternal, \
+    parseIntegratedTestScriptCommands, getDefaultSubstitutions, \
+    applySubstitutions, getTempPaths
 from lit import Test
 from lit.util import to_bytes, to_string
 try:
-    from shlex import quote # python 3.3 and above
+    from shlex import quote  # python 3.3 and above
 except:
-    from pipes import quote # python 3.2 and earlier
+    from pipes import quote  # python 3.2 and earlier
+
 
 def parseBenchmarkScript(test):
     """Scan a llvm-testsuite like benchmark .test script."""
@@ -50,7 +55,8 @@ def parseBenchmarkScript(test):
             return lit.Test.Result(Test.UNRESOLVED,
                                    "Test has unterminated RUN/VERIFY lines (with '\\')")
 
-    return runscript,verifyscript
+    return runscript, verifyscript
+
 
 def getUserTimeFromTimeOutput(f):
     with open(f) as fd:
@@ -61,6 +67,7 @@ def getUserTimeFromTimeOutput(f):
     m = re.match(r'user\s+([0-9.]+)', l[0])
     return float(m.group(1))
 
+
 def collectCompileTime(test):
     # TODO: This is not correct yet as the directory may contain .o.time files
     # of multiple benchmarks in the case of SingleSource tests.
@@ -69,10 +76,12 @@ def collectCompileTime(test):
     for path, subdirs, files in os.walk(basepath):
         for file in files:
             if file.endswith('.o.time'):
-                compile_time += getUserTimeFromTimeOutput(os.path.join(path, file))
+                fullpath = os.path.join(path, file)
+                compile_time += getUserTimeFromTimeOutput(fullpath)
     return compile_time
 
-def runScript(test, litConfig, script, tmpBase, useExternalSh = True):
+
+def runScript(test, litConfig, script, tmpBase, useExternalSh=True):
     execdir = os.path.dirname(test.getExecPath())
     if useExternalSh:
         res = executeScript(test, litConfig, tmpBase, script, execdir)
@@ -80,6 +89,7 @@ def runScript(test, litConfig, script, t
         res = executeScriptInternal(test, litConfig, tmpBase, script, execdir)
     return res
 
+
 def prepareRunSafely(config, commandline, outfile):
     stdin = None
     stdout = None
@@ -113,42 +123,43 @@ def prepareRunSafely(config, commandline
         i += 1
 
     runsafely = "%s/RunSafely.sh" % config.test_suite_root
-    runsafely_prefix = [ runsafely ]
+    runsafely_prefix = [runsafely]
     if workdir is not None:
-        runsafely_prefix += [ "-d", workdir ]
+        runsafely_prefix += ["-d", workdir]
     timeit = "%s/tools/timeit" % config.test_source_root
     if config.remote_host:
         timeit = "%s/tools/timeit-target" % config.test_source_root
-        runsafely_prefix += [ "-r", config.remote_host ]
+        runsafely_prefix += ["-r", config.remote_host]
         if config.remote_user:
-            runsafely_prefix += [ "-l", config.remote_user ]
+            runsafely_prefix += ["-l", config.remote_user]
         if config.remote_client:
-            runsafely_prefix += [ "-rc", config.remote_client ]
+            runsafely_prefix += ["-rc", config.remote_client]
         if config.remote_port:
-            runsafely_prefix += [ "-rp", config.remote_port ]
+            runsafely_prefix += ["-rp", config.remote_port]
     if config.run_under:
-        runsafely_prefix += [ "-u", config.run_under ]
+        runsafely_prefix += ["-u", config.run_under]
     if not config.traditional_output:
-        runsafely_prefix += [ "-n" ]
+        runsafely_prefix += ["-n"]
         if stdout is not None:
-            runsafely_prefix += [ "-o", stdout ]
+            runsafely_prefix += ["-o", stdout]
         if stderr is not None:
-            runsafely_prefix += [ "-e", stderr ]
+            runsafely_prefix += ["-e", stderr]
     else:
         if stdout is not None or stderr is not None:
             raise Exception("separate stdout/stderr redirection not possible with traditional output")
     timeout = "7200"
     if stdin is None:
         stdin = "/dev/null"
-    runsafely_prefix += [ "-t", timeit, timeout, stdin, outfile ]
+    runsafely_prefix += ["-t", timeit, timeout, stdin, outfile]
 
     new_commandline = " ".join(map(quote, runsafely_prefix + tokens))
     return new_commandline
 
+
 class TestSuiteTest(FileBasedTest):
     def __init__(self):
         super(TestSuiteTest, self).__init__()
-        
+
     def execute(self, test, litConfig):
         config = test.config
         if config.unsupported:
@@ -229,6 +240,7 @@ class TestSuiteTest(FileBasedTest):
 
         return result
 
+
 config.name = 'test-suite'
 config.test_format = TestSuiteTest()
 config.suffixes = ['.test']




More information about the llvm-commits mailing list