aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/test')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/test/StandaloneTestStrategy.java5
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/test/TestTargetProperties.java17
2 files changed, 13 insertions, 9 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/test/StandaloneTestStrategy.java b/src/main/java/com/google/devtools/build/lib/rules/test/StandaloneTestStrategy.java
index 72970a83ae..d0ff9573fc 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/test/StandaloneTestStrategy.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/test/StandaloneTestStrategy.java
@@ -86,7 +86,7 @@ public class StandaloneTestStrategy extends TestStrategy {
Spawn spawn = new BaseSpawn(getArgs(action), env,
action.getTestProperties().getExecutionInfo(),
action,
- action.getTestProperties().getLocalResourceUsage());
+ action.getTestProperties().getLocalResourceUsage(executionOptions.usingLocalTestJobs()));
Executor executor = actionExecutionContext.getExecutor();
@@ -97,7 +97,8 @@ public class StandaloneTestStrategy extends TestStrategy {
fileOutErr = new FileOutErr(action.getTestLog().getPath(),
action.resolve(actionExecutionContext.getExecutor().getExecRoot()).getTestStderr());
- resources = action.getTestProperties().getLocalResourceUsage();
+ resources = action.getTestProperties()
+ .getLocalResourceUsage(executionOptions.usingLocalTestJobs());
ResourceManager.instance().acquireResources(action, resources);
TestResultData data = execute(
actionExecutionContext.withFileOutErr(fileOutErr), spawn, action);
diff --git a/src/main/java/com/google/devtools/build/lib/rules/test/TestTargetProperties.java b/src/main/java/com/google/devtools/build/lib/rules/test/TestTargetProperties.java
index 0834ca9464..0e0befc4d2 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/test/TestTargetProperties.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/test/TestTargetProperties.java
@@ -38,11 +38,12 @@ public class TestTargetProperties {
/**
* Resources used by local tests of various sizes.
*/
- private static final ResourceSet SMALL_RESOURCES = ResourceSet.createWithRamCpuIo(20, 0.9, 0.00);
- private static final ResourceSet MEDIUM_RESOURCES = ResourceSet.createWithRamCpuIo(100, 0.9, 0.1);
- private static final ResourceSet LARGE_RESOURCES = ResourceSet.createWithRamCpuIo(300, 0.8, 0.1);
- private static final ResourceSet ENORMOUS_RESOURCES =
- ResourceSet.createWithRamCpuIo(800, 0.7, 0.4);
+ private static final ResourceSet SMALL_RESOURCES = ResourceSet.create(20, 0.9, 0.00, 1);
+ private static final ResourceSet MEDIUM_RESOURCES = ResourceSet.create(100, 0.9, 0.1, 1);
+ private static final ResourceSet LARGE_RESOURCES = ResourceSet.create(300, 0.8, 0.1, 1);
+ private static final ResourceSet ENORMOUS_RESOURCES = ResourceSet.create(800, 0.7, 0.4, 1);
+ private static final ResourceSet LOCAL_TEST_JOBS_BASED_RESOURCES =
+ ResourceSet.createWithLocalTestCount(1);
private static ResourceSet getResourceSetFromSize(TestSize size) {
switch (size) {
@@ -115,8 +116,10 @@ public class TestTargetProperties {
return isExternal;
}
- public ResourceSet getLocalResourceUsage() {
- return TestTargetProperties.getResourceSetFromSize(size);
+ public ResourceSet getLocalResourceUsage(boolean usingLocalTestJobs) {
+ return usingLocalTestJobs
+ ? LOCAL_TEST_JOBS_BASED_RESOURCES
+ : TestTargetProperties.getResourceSetFromSize(size);
}
/**