Skip to content

Commit

Permalink
Create BUILD file in worker tests directory instead of running tests …
Browse files Browse the repository at this point in the history
…from the parent directory.

RELNOTES: None.
PiperOrigin-RevId: 368261056
  • Loading branch information
larsrc-google authored and copybara-github committed Apr 13, 2021
1 parent 3c29bc8 commit 5894a85
Show file tree
Hide file tree
Showing 3 changed files with 121 additions and 92 deletions.
90 changes: 2 additions & 88 deletions src/test/java/com/google/devtools/build/lib/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@rules_java//java:defs.bzl", "java_binary", "java_library", "java_test")
load("@rules_java//java:defs.bzl", "java_library", "java_test")

package(
default_visibility = [
Expand Down Expand Up @@ -52,6 +52,7 @@ filegroup(
"//src/test/java/com/google/devtools/build/lib/testing/common:srcs",
"//src/test/java/com/google/devtools/build/lib/testutil:srcs",
"//src/test/java/com/google/devtools/build/lib/windows:srcs",
"//src/test/java/com/google/devtools/build/lib/worker:srcs",
],
visibility = ["//src:__pkg__"],
)
Expand Down Expand Up @@ -557,93 +558,6 @@ java_test(
],
)

java_test(
name = "worker-tests",
srcs =
glob([
"worker/*Test.java",
]) + [
"worker/TestUtils.java",
],
test_class = "com.google.devtools.build.lib.AllTests",
deps = [
":AllTests",
"//src/main/java/com/google/devtools/build/lib/actions",
"//src/main/java/com/google/devtools/build/lib/actions:execution_requirements",
"//src/main/java/com/google/devtools/build/lib/clock",
"//src/main/java/com/google/devtools/build/lib/collect/nestedset",
"//src/main/java/com/google/devtools/build/lib/events",
"//src/main/java/com/google/devtools/build/lib/exec:spawn_runner",
"//src/main/java/com/google/devtools/build/lib/exec/local",
"//src/main/java/com/google/devtools/build/lib/sandbox",
"//src/main/java/com/google/devtools/build/lib/shell",
"//src/main/java/com/google/devtools/build/lib/util",
"//src/main/java/com/google/devtools/build/lib/util:os",
"//src/main/java/com/google/devtools/build/lib/util:resource_converter",
"//src/main/java/com/google/devtools/build/lib/vfs",
"//src/main/java/com/google/devtools/build/lib/vfs:pathfragment",
"//src/main/java/com/google/devtools/build/lib/vfs/inmemoryfs",
"//src/main/java/com/google/devtools/build/lib/worker",
"//src/main/java/com/google/devtools/common/options:options_internal",
"//src/main/protobuf:worker_protocol_java_proto",
"//src/test/java/com/google/devtools/build/lib/actions/util",
"//src/test/java/com/google/devtools/build/lib/events:testutil",
"//src/test/java/com/google/devtools/build/lib/testutil",
"//src/test/java/com/google/devtools/build/lib/testutil:JunitUtils",
"//src/test/java/com/google/devtools/build/lib/testutil:TestUtils",
"//src/test/java/com/google/devtools/build/lib/vfs/util",
"//third_party:apache_commons_pool2_checked_in",
"//third_party:gson",
"//third_party:guava",
"//third_party:guava-testlib",
"//third_party:junit4",
"//third_party:mockito",
"//third_party:truth",
"//third_party/protobuf:protobuf_java",
"//third_party/protobuf:protobuf_java_util",
],
)

java_library(
name = "ExampleWorker-lib",
srcs = glob(["worker/*ExampleWorker*.java"]),
visibility = [
"//src/test/shell/integration:__pkg__",
],
deps = [
"//src/main/java/com/google/devtools/build/lib/actions:execution_requirements",
"//src/main/java/com/google/devtools/build/lib/worker:work_request_handlers",
"//src/main/java/com/google/devtools/common/options",
"//src/main/protobuf:worker_protocol_java_proto",
"//third_party:gson",
"//third_party:guava",
"//third_party/protobuf:protobuf_java",
"//third_party/protobuf:protobuf_java_util",
],
)

java_binary(
name = "ExampleWorker",
main_class = "com.google.devtools.build.lib.worker.ExampleWorker",
visibility = [
"//src/test/shell/integration:__pkg__",
],
runtime_deps = [
":ExampleWorker-lib",
],
)

java_binary(
name = "ExampleWorkerMultiplexer",
main_class = "com.google.devtools.build.lib.worker.ExampleWorkerMultiplexer",
visibility = [
"//src/test/shell/integration:__pkg__",
],
runtime_deps = [
":ExampleWorker-lib",
],
)

