Windows,tests: port experimental_ui_test //src/test/shell/integration:experimental_ui_test now runs on Windows. See https://github.com/bazelbuild/bazel/issues/4292 Change-Id: I7997e8a2e8dce9377c0326b9ed3f6c55a09b2708 Closes #5690. Change-Id: I7997e8a2e8dce9377c0326b9ed3f6c55a09b2708 PiperOrigin-RevId: 206535860
diff --git a/src/test/shell/integration/BUILD b/src/test/shell/integration/BUILD index 9dc0aae..87ba005 100644 --- a/src/test/shell/integration/BUILD +++ b/src/test/shell/integration/BUILD
@@ -83,9 +83,11 @@ name = "experimental_ui_test", size = "large", srcs = ["experimental_ui_test.sh"], - data = [":test-deps"], - shard_count = 11, - tags = ["no_windows"], + data = [ + ":test-deps", + "@bazel_tools//tools/bash/runfiles", + ], + shard_count = 4, ) sh_test(
diff --git a/src/test/shell/integration/experimental_ui_test.sh b/src/test/shell/integration/experimental_ui_test.sh index be37b45..3b203a2 100755 --- a/src/test/shell/integration/experimental_ui_test.sh +++ b/src/test/shell/integration/experimental_ui_test.sh
@@ -16,19 +16,57 @@ # # An end-to-end test that Bazel's experimental UI produces reasonable output. -# Load the test setup defined in the parent directory -CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -source "${CURRENT_DIR}/../integration_test_setup.sh" \ +# --- begin runfiles.bash initialization --- +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" + elif [[ -f "$0.runfiles/MANIFEST" ]]; then + export RUNFILES_MANIFEST_FILE="$0.runfiles/MANIFEST" + elif [[ -f "$0.runfiles/bazel_tools/tools/bash/runfiles/runfiles.bash" ]]; then + export RUNFILES_DIR="$0.runfiles" + fi +fi +if [[ -f "${RUNFILES_DIR:-/dev/null}/bazel_tools/tools/bash/runfiles/runfiles.bash" ]]; then + source "${RUNFILES_DIR}/bazel_tools/tools/bash/runfiles/runfiles.bash" +elif [[ -f "${RUNFILES_MANIFEST_FILE:-/dev/null}" ]]; then + source "$(grep -m1 "^bazel_tools/tools/bash/runfiles/runfiles.bash " \ + "$RUNFILES_MANIFEST_FILE" | cut -d ' ' -f 2-)" +else + echo >&2 "ERROR: cannot find @bazel_tools//tools/bash/runfiles:runfiles.bash" + exit 1 +fi +# --- end runfiles.bash initialization --- + +source "$(rlocation "io_bazel/src/test/shell/integration_test_setup.sh")" \ || { echo "integration_test_setup.sh not found!" >&2; exit 1; } -#### SETUP ############################################################# +case "$(uname -s | tr [:upper:] [:lower:])" in +msys*|mingw*|cygwin*) + declare -r is_windows=true + ;; +*) + declare -r is_windows=false + ;; +esac -set -e +if "$is_windows"; then + export MSYS_NO_PATHCONV=1 + export MSYS2_ARG_CONV_EXCL="*" +fi + +#### SETUP ############################################################# add_to_bazelrc "build --genrule_strategy=local" add_to_bazelrc "test --test_strategy=standalone" function set_up() { + if [[ -d pkg ]]; then + # All tests share these scratch packages. No need to recreate them if they + # already exist. + return + fi + mkdir -p pkg touch remote_file cat > pkg/true.sh <<EOF @@ -108,6 +146,7 @@ deps = [":outputlib"], ) EOF + chmod -w pkg/* # prevent accidental editing } #### TESTS #############################################################