From 9dc24effb614f3695c962c4e1d1012e9e2aeb453 Mon Sep 17 00:00:00 2001 From: Cal Peyser Date: Mon, 18 Apr 2016 15:21:24 +0000 Subject: Bind path to xcrunwrapper in workspace files. -- MOS_MIGRATED_REVID=120124909 --- BUILD | 5 ++++- WORKSPACE | 3 +++ src/test/shell/bazel/BUILD | 11 +++++++++ src/test/shell/bazel/bound_targets_test.sh | 26 ++++++++++++++++++++++ src/test/shell/bazel/external_skylark_load_test.sh | 5 +++++ src/test/shell/bazel/local_repository_test.sh | 4 ++++ src/test/shell/bazel/test-setup.sh | 2 +- src/test/shell/bazel/testenv.sh | 3 +++ 8 files changed, 57 insertions(+), 2 deletions(-) create mode 100755 src/test/shell/bazel/bound_targets_test.sh diff --git a/BUILD b/BUILD index fc3bb5eb66..f7fea2174c 100644 --- a/BUILD +++ b/BUILD @@ -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( diff --git a/WORKSPACE b/WORKSPACE index 05c5117286..83c2388af6 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -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 < WORKSPACE <&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" -- cgit v1.2.3