Skip to content

Commit

Permalink
Move the docker tests in src/test/docker
Browse files Browse the repository at this point in the history
This is a better location and tools/cpp is packaged in embedded_tools that make the test ends-up in embedded_tools, which is requiring network access
to build embedded_tools!

Side-effect: have to correctly mock the bazel workspace file on a couple
of tests.

This is blocking on https://bazel-review.googlesource.com/c/12350/

PiperOrigin-RevId: 160265524
  • Loading branch information
damienmg authored and hlopko committed Jun 27, 2017
1 parent 6648268 commit 0010cc9
Show file tree
Hide file tree
Showing 15 changed files with 21 additions and 9 deletions.
2 changes: 1 addition & 1 deletion BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ filegroup(
srcs = [":WORKSPACE"],
visibility = [
"//src/test/shell/bazel:__subpackages__",
"//tools/cpp/test:__pkg__",
"//src/test/docker:__pkg__",
],
)

Expand Down
4 changes: 2 additions & 2 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ bind(
actual = "//third_party/py/six",
)

# For tools/cpp/test/...
load("//tools/cpp/test:docker_repository.bzl", "docker_repository")
# For src/test/docker/...
load("//src/test/docker:docker_repository.bzl", "docker_repository")

docker_repository()

Expand Down
1 change: 1 addition & 0 deletions src/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ filegroup(
"//src/objc_tools/bundlemerge:srcs",
"//src/objc_tools/plmerge:srcs",
"//src/test/cpp:srcs",
"//src/test/docker:srcs",
"//src/test/gen:srcs",
"//src/test/native:srcs",
"//src/test/java/com/google/devtools/build/android:srcs",
Expand Down
3 changes: 2 additions & 1 deletion tools/cpp/test/BUILD → src/test/docker/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ pkg_tar(
local = 1,
main = "docker_test.py",
tags = [
"docker",
"exclusive",
"local",
],
Expand All @@ -97,5 +98,5 @@ pkg_tar(
filegroup(
name = "srcs",
srcs = glob(["**"]),
visibility = ["//tools/cpp:__pkg__"],
visibility = ["//src:__pkg__"],
)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 1 addition & 2 deletions src/test/shell/bazel/apple/bazel_apple_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ function set_up() {
XCODE_VERSION=$(cat xcode_versions | grep -m1 '7\|8')

# Allow access to //external:xcrunwrapper.
rm WORKSPACE
ln -sv ${workspace_file} WORKSPACE
use_bazel_workspace_file
}

function make_app() {
Expand Down
3 changes: 1 addition & 2 deletions src/test/shell/bazel/bound_targets_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ if [ "${PLATFORM}" != "darwin" ]; then
fi

function test_build_xcrunwrapper() {
rm WORKSPACE
ln -sv ${workspace_file} WORKSPACE
use_bazel_workspace_file

bazel build //external:xcrunwrapper || fail "should build xcrunwrapper"
}
Expand Down
12 changes: 12 additions & 0 deletions src/test/shell/testenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,18 @@ else
hamcrest_jar=$(rlocation io_bazel/third_party/hamcrest/hamcrest-.*.jar)
fi


function use_bazel_workspace_file() {
mkdir -p src/test/docker
cat >src/test/docker/docker_repository.bzl <<EOF
def docker_repository():
pass
EOF
touch src/test/docker/BUILD
rm -f WORKSPACE
ln -sf ${workspace_file} WORKSPACE
}

# This function copies the tools directory from Bazel.
function copy_tools_directory() {
cp -RL ${tools_dir}/* tools
Expand Down
2 changes: 1 addition & 1 deletion tools/cpp/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ filegroup(

filegroup(
name = "srcs",
srcs = glob(["**"]) + ["//tools/cpp/test:srcs"],
srcs = glob(["**"]),
)

filegroup(
Expand Down

0 comments on commit 0010cc9

Please sign in to comment.