aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/shell/integration/run_test.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/shell/integration/run_test.sh')
-rwxr-xr-xsrc/test/shell/integration/run_test.sh40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/test/shell/integration/run_test.sh b/src/test/shell/integration/run_test.sh
index afa84f0d91..5c4ec2c5bf 100755
--- a/src/test/shell/integration/run_test.sh
+++ b/src/test/shell/integration/run_test.sh
@@ -329,4 +329,44 @@ EOF
expect_log "Dancing with wolves"
}
+function test_run_for_custom_executable() {
+ mkdir -p a
+ cat > a/x.bzl <<EOF
+def _impl(ctx):
+ f = ctx.actions.declare_file("x.sh")
+ ctx.actions.write(f,
+ "#!/bin/sh\n"
+ + "if [ -z \$1 ]; then\\n"
+ + " echo Run Forest run\\n"
+ + "else\\n"
+ + " echo Run Forest run > \$1\\n"
+ + "fi",
+ is_executable=True)
+ return [DefaultInfo(executable=f)]
+
+my_rule = rule(_impl, executable = True)
+
+def _tool_impl(ctx):
+ f = ctx.actions.declare_file("output")
+ ctx.actions.run(executable = ctx.executable.tool,
+ inputs = [],
+ outputs = [f],
+ arguments = [f.path]
+ )
+ return DefaultInfo(files = depset([f]))
+my_tool_rule = rule(_tool_impl, attrs = { 'tool' : attr.label(executable = True, cfg = "host") })
+EOF
+
+cat > a/BUILD <<EOF
+load(":x.bzl", "my_rule", "my_tool_rule")
+my_rule(name = "zzz")
+my_tool_rule(name = "kkk", tool = ":zzz")
+EOF
+ bazel run //a:zzz > "$TEST_log" || fail "Expected success"
+ expect_log "Run Forest run"
+ bazel build //a:kkk > "$TEST_log" || fail "Expected success"
+ grep "Run Forest run" bazel-bin/a/output || fail "Output file wrong"
+}
+
+
run_suite "'${PRODUCT_NAME} run' integration tests"