diff options
author | Matthias Braun <matze@braunis.de> | 2016-01-20 03:57:23 +0000 |
---|---|---|
committer | Matthias Braun <matze@braunis.de> | 2016-01-20 03:57:23 +0000 |
commit | f9f1a8302bd34d0976b730697ed165475ccf7ab6 (patch) | |
tree | 3f32822a211adc491b5a7294b890ed6856bcf610 /lit.cfg | |
parent | 2cb10771fc83dd38cb79bc3e7b58ee4d08b7dffe (diff) |
lit.cfg: Fix most violations reported by pep8 tool, NFC
git-svn-id: https://llvm.org/svn/llvm-project/test-suite/trunk@258282 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lit.cfg')
-rw-r--r-- | lit.cfg | 54 |
1 files changed, 33 insertions, 21 deletions
@@ -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, tmpBase, useExternalSh = True): 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, outfile): 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'] |