From 1ff310b89da8c2050f12178fa9c8b57165afe1f0 Mon Sep 17 00:00:00 2001 From: Googler Date: Wed, 24 Apr 2024 14:54:23 -0700 Subject: [PATCH] Make sure rule_integration_test can actually be called. PiperOrigin-RevId: 627860167 Change-Id: Ic7872ff1e291ea2e59f69da1750cf49453873dfa --- src/test/shell/integration/BUILD | 10 +++++ .../shell/integration/rule_transition_test.sh | 38 +++++++++++++------ 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/src/test/shell/integration/BUILD b/src/test/shell/integration/BUILD index c9088060efaff7..1805cb3ce7589f 100644 --- a/src/test/shell/integration/BUILD +++ b/src/test/shell/integration/BUILD @@ -889,6 +889,16 @@ sh_test( tags = ["no_windows"], ) +sh_test( + name = "rule_transition_test", + srcs = ["rule_transition_test.sh"], + data = [ + ":test-deps", + "@bazel_tools//tools/bash/runfiles", + ], + tags = ["no_windows"], +) + sh_test( name = "unicode_test", srcs = ["unicode_test.sh"], diff --git a/src/test/shell/integration/rule_transition_test.sh b/src/test/shell/integration/rule_transition_test.sh index 0df64155c019e2..91f5ed70e34e2d 100755 --- a/src/test/shell/integration/rule_transition_test.sh +++ b/src/test/shell/integration/rule_transition_test.sh @@ -17,7 +17,7 @@ # Test rule transition can inspect configurable attribute. # --- begin runfiles.bash initialization --- -# Copy-pasted from Bazel's Bash runfiles library (tools/bash/runfiles/runfiles.bash). +set -euo pipefail if [[ ! -d "${RUNFILES_DIR:-/dev/null}" && ! -f "${RUNFILES_MANIFEST_FILE:-/dev/null}" ]]; then if [[ -f "$0.runfiles_manifest" ]]; then export RUNFILES_MANIFEST_FILE="$0.runfiles_manifest" @@ -41,16 +41,35 @@ fi source "$(rlocation "io_bazel/src/test/shell/integration_test_setup.sh")" \ || { echo "integration_test_setup.sh not found!" >&2; exit 1; } +#### SETUP ############################################################# + +add_to_bazelrc "build --genrule_strategy=local" +add_to_bazelrc "test --test_strategy=standalone" + function set_up() { create_new_workspace + + # Define common starlark flags. + mkdir -p settings + touch settings/BUILD + cat > settings/flag.bzl < "${pkg}/def.bzl" < "${pkg}/def.bzl" < "${pkg}/def.bzl" < "${pkg}/def.bzl" <