diff --git a/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cerr.sh.cpp b/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cerr.sh.cpp index cd221e7875b6..36380f64a9fe 100644 --- a/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cerr.sh.cpp +++ b/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cerr.sh.cpp @@ -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" diff --git a/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cin.sh.cpp b/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cin.sh.cpp index f4b34289cf51..c394c1b00f3e 100644 --- a/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cin.sh.cpp +++ b/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cin.sh.cpp @@ -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" diff --git a/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/clog.sh.cpp b/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/clog.sh.cpp index 884f34598ce8..b740300e8d32 100644 --- a/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/clog.sh.cpp +++ b/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/clog.sh.cpp @@ -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" diff --git a/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cout.sh.cpp b/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cout.sh.cpp index b39dd156dc7b..c606312fa054 100644 --- a/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cout.sh.cpp +++ b/libcxx/test/std/input.output/iostream.objects/narrow.stream.objects/cout.sh.cpp @@ -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" diff --git a/libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcerr.sh.cpp b/libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcerr.sh.cpp index 8ff1666496c7..617b2d45c066 100644 --- a/libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcerr.sh.cpp +++ b/libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcerr.sh.cpp @@ -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" diff --git a/libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcin.sh.cpp b/libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcin.sh.cpp index af7107cd4769..c9be17125b83 100644 --- a/libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcin.sh.cpp +++ b/libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcin.sh.cpp @@ -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" diff --git a/libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wclog.sh.cpp b/libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wclog.sh.cpp index 1a5b200f27c2..e0ce4646ea9d 100644 --- a/libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wclog.sh.cpp +++ b/libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wclog.sh.cpp @@ -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" diff --git a/libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcout.sh.cpp b/libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcout.sh.cpp index 3d4af9799973..6089432b0f56 100644 --- a/libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcout.sh.cpp +++ b/libcxx/test/std/input.output/iostream.objects/wide.stream.objects/wcout.sh.cpp @@ -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" diff --git a/libcxx/utils/libcxx/test/dsl.py b/libcxx/utils/libcxx/test/dsl.py index c9e005672535..52f4d309c2b0 100644 --- a/libcxx/utils/libcxx/test/dsl.py +++ b/libcxx/utils/libcxx/test/dsl.py @@ -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): """ diff --git a/libcxx/utils/libcxx/test/features.py b/libcxx/utils/libcxx/test/features.py index f70a8613e1d5..241d1b57a1a5 100644 --- a/libcxx/utils/libcxx/test/features.py +++ b/libcxx/utils/libcxx/test/features.py @@ -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),