aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/worker/WorkerTestStrategy.java
diff options
context:
space:
mode:
authorGravatar kush <kush@google.com>2017-03-30 18:48:10 +0000
committerGravatar Philipp Wollermann <philwo@google.com>2017-03-31 17:10:22 +0200
commit20c41d03ea798ced1e9f873e040a52b28974bb18 (patch)
treef7d452464dd875ccd283b4e454577322fcec802e /src/main/java/com/google/devtools/build/lib/worker/WorkerTestStrategy.java
parent9175f07151c3ea0870d29643e1b68c9b5f6479a4 (diff)
Change the tag experimental_testrunner into a couple of flags.
Note 1) Explanation of the flags: --explicit_java_test_deps: This is a flag independent of the others, and forces users to specify the JUnit deps. We should try to make this flag default to true in a future release, irrespective of the work around persistent java tests. --experimental_testrunner: Bazel-only flag affecting switching from the BazelTestRunner to the ExperimentalTestRunner which will run the tests in a separate classloader. --explicit_java_test_deps is desired for this to ensure once we split the classpaths of the TestRunner and the TestTarget, the TestTarget does not hit a ClassNotFoundException, due to missing JUnit deps. --test_strategy=experimental_worker: This is the existing flag, which in turn depends on --experimental_testrunner flag, since only the ExperimentalTestRunner is capable to running java tests persistently. Note 2) There was no clean way to check for the flags defined in JavaOptions within TestActionBuilder (as I was checking the "tag=experimental_testrunner" before), without making TeasActionBuilder's build rules depend on java rules (yikes!). Hence, I created a new method compatibleWithStrategy() within each fragment, so I could check if WorkerTestStrategy could be compatible with the user specified flags. Thanks to Greg for suggesting this approach! RELNOTES: None PiperOrigin-RevId: 151729869
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/worker/WorkerTestStrategy.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/worker/WorkerTestStrategy.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/worker/WorkerTestStrategy.java b/src/main/java/com/google/devtools/build/lib/worker/WorkerTestStrategy.java
index 82634a5068..7e665a1285 100644
--- a/src/main/java/com/google/devtools/build/lib/worker/WorkerTestStrategy.java
+++ b/src/main/java/com/google/devtools/build/lib/worker/WorkerTestStrategy.java
@@ -83,7 +83,14 @@ public class WorkerTestStrategy extends StandaloneTestStrategy {
Spawn spawn,
ActionExecutionContext actionExecutionContext)
throws ExecException, InterruptedException, IOException {
- if (!action.useExperimentalTestRunner()) {
+ if (!action.getConfiguration().compatibleWithStrategy("experimental_worker")) {
+ throw new UserExecException(
+ "Build configuration not compatible with experimental_worker "
+ + "strategy. Make sure you set the explicit_java_test_deps and "
+ + "experimental_testrunner flags to true.");
+ }
+
+ if (!action.useTestRunner()) {
throw new UserExecException(
"Tests that do not use the experimental test runner are incompatible with the persistent"
+ " worker test strategy. Please use another test strategy");