diff options
author | Cal Peyser <cpeyser@google.com> | 2016-04-18 15:21:24 +0000 |
---|---|---|
committer | Damien Martin-Guillerez <dmarting@google.com> | 2016-04-19 09:42:10 +0000 |
commit | 9dc24effb614f3695c962c4e1d1012e9e2aeb453 (patch) | |
tree | 715b8c28935966624f4d2931a0eb1f1e354c5c58 | |
parent | 98aacfe14b7f5a79614efa26c30e3b7dea5fab91 (diff) |
Bind path to xcrunwrapper in workspace files.
--
MOS_MIGRATED_REVID=120124909
-rw-r--r-- | BUILD | 5 | ||||
-rw-r--r-- | WORKSPACE | 3 | ||||
-rw-r--r-- | src/test/shell/bazel/BUILD | 11 | ||||
-rwxr-xr-x | src/test/shell/bazel/bound_targets_test.sh | 26 | ||||
-rwxr-xr-x | src/test/shell/bazel/external_skylark_load_test.sh | 5 | ||||
-rwxr-xr-x | src/test/shell/bazel/local_repository_test.sh | 4 | ||||
-rwxr-xr-x | src/test/shell/bazel/test-setup.sh | 2 | ||||
-rwxr-xr-x | src/test/shell/bazel/testenv.sh | 3 |
8 files changed, 57 insertions, 2 deletions
@@ -13,7 +13,10 @@ filegroup( filegroup( name = "workspace-file", srcs = [":WORKSPACE"], - visibility = ["//tools/cpp/test:__pkg__"], + visibility = [ + "//src/test/shell/bazel:__pkg__", + "//tools/cpp/test:__pkg__", + ], ) filegroup( @@ -31,3 +31,6 @@ docker_repository() # scripts/workspace_user.sh and uncomment the next two lines. # load("/WORKSPACE.user", "android_repositories") # android_repositories() + +# This allows rules written in skylark to locate apple build tools. +bind(name = "xcrunwrapper", actual = "@bazel_tools//tools/objc:xcrunwrapper") diff --git a/src/test/shell/bazel/BUILD b/src/test/shell/bazel/BUILD index 8f09a4729c..2e66d248e7 100644 --- a/src/test/shell/bazel/BUILD +++ b/src/test/shell/bazel/BUILD @@ -45,6 +45,7 @@ filegroup( "testenv.sh", "testing_server.py", ":langtools-copy", + "//:workspace-file", "//examples:srcs", "//external:bootclasspath", "//external:extdir", @@ -302,6 +303,16 @@ sh_test( data = [":test-deps"], ) +sh_test( + name = "bound_targets_test", + size = "large", + srcs = ["bound_targets_test.sh"], + data = [ + ":objc-deps", + ":test-deps", + ], +) + test_suite( name = "all_tests", visibility = ["//visibility:public"], diff --git a/src/test/shell/bazel/bound_targets_test.sh b/src/test/shell/bazel/bound_targets_test.sh new file mode 100755 index 0000000000..a83f67bb02 --- /dev/null +++ b/src/test/shell/bazel/bound_targets_test.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# +# Copyright 2016 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Load test environment +source $(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/test-setup.sh \ + || { echo "test-setup.sh not found!" >&2; exit 1; } + +function test_build_xcrunwrapper() { + setup_objc_test_support + bazel build //external:xcrunwrapper || fail "should build xcrunwrapper" +} + +run_suite "bound targets integration test" diff --git a/src/test/shell/bazel/external_skylark_load_test.sh b/src/test/shell/bazel/external_skylark_load_test.sh index bd8318ad87..f3a07269db 100755 --- a/src/test/shell/bazel/external_skylark_load_test.sh +++ b/src/test/shell/bazel/external_skylark_load_test.sh @@ -46,6 +46,11 @@ function run_external_skylark_load_test() { create_new_workspace external_repo=${new_workspace_dir} + # Since we're creating an artifical WORKSPACE file in this test, we must + # first remove the symlink to the actual bazel/WORKSPACE file. + rm ${WORKSPACE_DIR}/WORKSPACE + touch ${WORKSPACE_DIR}/WORKSPACE + cat > ${WORKSPACE_DIR}/WORKSPACE <<EOF local_repository(name = "external_repo", path = "${external_repo}") EOF diff --git a/src/test/shell/bazel/local_repository_test.sh b/src/test/shell/bazel/local_repository_test.sh index 0fad9c95f0..3e90211515 100755 --- a/src/test/shell/bazel/local_repository_test.sh +++ b/src/test/shell/bazel/local_repository_test.sh @@ -657,6 +657,10 @@ EOF int main() { return 0; }; EOF + # Since we're creating an artifical WORKSPACE file in this test, we must + # first remove the symlink to the actual bazel/WORKSPACE file. + rm ${WORKSPACE_DIR}/WORKSPACE + touch ${WORKSPACE_DIR}/WORKSPACE cat > WORKSPACE <<EOF local_repository( name = "r", diff --git a/src/test/shell/bazel/test-setup.sh b/src/test/shell/bazel/test-setup.sh index 8ed875b2cf..bf825ca5be 100755 --- a/src/test/shell/bazel/test-setup.sh +++ b/src/test/shell/bazel/test-setup.sh @@ -366,7 +366,7 @@ function create_new_workspace() { ln -s "${junitrunner_path}" tools/jdk/TestRunner_deploy.jar ln -s "${ijar_path}" tools/jdk/ijar/ijar - touch WORKSPACE + ln -sv ${workspace_file} WORKSPACE } # Set-up a clean default workspace. diff --git a/src/test/shell/bazel/testenv.sh b/src/test/shell/bazel/testenv.sh index 19d0729ea7..0b0054bc4f 100755 --- a/src/test/shell/bazel/testenv.sh +++ b/src/test/shell/bazel/testenv.sh @@ -23,6 +23,9 @@ source "${TEST_SRCDIR}/src/test/shell/unittest.bash" || \ { echo "Failed to source unittest.bash" >&2; exit 1; } +# WORKSPACE file +workspace_file="${TEST_SRCDIR}/WORKSPACE" + # Bazel bazel_tree="${TEST_SRCDIR}/src/test/shell/bazel/doc-srcs.zip" bazel="${TEST_SRCDIR}/src/bazel" |