diff options
author | 2016-09-20 13:50:03 +0000 | |
---|---|---|
committer | 2016-09-21 07:04:35 +0000 | |
commit | b20c10768a3abdc1be3ef142e33654c985fe690b (patch) | |
tree | 1b6dfff4a0743b1bf49827714160983ecfa4b422 /src | |
parent | 748ba861bd7141ce24c71c966c22f83249435ec6 (diff) |
Added integration test for linaro c++ toolchain example
--
Change-Id: I28a6ffa185ac604948c057ead67eb890723855e4
Reviewed-on: https://bazel-review.googlesource.com/#/c/6052/
MOS_MIGRATED_REVID=133700227
Diffstat (limited to 'src')
-rw-r--r-- | src/test/shell/bazel/BUILD | 13 | ||||
-rwxr-xr-x | src/test/shell/bazel/bazel_toolchain_test.sh | 44 | ||||
-rw-r--r-- | src/test/shell/bazel/testdata/BUILD | 9 |
3 files changed, 66 insertions, 0 deletions
diff --git a/src/test/shell/bazel/BUILD b/src/test/shell/bazel/BUILD index 7a448d4a03..b9a406d174 100644 --- a/src/test/shell/bazel/BUILD +++ b/src/test/shell/bazel/BUILD @@ -156,6 +156,19 @@ sh_test( data = [":test-deps"], ) +sh_test( + name = "bazel_toolchain_test", + size = "medium", + srcs = ["bazel_toolchain_test.sh"], + data = [ + ":test-deps", + "//src/test/shell/bazel/testdata:bazel_toolchain_test_project_pkg", + ], + tags = [ + "requires-network", + ], +) + # TODO(bazel-team): zip is non-deterministic because of file timestamp, # we should use a custom zip version (SingleJar?). genrule( diff --git a/src/test/shell/bazel/bazel_toolchain_test.sh b/src/test/shell/bazel/bazel_toolchain_test.sh new file mode 100755 index 0000000000..07b70ede30 --- /dev/null +++ b/src/test/shell/bazel/bazel_toolchain_test.sh @@ -0,0 +1,44 @@ +#!/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. +# +# Tests compiling using an external toolchain +# + +# Load test environment +source $(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/test-setup.sh \ + || { echo "test-setup.sh not found!" >&2; exit 1; } + +# Copy the project package here +cp -r ${testdata_path}/bazel_toolchain_test_data/* . + +# Rename WORKSPACE.linaro file to WORKSPACE +# (Did not include the file WORKSPACE in the test because source tree under +# directories that contain this file is not parsed) +mv WORKSPACE.linaro WORKSPACE + +bazel clean --expunge +bazel build --crosstool_top=//tools/arm_compiler:toolchain --cpu=armeabi-v7a \ + --spawn_strategy=standalone hello || fail "Should build" + +# Assert that output binary exists +test -f ./bazel-bin/hello || fail "output not found" + +# Assert that output has the right machine architecture +file ./bazel-bin/hello | grep -q "ARM" || fail "expect ARM machine architecture" +file ./bazel-bin/hello | grep -q "x86-64" && fail "expect ARM machine architecture" + +echo "PASS" + diff --git a/src/test/shell/bazel/testdata/BUILD b/src/test/shell/bazel/testdata/BUILD index c3e91a5e31..332794ca57 100644 --- a/src/test/shell/bazel/testdata/BUILD +++ b/src/test/shell/bazel/testdata/BUILD @@ -14,3 +14,12 @@ filegroup( ], visibility = ["//src/test/shell/bazel:__pkg__"], ) + +filegroup( + name = "bazel_toolchain_test_project_pkg", + testonly = 1, + srcs = [ + "bazel_toolchain_test_data", + ], + visibility = ["//src/test/shell/bazel:__pkg__"], +) |