TEST_SUITES = [
"ziputils",
"rules",
Expand Down
115 changes: 115 additions & 0 deletions src/test/java/com/google/devtools/build/lib/worker/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
load("@rules_java//java:defs.bzl", "java_binary", "java_library", "java_test")

package(
default_testonly = 1,
default_visibility = ["//src:__subpackages__"],
)

filegroup(
name = "srcs",
testonly = 0,
srcs = glob(["*"]),
visibility = ["//src:__subpackages__"],
)

java_library(
name = "ExampleWorker_lib",
srcs = [
"ExampleWorker.java",
"ExampleWorkerMultiplexer.java",
"ExampleWorkerMultiplexerOptions.java",
"ExampleWorkerOptions.java",
"ExampleWorkerProtocol.java",
],
deps = [
"//src/main/java/com/google/devtools/build/lib/actions:execution_requirements",
"//src/main/java/com/google/devtools/build/lib/worker:work_request_handlers",
"//src/main/java/com/google/devtools/common/options",
"//src/main/protobuf:worker_protocol_java_proto",
"//third_party:gson",
"//third_party:guava",
],
)

java_library(
name = "testutil",
testonly = 1,
srcs = ["TestUtils.java"],
deps = [
"//src/main/java/com/google/devtools/build/lib/actions:execution_requirements",
"//src/main/java/com/google/devtools/build/lib/shell",
"//src/main/java/com/google/devtools/build/lib/vfs",
"//src/main/java/com/google/devtools/build/lib/worker",
"//third_party:guava",
],
)

java_binary(
name = "ExampleWorker",
main_class = "com.google.devtools.build.lib.worker.ExampleWorker",
runtime_deps = [":ExampleWorker_lib"],
)

java_binary(
name = "ExampleWorkerMultiplexer",
main_class = "com.google.devtools.build.lib.worker.ExampleWorkerMultiplexer",
runtime_deps = [":ExampleWorker_lib"],
)

java_library(
name = "WorkerTests_lib",
srcs = glob(["*Test.java"]),
deps = [
":testutil",
"//src/main/java/com/google/devtools/build/lib/actions",
"//src/main/java/com/google/devtools/build/lib/actions:execution_requirements",
"//src/main/java/com/google/devtools/build/lib/clock",
"//src/main/java/com/google/devtools/build/lib/collect/nestedset",
"//src/main/java/com/google/devtools/build/lib/events",
"//src/main/java/com/google/devtools/build/lib/exec:spawn_runner",
"//src/main/java/com/google/devtools/build/lib/exec/local",
"//src/main/java/com/google/devtools/build/lib/sandbox",
"//src/main/java/com/google/devtools/build/lib/util:resource_converter",
"//src/main/java/com/google/devtools/build/lib/vfs",
"//src/main/java/com/google/devtools/build/lib/vfs:pathfragment",
"//src/main/java/com/google/devtools/build/lib/vfs/inmemoryfs",
"//src/main/java/com/google/devtools/build/lib/worker",
"//src/main/java/com/google/devtools/common/options",
"//src/main/protobuf:worker_protocol_java_proto",
"//src/test/java/com/google/devtools/build/lib/actions/util",
"//src/test/java/com/google/devtools/build/lib/testutil:TestUtils",
"//src/test/java/com/google/devtools/build/lib/vfs/util",
"//third_party:apache_commons_pool2",
"//third_party:guava",
"//third_party:guava-testlib",
"//third_party:junit4",
"//third_party:mockito",
"//third_party:truth",
"//third_party/protobuf:protobuf_java",
],
)

java_test(
name = "WorkerTests",
size = "small",
data = [
"//src/test/java/com/google/devtools/build/lib:embedded_scripts",
],
test_class = "com.google.devtools.build.lib.AllTests",
runtime_deps = [
":WorkerTests_lib",
"//src/test/java/com/google/devtools/build/lib:test_runner",
],
)

java_test(
name = "WorkRequestHandlerTest",
srcs = ["WorkRequestHandlerTest.java"],
deps = [
"//src/main/java/com/google/devtools/build/lib/worker:work_request_handlers",
"//src/main/protobuf:worker_protocol_java_proto",
"//third_party:junit4",
"//third_party:mockito",
"//third_party:truth",
],
)
8 changes: 4 additions & 4 deletions src/test/shell/integration/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ sh_test(
],
data = [
":test-deps",
"//src/test/java/com/google/devtools/build/lib:ExampleWorker_deploy.jar",
"//src/test/java/com/google/devtools/build/lib/worker:ExampleWorker_deploy.jar",
],
shard_count = 3,
tags = [
Expand All @@ -529,7 +529,7 @@ sh_test(
],
data = [
":test-deps",
"//src/test/java/com/google/devtools/build/lib:ExampleWorker_deploy.jar",
"//src/test/java/com/google/devtools/build/lib/worker:ExampleWorker_deploy.jar",
],
tags = [
"no_windows",
Expand All @@ -547,7 +547,7 @@ sh_test(
],
data = [
":test-deps",
"//src/test/java/com/google/devtools/build/lib:ExampleWorkerMultiplexer_deploy.jar",
"//src/test/java/com/google/devtools/build/lib/worker:ExampleWorkerMultiplexer_deploy.jar",
],
shard_count = 3,
tags = [
Expand All @@ -566,7 +566,7 @@ sh_test(
],
data = [
":test-deps",
"//src/test/java/com/google/devtools/build/lib:ExampleWorker_deploy.jar",
"//src/test/java/com/google/devtools/build/lib/worker:ExampleWorker_deploy.jar",
],
# TODO(b/34450149): remove when no longer flaky
flaky = 1,
Expand Down

0 comments on commit 5894a85

Please sign in to comment.