Skip to content

Commit

Permalink
[libc++] Use the internal Lit shell to run the tests
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ldionne committed May 3, 2021
1 parent 84f0bb6 commit 39bbfb7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion libcxx/test/libcxx/selftest/sh.cpp/run-error.sh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@

// Make sure the test DOES NOT pass if it fails to run

// RUN: exit 1
// RUN: false
2 changes: 1 addition & 1 deletion libcxx/test/libcxx/selftest/sh.cpp/run-success.sh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@

// Make sure the test passes if it succeeds to run

// RUN: exit 0
// RUN: true
6 changes: 2 additions & 4 deletions libcxx/utils/libcxx/test/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)

0 comments on commit 39bbfb7

Please sign in to comment.