diff options
| author | Nico Weber <nicolasweber@gmx.de> | 2018-12-19 20:18:59 +0000 |
|---|---|---|
| committer | Nico Weber <nicolasweber@gmx.de> | 2018-12-19 20:18:59 +0000 |
| commit | 25899273072cb694b36561396ebc5923b8cdaadc (patch) | |
| tree | d22c7468a2e28a19496a102539172c3af3c9ad98 /llvm/utils/lit | |
| parent | e7652f5c0d099403b9f0ff5a93a39b809c20869d (diff) | |
| download | bcm5719-llvm-25899273072cb694b36561396ebc5923b8cdaadc.tar.gz bcm5719-llvm-25899273072cb694b36561396ebc5923b8cdaadc.zip | |
[gn build] Add build file for clang/lib/Basic and dependencies
Adds a build file for clang-tblgen and an action for running it, and uses that
to process all the .td files in include/clang/Basic.
Also adds an action to write include/clang/Config/config.h and
include/clang/Basic/Version.inc.
Differential Revision: https://reviews.llvm.org/D55847
llvm-svn: 349677
Diffstat (limited to 'llvm/utils/lit')
| -rw-r--r-- | llvm/utils/lit/lit/TestRunner.py | 19 | ||||
| -rw-r--r-- | llvm/utils/lit/lit/run.py | 47 |
2 files changed, 61 insertions, 5 deletions
diff --git a/llvm/utils/lit/lit/TestRunner.py b/llvm/utils/lit/lit/TestRunner.py index 4d903b4a6f4..4aa78453a11 100644 --- a/llvm/utils/lit/lit/TestRunner.py +++ b/llvm/utils/lit/lit/TestRunner.py @@ -1108,6 +1108,7 @@ def executeScript(test, litConfig, tmpBase, commands, cwd): else: if bashPath: command = [bashPath, script] + #print command, cwd, test.config.environment else: command = ['/bin/sh', script] if litConfig.useValgrind: @@ -1551,22 +1552,30 @@ def _runShTest(test, litConfig, useExternalSh, script, tmpBase): return lit.Test.Result(status, output) -def executeShTest(test, litConfig, useExternalSh, - extra_substitutions=[]): +def extractScript(test, litConfig, useExternalSh, extra_substitutions): if test.config.unsupported: - return lit.Test.Result(Test.UNSUPPORTED, 'Test is unsupported') + return lit.Test.Result(Test.UNSUPPORTED, 'Test is unsupported'), '' script = parseIntegratedTestScript(test) if isinstance(script, lit.Test.Result): - return script + return script, '' if litConfig.noExecute: - return lit.Test.Result(Test.PASS) + return lit.Test.Result(Test.PASS), '' tmpDir, tmpBase = getTempPaths(test) substitutions = list(extra_substitutions) substitutions += getDefaultSubstitutions(test, tmpDir, tmpBase, normalize_slashes=useExternalSh) script = applySubstitutions(script, substitutions) + return script, tmpBase + + +def executeShTest(test, litConfig, useExternalSh, + extra_substitutions=[]): + script, tmpBase = extractScript( + test, litConfig, useExternalSh, extra_substitutions) + if isinstance(script, lit.Test.Result): + return script # Re-run failed tests up to test_retry_attempts times. attempts = 1 diff --git a/llvm/utils/lit/lit/run.py b/llvm/utils/lit/lit/run.py index c4f9eb2d0fc..510f9b3474a 100644 --- a/llvm/utils/lit/lit/run.py +++ b/llvm/utils/lit/lit/run.py @@ -55,6 +55,52 @@ class Run(object): return _execute_test_impl(test, self.lit_config, self.parallelism_semaphores) + def execute_tests_using_ninja(self, jobs, max_time): + import lit.TestRunner + import pipes + sys.path.append('/Users/thakis/src/ninja/misc') + import ninja_syntax + writer = ninja_syntax.Writer(open('lit.ninja', 'w')) + # Writes a build.ninja with commands for all tests and runs ninja + # to execute them. + for i, test in enumerate(self.tests): + if not isinstance(test.config.test_format, lit.formats.ShTest): + test.setResult(lit.Test.Result(lit.Test.PASS, '')) # FIXME + continue + script, tmpBase = lit.TestRunner.extractScript( + test, self.lit_config, True, []) + if isinstance(script, lit.Test.Result): + test.result = script + continue + + # Create the output directory if it does not already exist. + lit.util.mkdir_p(os.path.dirname(tmpBase)) + + r = 'r%04d' % i + # FIXME: duplication with TestRunner.executeScript() + # FIXME: windows + execdir = os.path.dirname(test.getExecPath()) + command = '' + for var, val in test.config.environment.iteritems(): + # Need export, else LLD_VERSION doesn't make it through. + # The export means LIT_PRESERVES_TMP=1 needs to be set while + # running lit, else it's gone by the time ninja runs + # (...or this here must run ninja, probably better anyhoo) + command += 'export %s=%s; ' % (var, pipes.quote(val)) + if test.config.pipefail: + command += 'set -o pipefail; ' + command += 'cd %s; { ' % execdir + command += '; } && { '.join(script) + '; }' + + # FIXME: tests require bash for e.g. `echo -e` -- unfortunate :-/ + command = '/bin/bash -c %s' % pipes.quote(command) + + writer.rule(r, command, description=test.getFullName()) + writer.build('always%04d' % i, r) + + # FIXME: ...well... + test.setResult(lit.Test.Result(lit.Test.PASS, '')) + def execute_tests_in_pool(self, jobs, max_time): # We need to issue many wait calls, so compute the final deadline and # subtract time.time() from that as we go along. @@ -150,6 +196,7 @@ class Run(object): self.consume_test_result(result) else: self.execute_tests_in_pool(jobs, max_time) + #self.execute_tests_using_ninja(jobs, max_time) # Mark any tests that weren't run as UNRESOLVED. for test in self.tests: |

