aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/exec/TestStrategy.java
diff options
context:
space:
mode:
authorGravatar Ulf Adams <ulfjack@google.com>2017-02-01 14:47:02 +0000
committerGravatar Yun Peng <pcloudy@google.com>2017-02-01 16:36:23 +0000
commitb3c833f2ee6e6daf7cfa5c616092d10cb14bd963 (patch)
tree8c60a381d0e83dbe6bb572f4d0cc1fc6f35eb04a /src/main/java/com/google/devtools/build/lib/exec/TestStrategy.java
parent932d1abfa34267a9e5abc7441c9e2a081beedd85 (diff)
Test strategy unification - extract env setup to a new class
Introduce a new class TestPolicy that computes the test environment and use it from all the test strategies instead of the previous duplicated code. Note how the TestPolicy constructs the environment in four steps, each of which can override variables set in a previous step: 1. set env variables for which we have a hard-coded policy 2. set env variables from --action_env 3. set env variables from --test_env 4. set env variables that are specific to the test (path locations, coverage collection protocol, test sharding protocol, etc.); the code for this lives in TestRunnerAction This changes the order in which env variables are set, which can change the resulting environment if --test_env or --action_env are set. We should consider not allowing the command-line flags to override TEST_SRCDIR, RUNFILES_DIR, or TEST_TMPDIR. We should also try to find a way to drop the RUNTEST_PRESERVE_CWD variable in coverage mode. I'm fairly sure that it's current use breaks the combination of coverage and --run_under. My current thinking is that we change the test setup script to source the coverage collector before changing the CWD. Another option is to merge the coverage collector into the test setup script. -- PiperOrigin-RevId: 146237448 MOS_MIGRATED_REVID=146237448
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/exec/TestStrategy.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/exec/TestStrategy.java24
1 files changed, 0 insertions, 24 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/exec/TestStrategy.java b/src/main/java/com/google/devtools/build/lib/exec/TestStrategy.java
index a0f371c631..f84754f57f 100644
--- a/src/main/java/com/google/devtools/build/lib/exec/TestStrategy.java
+++ b/src/main/java/com/google/devtools/build/lib/exec/TestStrategy.java
@@ -152,20 +152,6 @@ public abstract class TestStrategy implements TestActionContext {
throws ExecException, InterruptedException;
/**
- * Returns mutable map of default testing shell environment. By itself it is incomplete and is
- * modified further by the specific test strategy implementations (mostly due to the fact that
- * environments used locally and remotely are different).
- */
- protected Map<String, String> getDefaultTestEnvironment(TestRunnerAction action) {
- Map<String, String> env = new HashMap<>();
-
- env.putAll(action.getConfiguration().getLocalShellEnvironment());
- env.remove("LANG");
- env.put("TZ", "UTC");
- return env;
- }
-
- /**
* Generates a command line to run for the test action, taking into account coverage and {@code
* --run_under} settings.
*
@@ -253,16 +239,6 @@ public abstract class TestStrategy implements TestActionContext {
return executionOptions.testTimeout.get(testAction.getTestProperties().getTimeout());
}
- /**
- * Returns a subset of the environment from the current shell.
- *
- * <p>Warning: Since these variables are not part of the configuration's fingerprint, they MUST
- * NOT be used by any rule or action in such a way as to affect the semantics of that build step.
- */
- public Map<String, String> getAdmissibleShellEnvironment(Iterable<String> variables) {
- return getMapping(variables, clientEnv);
- }
-
/*
* Finalize test run: persist the result, and post on the event bus.
*/