aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/shell
diff options
context:
space:
mode:
authorGravatar Laszlo Csomor <laszlocsomor@google.com>2018-07-30 00:24:39 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-07-30 00:26:18 -0700
commitf6bdc21eb661f8accff1aae75d8c8c49f6ca747a (patch)
tree8d13ed633c84e1be58e9b900f1e7f27e2a820c6b /src/test/shell
parent894aab3f87a6176c5490b90a31bc58d50f3cb221 (diff)
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
Diffstat (limited to 'src/test/shell')
-rw-r--r--src/test/shell/integration/BUILD8
-rwxr-xr-xsrc/test/shell/integration/experimental_ui_test.sh49
2 files changed, 49 insertions, 8 deletions
diff --git a/src/test/shell/integration/BUILD b/src/test/shell/integration/BUILD
index 9dc0aae2c4..87ba005da0 100644
--- a/src/test/shell/integration/BUILD
+++ b/src/test/shell/integration/BUILD
@@ -83,9 +83,11 @@ sh_test(
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 be37b4563a..3b203a2d71 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
+
+if "$is_windows"; then
+ export MSYS_NO_PATHCONV=1
+ export MSYS2_ARG_CONV_EXCL="*"
+fi
-set -e
+#### 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 @@ sh_test(
deps = [":outputlib"],
)
EOF
+ chmod -w pkg/* # prevent accidental editing
}
#### TESTS #############################################################