diff options
author | 2018-07-10 07:48:37 -0700 | |
---|---|---|
committer | 2018-07-10 07:49:37 -0700 | |
commit | 3801bcebfe5fe0391be1c6ecc3ea011f54535ca0 (patch) | |
tree | 2bb42fb3ebfbeaf015ab05527c43c96921a162de | |
parent | 9f380c578d0cb9b846be5b906e99cd5e29e28446 (diff) |
Windows,tests: port bazel_build_event_stream_test
//src/test/shell/bazel:bazel_build_event_stream_test
now runs on Windows.
See https://github.com/bazelbuild/bazel/issues/4292
Closes #5560.
Change-Id: Ica3d59fb6f557c85d2fd646cf005ffd831046119
PiperOrigin-RevId: 203945734
-rw-r--r-- | src/test/shell/bazel/BUILD | 23 | ||||
-rwxr-xr-x | src/test/shell/bazel/bazel_build_event_stream_test.sh | 39 |
2 files changed, 52 insertions, 10 deletions
diff --git a/src/test/shell/bazel/BUILD b/src/test/shell/bazel/BUILD index b7d28b6146..89cc328ef3 100644 --- a/src/test/shell/bazel/BUILD +++ b/src/test/shell/bazel/BUILD @@ -82,7 +82,9 @@ sh_test( data = [ ":test-deps", ], - tags = ["no_windows"], + tags = [ + "no_windows", # darwin-specific test + ], ) sh_test( @@ -93,7 +95,9 @@ sh_test( ":test-deps", "//:workspace-file", ], - tags = ["no_windows"], + tags = [ + "no_windows", # objc-specific test + ], ) sh_test( @@ -101,7 +105,9 @@ sh_test( size = "medium", srcs = ["bazel_embedded_skylark_test.sh"], data = [":test-deps"], - tags = ["no_windows"], + tags = [ + "no_windows", # TODO(laszlocsomor): make this run on Windows + ], ) sh_test( @@ -120,14 +126,21 @@ sh_test( timeout = "eternal", srcs = ["bazel_java_test.sh"], data = [":test-deps"], - tags = ["no_windows"], + tags = [ + # TODO(laszlocsomor): make this run on Windows. Currently fails because + # the java_common provider doesn't work on Windows. + "no_windows", + ], ) sh_test( name = "bazel_build_event_stream_test", size = "medium", srcs = ["bazel_build_event_stream_test.sh"], - data = [":test-deps"], + data = [ + ":test-deps", + "@bazel_tools//tools/bash/runfiles", + ], tags = ["no_windows"], ) diff --git a/src/test/shell/bazel/bazel_build_event_stream_test.sh b/src/test/shell/bazel/bazel_build_event_stream_test.sh index 909586f637..3d1f93b5ad 100755 --- a/src/test/shell/bazel/bazel_build_event_stream_test.sh +++ b/src/test/shell/bazel/bazel_build_event_stream_test.sh @@ -16,20 +16,49 @@ # # An end-to-end test for bazel-specific parts of the build-event stream. -# 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; } #### SETUP ############################################################# -set -e +export MSYS_NO_PATHCONV=1 +export MSYS2_ARG_CONV_EXCL="*" function set_up() { mkdir -p pkg touch remote_file + if is_windows; then + # Windows needs "file:///c:/foo/bar". + FILE_URL="file:///$(cygpath -m "$PWD")/remote_file" + else + # Non-Windows needs "file:///foo/bar". + FILE_URL="file://${PWD}/remote_file" + fi + cat > WORKSPACE <<EOF -http_file(name="remote", urls=["file://`pwd`/remote_file"]) +http_file(name="remote", urls=["${FILE_URL}"]) EOF cat > pkg/BUILD <<'EOF' genrule( |