aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLászló Csomor <laszlocsomor@users.noreply.github.com>2019-03-26 10:52:27 +0100
committerGitHub <noreply@github.com>2019-03-26 10:52:27 +0100
commit4c26bf475c5cacade5367c92ef2dab5abe912112 (patch)
treef668197546d76ced2136fc9278c789c1e0e39f5e /tests
parent98ef48ebb2248e24184712ba3189de241707cc8a (diff)
downloadbazel-skylib-4c26bf475c5cacade5367c92ef2dab5abe912112.tar.gz
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
Diffstat (limited to 'tests')
-rw-r--r--tests/BUILD11
-rw-r--r--tests/shell_tests.bzl18
2 files changed, 17 insertions, 12 deletions
diff --git a/tests/BUILD b/tests/BUILD
index 25ce454..0b1706f 100644
--- a/tests/BUILD
+++ b/tests/BUILD
@@ -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"],
+)
diff --git a/tests/shell_tests.bzl b/tests/shell_tests.bzl
index dffe03d..32d517f 100644
--- a/tests/shell_tests.bzl
+++ b/tests/shell_tests.bzl
@@ -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,
)