aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/worker/WorkerTestStrategy.java
Commit message (Collapse)AuthorAge
* Cache flaky tests (remove the cachable flag from test result data)Gravatar ulfjack2017-07-07
| | | | | | | | | | | | | | | | | | | The cachable flag was only set to false for flaky tests. Before this CL, we did not cache flaky tests on subsequent runs, instead rerunning them, even though this is both very expensive and inconsistent with our normal handling, which is to cache passes but not errors. If cache_test_results is enabled, we now also cached timed out test results. If cache_test_results=auto (the default), we now also cache flaky tests. We still do not cache failed tests; the TestRunnerAction checks if the previous test result was marked as passed (which also applies to flaky tests, but not to failed or timed-out tests). Also add some unit tests. PiperOrigin-RevId: 161187950
* Rewrite the Executor/ActionExecutionContext splitGravatar ulfjack2017-06-19
| | | | | | | Move everything to ActionExecutionContext, and drop Executor whereever possible. This clarifies the API, makes it simpler to test, and simplifies the code. PiperOrigin-RevId: 159414816
* Rewrite StandaloneSpawnStrategy to use LocalSpawnRunnerGravatar ulfjack2017-06-19
| | | | PiperOrigin-RevId: 159221067
* Track the test environment in Skyframe, like the action environmentGravatar ulfjack2017-06-09
| | | | | | | | Instead of passing a client env into the test strategies, use the same mechansim as --action_env, by depending on the right set of Skyframe nodes that correspond to client env entries. PiperOrigin-RevId: 158401670
* Add support for logging exception details via ErrorMessage.Gravatar philwo2017-04-28
| | | | | | Part of #2855. PiperOrigin-RevId: 154477854
* worker: Small refactoring of RecordingInputStream.Gravatar philwo2017-04-28
| | | | | | | | Prevents it from potentially throwing an UnsupportedEncodingException. Part of #2855. PiperOrigin-RevId: 154446897
* worker: Remove the "retry on failure" feature.Gravatar philwo2017-04-28
| | | | | | | | | | | | | It wasn't a good idea to have in the first place: - It only ever worked in certain random circumstances (e.g. worker returning an unparseable protobuf, but not when it crashed). - No other strategy implements a behavior like this. - Confusing to users and hard to describe what use case this is good for. - Complex and error prone code. Part of #2855. RELNOTES: The flag --worker_max_retries was removed. The WorkerSpawnStrategy no longer retries execution of failed Spawns, the reason being that this just masks compiler bugs and isn't done for any other execution strategy either. PiperOrigin-RevId: 154422561
* Use the new ErrorMessage class in WorkerTestStrategy. Also adds a nullGravatar philwo2017-04-28
| | | | | | | | check for the response and shows a helpful error message in that case. Part of #2855. PiperOrigin-RevId: 154416882
* Use the RecordingInputStream from the WorkerSpawnStrategy in the ↵Gravatar kush2017-04-25
| | | | | | | WorkerTestStrategy as well, to better log errors. RELNOTES: None PiperOrigin-RevId: 154080821
* Change the tag experimental_testrunner into a couple of flags.Gravatar kush2017-03-31
| | | | | | | | | | | | | | | 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
* Prevent users from using the WorkerTestStrategy unless they're running with ↵Gravatar Kush Chakraborty2017-03-09
| | | | | | | | the ExperimentalTestRunner. -- PiperOrigin-RevId: 149636903 MOS_MIGRATED_REVID=149636903
* Bring back the persistent test runner functionality, on ExperimentalTestRunner.Gravatar Kush Chakraborty2017-03-09
| | | | | | | | This is essentially a rollforward of commit 7d0561b6ca92d72bd8767d4dca50e5437976812c, and changes triggering the perisitent runner using an environment variable instead of argument as suggested in commit 7d0561b6ca92d72bd8767d4dca50e5437976812c -- PiperOrigin-RevId: 149540564 MOS_MIGRATED_REVID=149540564
* Rewrite TestStrategy.getArgsGravatar Ulf Adams2017-03-06
| | | | | | | | | | | | | | | | | | | | | | This changes command-line computation for tests: - run the coverage collector before the run_under command - no shell escaping: if all tools just call "$@", then this should work Note that we still wrap the command in a sub-shell to support shell built-ins and PATH lookup if the command does not contain a slash character '/'. A side effect of this change is that the --run_under command now executes in the test's runfiles directory, rather than in the exec root, if coverage is enabled at the same time. Inside Google, it's very rare for --run_under to be used in combination with coverage, and it seems likely to be rare externally as well, so I don't think it warrants covering it in the release notes. Also set TEST_BINARY to the root-relative path of the test executable for all tests (in TestRunnerAction.java). -- PiperOrigin-RevId: 149275688 MOS_MIGRATED_REVID=149275688
* Rollback of commit 786cfa2ed980e278c42ee474408844f7e3720385.Gravatar Kush Chakraborty2017-02-24
| | | | | | | | | | | | | | | | | | | | *** Reason for rollback *** Breaks dagger []: [] *** Original change description *** Separate the classpaths of the TestRunner with the test target, and use a separate Classloader to load the test target's classes. This enables a clean separation of the classes of the TestRunner with the target under test. This is achieved with the following steps: 1. Start the test runner with only the bare bones classpaths to the Test Runner's classes which are used by the system ClassLoader. 2. Have all the classpaths required to load the test target's classes in a TEST_TARGET_CLASSPATH envi... *** -- PiperOrigin-RevId: 148405598 MOS_MIGRATED_REVID=148405598
* Separate the classpaths of the TestRunner with the test target, and use a ↵Gravatar Kush Chakraborty2017-02-23
| | | | | | | | | | | | | | | | | | | | | | separate Classloader to load the test target's classes. This enables a clean separation of the classes of the TestRunner with the target under test. This is achieved with the following steps: 1. Start the test runner with only the bare bones classpaths to the Test Runner's classes which are used by the system ClassLoader. 2. Have all the classpaths required to load the test target's classes in a TEST_TARGET_CLASSPATH environment variable exported by the stub script. 3. Use a new classloader to load all the test target's classes using the paths in TEST_TARGET_CLASSPATH. This additionally enables the persistent test runner (currently experimental), to reload all the target's classes for every subsequent test run, so it can pick up any changes to the classes in between runs. The persistent test runner can be used by adding the argument --test_strategy=experimental_worker to the bazel test command. Tested this against: 1. gerrit/gerrit-common:client_tests: Dismal avg. improvement of 580ms to 557ms (just 23ms) 2. intellij/intellij/base:unit_tests: Somewhat modest avg. improvement 1661ms to 913ms (748 ms) RELNOTES: 1) Java tests and suites will now have to explicitly declare JUnit dependency 2) All non-legacy java_tests will now be run in a -- PiperOrigin-RevId: 148309979 MOS_MIGRATED_REVID=148309979
* Rollback of commit 1cb5059396e46d9ff2c317b8a0a046af32b3a1d8.Gravatar Ulf Adams2017-02-20
| | | | | | | | | | | | | | | | | | | | | | | | | | *** Reason for rollback *** Breaks TEST_BINARY env setting if --run_under is used. *** Original change description *** Rewrite TestStrategy.getArgs This changes command-line computation for tests: - run the coverage collector before the run_under command - no shell escaping: if all tools just call "$@", then this should work Note that we still wrap the command in a sub-shell to support shell built-ins and PATH lookup if the command does not contain a slash character '/'. A side effect of this change is that the --run_under command now executes in the test's runfiles directory, rather than in the exec root, if... *** -- PiperOrigin-RevId: 148003525 MOS_MIGRATED_REVID=148003525
* Rewrite TestStrategy.getArgsGravatar Ulf Adams2017-02-17
| | | | | | | | | | | | | | | | | | | This changes command-line computation for tests: - run the coverage collector before the run_under command - no shell escaping: if all tools just call "$@", then this should work Note that we still wrap the command in a sub-shell to support shell built-ins and PATH lookup if the command does not contain a slash character '/'. A side effect of this change is that the --run_under command now executes in the test's runfiles directory, rather than in the exec root, if coverage is enabled at the same time. Inside Google, it's very rare for --run_under to be used in combination with coverage, and it seems likely to be rare externally as well, so I don't think it warrants covering it in the release notes. -- PiperOrigin-RevId: 147815017 MOS_MIGRATED_REVID=147815017
* Remove the first argument of TestStrategy.getArgs.Gravatar Ulf Adams2017-02-09
| | | | | | | | | All callers were performing identical steps before calling getArgs - move the functionality into getArgs instead. -- PiperOrigin-RevId: 147028753 MOS_MIGRATED_REVID=147028753
* Throw an exception when persistent workers are used to run tests with ↵Gravatar Kush Chakraborty2017-02-01
| | | | | | | | use_testrunner=0 -- PiperOrigin-RevId: 146150454 MOS_MIGRATED_REVID=146150454
* Refactor StandaloneTestStrategy; tiny step towards test strategy unification.Gravatar Ulf Adams2017-01-10
| | | | | | | | | | Create the test spawn upfront instead of lazily. In the common case, this doesn't cost anything, but the worker test strategy doesn't use the spawn right now. -- PiperOrigin-RevId: 144086321 MOS_MIGRATED_REVID=144086321
* Continued TestStrategy refactoring.Gravatar Ulf Adams2016-12-16
| | | | | | | | | More renaming and some reformatting to make StandaloneTestStrategy more closely resemble the internal implementation of TestStrategy. -- PiperOrigin-RevId: 142254302 MOS_MIGRATED_REVID=142254302
* Move TestStrategy to lib.exec package.Gravatar Ulf Adams2016-12-15
| | | | | | | | | | | | | | | | This is part of refactoring test strategy to unify its implementation between Bazel and Blaze (Google's internal version of Bazel), which should fix several issues in Bazel. It's also necessary to untangle lib.rules and lib.exec to enforce proper layering by separating compilation of these packages, and to provide a minimal Bazel binary. In particular, no core part of Bazel should depend on any of the rules, to facilitate moving them out of Bazel / reimplementing them in Skylark (except for some core rules like test_suite, alias, and genquery). -- PiperOrigin-RevId: 142151901 MOS_MIGRATED_REVID=142151901
* Initial code for Persistent Java Test Runner.Gravatar Kush Chakraborty2016-12-09
At this point this does nothing more than re-run the exact same test without having to re-start the test runner. In future iterations the aim is to be able to re-run tests with modified code, without having to re-start the test runner. To test out the WorkerTestStrategy simply use --test_strategy=experimental_worker for a test with bazel. -- PiperOrigin-RevId: 141465929 MOS_MIGRATED_REVID=141465929