From 39bbfb77264a4a7a216921c2b70a30ba0f27eb56 Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Thu, 30 Apr 2020 17:01:28 -0400 Subject: [PATCH] [libc++] Use the internal Lit shell to run the tests This makes the libc++ tests more portable -- almost all of them should now work on Windows, except for some tests that assume a shell is available on the target. We should probably provide a way to exclude those anyway for the purpose of running tests on embedded targets. Differential Revision: https://reviews.llvm.org/D89495 --- .../substitutes-in-compile-flags.sh.cpp | 5 +++++ libcxx/test/libcxx/selftest/sh.cpp/run-error.sh.cpp | 2 +- libcxx/test/libcxx/selftest/sh.cpp/run-success.sh.cpp | 2 +- libcxx/utils/libcxx/test/format.py | 6 ++---- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/libcxx/test/libcxx/selftest/additional_compile_flags/substitutes-in-compile-flags.sh.cpp b/libcxx/test/libcxx/selftest/additional_compile_flags/substitutes-in-compile-flags.sh.cpp index 6fa65a417524404..ba7458b5a280e67 100644 --- a/libcxx/test/libcxx/selftest/additional_compile_flags/substitutes-in-compile-flags.sh.cpp +++ b/libcxx/test/libcxx/selftest/additional_compile_flags/substitutes-in-compile-flags.sh.cpp @@ -6,6 +6,11 @@ // //===----------------------------------------------------------------------===// +// This test greps for %t, which is expanded to a path with backslashes. When +// that is passed to grep, those backslashes would have to be escaped, which we +// don't do right now. +// UNSUPPORTED: windows + // Make sure that substitutions are performed inside additional compiler flags. // ADDITIONAL_COMPILE_FLAGS: -I %t.1 diff --git a/libcxx/test/libcxx/selftest/sh.cpp/run-error.sh.cpp b/libcxx/test/libcxx/selftest/sh.cpp/run-error.sh.cpp index ce5cd4f03349a90..4be0c05c4f076f6 100644 --- a/libcxx/test/libcxx/selftest/sh.cpp/run-error.sh.cpp +++ b/libcxx/test/libcxx/selftest/sh.cpp/run-error.sh.cpp @@ -10,4 +10,4 @@ // Make sure the test DOES NOT pass if it fails to run -// RUN: exit 1 +// RUN: false diff --git a/libcxx/test/libcxx/selftest/sh.cpp/run-success.sh.cpp b/libcxx/test/libcxx/selftest/sh.cpp/run-success.sh.cpp index 9f2d58236f1be2c..1d8747c71948454 100644 --- a/libcxx/test/libcxx/selftest/sh.cpp/run-success.sh.cpp +++ b/libcxx/test/libcxx/selftest/sh.cpp/run-success.sh.cpp @@ -8,4 +8,4 @@ // Make sure the test passes if it succeeds to run -// RUN: exit 0 +// RUN: true diff --git a/libcxx/utils/libcxx/test/format.py b/libcxx/utils/libcxx/test/format.py index 2be7d4c59da206b..72f6d3625037977 100644 --- a/libcxx/utils/libcxx/test/format.py +++ b/libcxx/utils/libcxx/test/format.py @@ -64,9 +64,7 @@ def parseScript(test, preamble): # Get the default substitutions tmpDir, tmpBase = _getTempPaths(test) - useExternalSh = True - substitutions = lit.TestRunner.getDefaultSubstitutions(test, tmpDir, tmpBase, - normalize_slashes=useExternalSh) + substitutions = lit.TestRunner.getDefaultSubstitutions(test, tmpDir, tmpBase) # Check base substitutions and add the %{build} and %{run} convenience substitutions _checkBaseSubstitutions(substitutions) @@ -305,5 +303,5 @@ def _executeShTest(self, test, litConfig, steps): return lit.Test.Result(lit.Test.XFAIL if test.isExpectedToFail() else lit.Test.PASS) else: _, tmpBase = _getTempPaths(test) - useExternalSh = True + useExternalSh = False return lit.TestRunner._runShTest(test, litConfig, useExternalSh, script, tmpBase)