forked from OSchip/llvm-project
[libc++] Allow detecting whether the executor supports Bash
A few tests in the test suite require support for Bash. For example, tests that run a program and send data through stdin to it require some way of piping the data in, and we use a Bash script for that. However, some executors (e.g. an embedded systems simulator) do not support Bash, so these tests will fail. This commit adds a Lit feature that tries to detect whether Bash is available through conventional means, and disables the tests that require it otherwise. Differential Revision: https://reviews.llvm.org/D114612
This commit is contained in:
parent
7d97678df7
commit
87fe0709d4
|
@ -12,6 +12,7 @@
|
|||
|
||||
// XFAIL: LIBCXX-WINDOWS-FIXME
|
||||
|
||||
// UNSUPPORTED: executor-has-no-bash
|
||||
// FILE_DEPENDENCIES: ../check-stderr.sh
|
||||
// RUN: %{build}
|
||||
// RUN: %{exec} bash check-stderr.sh "%t.exe" "1234"
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
// istream cin;
|
||||
|
||||
// UNSUPPORTED: executor-has-no-bash
|
||||
// FILE_DEPENDENCIES: ../send-stdin.sh
|
||||
// RUN: %{build}
|
||||
// RUN: %{exec} bash send-stdin.sh "%t.exe" "1234"
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
// XFAIL: LIBCXX-WINDOWS-FIXME
|
||||
|
||||
// UNSUPPORTED: executor-has-no-bash
|
||||
// FILE_DEPENDENCIES: ../check-stderr.sh
|
||||
// RUN: %{build}
|
||||
// RUN: %{exec} bash check-stderr.sh "%t.exe" "1234"
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
// XFAIL: LIBCXX-WINDOWS-FIXME
|
||||
|
||||
// UNSUPPORTED: executor-has-no-bash
|
||||
// FILE_DEPENDENCIES: ../check-stdout.sh
|
||||
// RUN: %{build}
|
||||
// RUN: %{exec} bash check-stdout.sh "%t.exe" "1234"
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
// XFAIL: libcpp-has-no-wide-characters
|
||||
// XFAIL: LIBCXX-WINDOWS-FIXME
|
||||
|
||||
// UNSUPPORTED: executor-has-no-bash
|
||||
// FILE_DEPENDENCIES: ../check-stderr.sh
|
||||
// RUN: %{build}
|
||||
// RUN: %{exec} bash check-stderr.sh "%t.exe" "1234"
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
// XFAIL: libcpp-has-no-wide-characters
|
||||
|
||||
// UNSUPPORTED: executor-has-no-bash
|
||||
// FILE_DEPENDENCIES: ../send-stdin.sh
|
||||
// RUN: %{build}
|
||||
// RUN: %{exec} bash send-stdin.sh "%t.exe" "1234"
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
// XFAIL: libcpp-has-no-wide-characters
|
||||
// XFAIL: LIBCXX-WINDOWS-FIXME
|
||||
|
||||
// UNSUPPORTED: executor-has-no-bash
|
||||
// FILE_DEPENDENCIES: ../check-stderr.sh
|
||||
// RUN: %{build}
|
||||
// RUN: %{exec} bash check-stderr.sh "%t.exe" "1234"
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
// XFAIL: libcpp-has-no-wide-characters
|
||||
// XFAIL: LIBCXX-WINDOWS-FIXME
|
||||
|
||||
// UNSUPPORTED: executor-has-no-bash
|
||||
// FILE_DEPENDENCIES: ../check-stdout.sh
|
||||
// RUN: %{build}
|
||||
// RUN: %{exec} bash check-stdout.sh "%t.exe" "1234"
|
||||
|
|
|
@ -168,6 +168,18 @@ def hasCompileFlag(config, flag):
|
|||
])
|
||||
return exitCode == 0
|
||||
|
||||
@_memoizeExpensiveOperation(lambda c, s: (c.substitutions, c.environment, s))
|
||||
def runScriptExitCode(config, script):
|
||||
"""
|
||||
Runs the given script as a Lit test, and returns the exit code of the execution.
|
||||
|
||||
The script must be a list of commands, each of which being something that
|
||||
could appear on the right-hand-side of a `RUN:` keyword.
|
||||
"""
|
||||
with _makeConfigTest(config) as test:
|
||||
_, _, exitCode, _ = _executeScriptInternal(test, script)
|
||||
return exitCode
|
||||
|
||||
@_memoizeExpensiveOperation(lambda c, l: (c.substitutions, c.environment, l))
|
||||
def hasAnyLocale(config, locales):
|
||||
"""
|
||||
|
|
|
@ -72,6 +72,11 @@ DEFAULT_FEATURES = [
|
|||
void f() { new int(3); }
|
||||
""", ['-shared'])),
|
||||
|
||||
# Whether Bash can run on the executor.
|
||||
# This is not always the case, for example when running on embedded systems.
|
||||
Feature(name='executor-has-no-bash',
|
||||
when=lambda cfg: runScriptExitCode(cfg, ['%{exec} bash --version']) != 0),
|
||||
|
||||
Feature(name='apple-clang', when=_isAppleClang),
|
||||
Feature(name=lambda cfg: 'apple-clang-{__clang_major__}'.format(**compilerMacros(cfg)), when=_isAppleClang),
|
||||
Feature(name=lambda cfg: 'apple-clang-{__clang_major__}.{__clang_minor__}'.format(**compilerMacros(cfg)), when=_isAppleClang),
|
||||
|
|
Loading…
Reference in New Issue