Windows: fix tests for native test wrapper (#129)

All tests work with
`--incompatible_windows_native_test_wrapper`
except for the ones already broken on Windows
(//tests:analysis_test_e2e_test and
//tests:unittest_e2e_test).

See https://github.com/bazelbuild/bazel/issues/6622
This commit is contained in:
László Csomor 2019-03-26 10:52:27 +01:00 committed by GitHub
parent 98ef48ebb2
commit 4c26bf475c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 12 deletions

View File

@ -8,7 +8,7 @@ load(":partial_tests.bzl", "partial_test_suite")
load(":paths_tests.bzl", "paths_test_suite")
load(":selects_tests.bzl", "selects_test_suite")
load(":sets_tests.bzl", "sets_test_suite")
load(":shell_tests.bzl", "shell_test_suite")
load(":shell_tests.bzl", "shell_args_test_gen", "shell_test_suite")
load(":structs_tests.bzl", "structs_test_suite")
load(":types_tests.bzl", "types_test_suite")
load(":unittest_tests.bzl", "unittest_passing_tests_suite")
@ -84,3 +84,12 @@ sh_test(
],
tags = ["local"],
)
shell_args_test_gen(
name = "shell_spawn_e2e_test_src",
)
sh_test(
name = "shell_spawn_e2e_test",
srcs = [":shell_spawn_e2e_test_src"],
)

View File

@ -52,8 +52,8 @@ def _shell_quote_test(ctx):
shell_quote_test = unittest.make(_shell_quote_test)
def _shell_spawn_e2e_test_impl(ctx):
"""Test spawning a real shell."""
def _shell_args_test_gen_impl(ctx):
"""Test argument escaping: this rule writes a script for a sh_test."""
args = [
"foo",
"foo bar",
@ -83,19 +83,16 @@ def _shell_spawn_e2e_test_impl(ctx):
"line tab\tcharacter $foo qu\"o\"te it'\\''s foo\\bar back`echo q`uote'",
'[[ "${output}" == "${expected}" ]]',
])
script_file = ctx.actions.declare_file("%s.sh" % (ctx.label.name))
out = ctx.actions.declare_file(ctx.label.name + ".sh")
ctx.actions.write(
output = script_file,
output = out,
content = script_content,
is_executable = True,
)
return [
DefaultInfo(executable = script_file),
]
return [DefaultInfo(files = depset([out]))]
shell_spawn_e2e_test = rule(
test = True,
implementation = _shell_spawn_e2e_test_impl,
shell_args_test_gen = rule(
implementation = _shell_args_test_gen_impl,
)
def shell_test_suite():
@ -104,5 +101,4 @@ def shell_test_suite():
"shell_tests",
shell_array_literal_test,
shell_quote_test,
shell_spawn_e2e_test,
)