aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/shell/bazel
diff options
context:
space:
mode:
authorGravatar Laszlo Csomor <laszlocsomor@google.com>2018-07-02 00:11:40 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-07-02 00:13:02 -0700
commita5e2f1b3d0679ef82d658a7e02bffa8d515faf8d (patch)
treec7c3889b719f72a02f48fdf9926fb4b2275b4c2c /src/test/shell/bazel
parent4f64b77a3dd8e4ccdc8077051927985f9578a3a5 (diff)
Windows,tests: port rule_test_test
Port //src/test/shell/bazel:rule_test_test to Windows: - Use the Bash runfiles library (in @bazel_tools) - Update testenv.sh to retry failed "rm" commands because often they attempt to delete a Bazel's output directory that is still in the middle of shutting down, and just needs a bit of time to finish doing so. See https://github.com/bazelbuild/bazel/issues/4292 Change-Id: I6a7687d15ae3af2ca605149fa75ff48bf2fb89c8 Closes #5490. Change-Id: I6a7687d15ae3af2ca605149fa75ff48bf2fb89c8 PiperOrigin-RevId: 202903547
Diffstat (limited to 'src/test/shell/bazel')
-rw-r--r--src/test/shell/bazel/BUILD6
-rwxr-xr-xsrc/test/shell/bazel/rule_test_test.sh31
2 files changed, 32 insertions, 5 deletions
diff --git a/src/test/shell/bazel/BUILD b/src/test/shell/bazel/BUILD
index 7fa364176b..4b9117faac 100644
--- a/src/test/shell/bazel/BUILD
+++ b/src/test/shell/bazel/BUILD
@@ -573,9 +573,11 @@ sh_test(
name = "rule_test_test",
size = "medium",
srcs = ["rule_test_test.sh"],
- data = [":test-deps"],
+ data = [
+ ":test-deps",
+ "@bazel_tools//tools/bash/runfiles",
+ ],
shard_count = 2,
- tags = ["no_windows"],
)
sh_test(
diff --git a/src/test/shell/bazel/rule_test_test.sh b/src/test/shell/bazel/rule_test_test.sh
index 09c0add28f..2fb41a64c8 100755
--- a/src/test/shell/bazel/rule_test_test.sh
+++ b/src/test/shell/bazel/rule_test_test.sh
@@ -17,11 +17,36 @@
# Test rule_test usage.
#
-# Load the test setup defined in the parent directory
-CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
-source "${CURRENT_DIR}/../integration_test_setup.sh" \
+set -euo pipefail
+# --- begin runfiles.bash initialization ---
+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; }
+function set_up() {
+ export MSYS_NO_PATHCONV=1
+ export MSYS2_ARG_CONV_EXCL="*"
+}
+
function test_local_rule_test_in_root() {
create_new_workspace
cat > BUILD <<EOF