diff options
author | Martin Storsjö <martin@martin.st> | 2023-04-06 11:19:06 +0300 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2023-04-27 19:24:35 +0300 |
commit | 1ec4e139efb474d98b38c4f6c5f0ee3750b21c69 (patch) | |
tree | b6ea502cb11c5820247c2d306e3c727bbfd6580f /libcxx/utils | |
parent | 4249d609ac9f0062df1f26d434394c94cc223c67 (diff) | |
download | llvm-1ec4e139efb474d98b38c4f6c5f0ee3750b21c69.tar.gz |
[libcxx] [test] Print the failing commands in Configuration{Compilation,Runtime}Error
This allows for easier debugging of the test environment when something
fails.
Differential Revision: https://reviews.llvm.org/D145807
Diffstat (limited to 'libcxx/utils')
-rw-r--r-- | libcxx/utils/libcxx/test/dsl.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/libcxx/utils/libcxx/test/dsl.py b/libcxx/utils/libcxx/test/dsl.py index 99ccb5af9f5d..9f59d3b447e6 100644 --- a/libcxx/utils/libcxx/test/dsl.py +++ b/libcxx/utils/libcxx/test/dsl.py @@ -105,7 +105,7 @@ def _executeScriptInternal(test, commands): out = out[:-len(conflatedErrorOutput)] err += conflatedErrorOutput - return (out, err, exitCode, timeoutInfo) + return (out, err, exitCode, timeoutInfo, parsedCommands) def _makeConfigTest(config): # Make sure the support directories exist, which is needed to create @@ -146,7 +146,7 @@ def sourceBuilds(config, source, additionalFlags=[]): with _makeConfigTest(config) as test: with open(test.getSourcePath(), 'w') as sourceFile: sourceFile.write(source) - _, _, exitCode, _ = _executeScriptInternal(test, ['%{{build}} {}'.format(' '.join(additionalFlags))]) + _, _, exitCode, _, _ = _executeScriptInternal(test, ['%{{build}} {}'.format(' '.join(additionalFlags))]) return exitCode == 0 @_memoizeExpensiveOperation(lambda c, p, args=None: (c.substitutions, c.environment, p, args)) @@ -164,13 +164,13 @@ def programOutput(config, program, args=None): with _makeConfigTest(config) as test: with open(test.getSourcePath(), 'w') as source: source.write(program) - _, err, exitCode, _ = _executeScriptInternal(test, ['%{build}']) + _, err, exitCode, _, buildcmd = _executeScriptInternal(test, ['%{build}']) if exitCode != 0: - raise ConfigurationCompilationError("Failed to build program, stderr is:\n{}".format(err)) + raise ConfigurationCompilationError("Failed to build program, cmd:\n{}\nstderr is:\n{}".format(buildcmd, err)) - out, err, exitCode, _ = _executeScriptInternal(test, ["%{{run}} {}".format(' '.join(args))]) + out, err, exitCode, _, runcmd = _executeScriptInternal(test, ["%{{run}} {}".format(' '.join(args))]) if exitCode != 0: - raise ConfigurationRuntimeError("Failed to run program, stderr is:\n{}".format(err)) + raise ConfigurationRuntimeError("Failed to run program, cmd:\n{}\nstderr is:\n{}".format(runcmd, err)) actualOut = re.search("# command output:\n(.+)\n$", out, flags=re.DOTALL) actualOut = actualOut.group(1) if actualOut else "" @@ -201,7 +201,7 @@ def hasCompileFlag(config, flag): checking whether that succeeds. """ with _makeConfigTest(config) as test: - out, err, exitCode, timeoutInfo = _executeScriptInternal(test, [ + out, err, exitCode, timeoutInfo, _ = _executeScriptInternal(test, [ "%{{cxx}} -xc++ {} -Werror -fsyntax-only %{{flags}} %{{compile_flags}} {}".format(os.devnull, flag) ]) return exitCode == 0 @@ -215,7 +215,7 @@ def runScriptExitCode(config, script): could appear on the right-hand-side of a `RUN:` keyword. """ with _makeConfigTest(config) as test: - _, _, exitCode, _ = _executeScriptInternal(test, script) + _, _, exitCode, _, _ = _executeScriptInternal(test, script) return exitCode @_memoizeExpensiveOperation(lambda c, s: (c.substitutions, c.environment, s)) @@ -228,7 +228,7 @@ def commandOutput(config, command): could appear on the right-hand-side of a `RUN:` keyword. """ with _makeConfigTest(config) as test: - out, _, exitCode, _ = _executeScriptInternal(test, command) + out, _, exitCode, _, _ = _executeScriptInternal(test, command) if exitCode != 0: raise ConfigurationRuntimeError() return out @@ -281,7 +281,7 @@ def compilerMacros(config, flags=''): # include <__config_site> #endif """) - unparsedOutput, err, exitCode, _ = _executeScriptInternal(test, [ + unparsedOutput, err, exitCode, _, _ = _executeScriptInternal(test, [ "%{{cxx}} %s -dM -E %{{flags}} %{{compile_flags}} {}".format(flags) ]) if exitCode != 0: |