Skip to content

Commit

Permalink
Flip --incompatible_windows_native_test_wrapper
Browse files Browse the repository at this point in the history
Fixes bazelbuild#6622

RELNOTES[INC]: Windows: --incompatible_windows_native_test_wrapper is enabled by default

PiperOrigin-RevId: 266915717
  • Loading branch information
meteorcloudy authored and gnarled-cipher committed Sep 4, 2019
1 parent 4746066 commit 160baff
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,12 @@ public static class TestOptions extends FragmentOptions {
OptionMetadataTag.INCOMPATIBLE_CHANGE,
OptionMetadataTag.TRIGGERED_BY_ALL_INCOMPATIBLE_CHANGES,
},
defaultValue = "false",
defaultValue = "true",
help =
"On Windows: if true, uses the C++ test wrapper to run tests, otherwise uses "
+ "tools/test/test-setup.sh as on other platforms. On other platforms: no-op.")
public boolean windowsNativeTestWrapper;


@Override
public FragmentOptions getHost() {
TestOptions hostOptions = (TestOptions) getDefault();
Expand Down
28 changes: 25 additions & 3 deletions src/test/shell/bazel/platforms_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,21 @@ fi
source "$(rlocation "io_bazel/src/test/shell/integration_test_setup.sh")" \
|| { echo "integration_test_setup.sh not found!" >&2; exit 1; }

# `uname` returns the current platform, e.g "MSYS_NT-10.0" or "Linux".
# `tr` converts all upper case letters to lower case.
# `case` matches the result if the `uname | tr` expression to string prefixes
# that use the same wildcards as names do in Bash, i.e. "msys*" matches strings
# starting with "msys", and "*" matches everything (it's the default case).
case "$(uname -s | tr [:upper:] [:lower:])" in
msys*)
# As of 2019-01-15, Bazel on Windows only supports MSYS Bash.
declare -r is_windows=true
;;
*)
declare -r is_windows=false
;;
esac

function test_platforms_repository_builds_itself() {
# We test that a built-in @platforms repository is buildable.
bazel build @platforms//:all &> $TEST_log \
Expand Down Expand Up @@ -154,10 +169,17 @@ EOF


function test_target_exec_properties_starlark_test() {
cat > rules.bzl << 'EOF'
if "$is_windows"; then
script_name="test_script.bat"
script_content="@echo off\necho hello\n"
else
script_name="test_script.sh"
script_content="#!/bin/bash\necho hello\n"
fi
cat > rules.bzl <<EOF
def _impl(ctx):
out_file = ctx.actions.declare_file("test_script")
ctx.actions.write(out_file, "#!/bin/bash\necho hello\n", is_executable=True)
out_file = ctx.actions.declare_file("$script_name")
ctx.actions.write(out_file, "$script_content", is_executable=True)
return [DefaultInfo(executable = out_file)]
my_rule_test = rule(
Expand Down

0 comments on commit 160baff

Please sign in to comment.