aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/test/java/com/google/devtools/build/lib/exec/local/LocalSpawnRunnerTest.java14
-rw-r--r--src/test/java/com/google/devtools/build/lib/shell/CommandUsingProcessWrapperTest.java8
-rw-r--r--src/test/java/com/google/devtools/build/lib/shell/ExecutionStatisticsTestUtil.java4
-rwxr-xr-xsrc/test/shell/integration/linux-sandbox_test.sh6
-rwxr-xr-xsrc/test/shell/integration/process-wrapper_test.sh6
-rw-r--r--src/test/shell/integration/spend_cpu_time.cc4
6 files changed, 19 insertions, 23 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/exec/local/LocalSpawnRunnerTest.java b/src/test/java/com/google/devtools/build/lib/exec/local/LocalSpawnRunnerTest.java
index f503ddb547..63048fc108 100644
--- a/src/test/java/com/google/devtools/build/lib/exec/local/LocalSpawnRunnerTest.java
+++ b/src/test/java/com/google/devtools/build/lib/exec/local/LocalSpawnRunnerTest.java
@@ -815,14 +815,12 @@ public class LocalSpawnRunnerTest {
options.collectLocalExecutionStatistics = true;
Duration minimumWallTimeToSpend = Duration.ofSeconds(10);
- // Because of e.g. interference, wall time taken may be much larger than CPU time used.
- Duration maximumWallTimeToSpend = Duration.ofSeconds(40);
Duration minimumUserTimeToSpend = minimumWallTimeToSpend;
- Duration maximumUserTimeToSpend = minimumUserTimeToSpend.plus(Duration.ofSeconds(2));
+ Duration maximumUserTimeToSpend = minimumUserTimeToSpend.plus(Duration.ofSeconds(5));
Duration minimumSystemTimeToSpend = Duration.ZERO;
- Duration maximumSystemTimeToSpend = minimumSystemTimeToSpend.plus(Duration.ofSeconds(2));
+ Duration maximumSystemTimeToSpend = minimumSystemTimeToSpend.plus(Duration.ofSeconds(5));
Path execRoot = getTemporaryExecRoot(fs);
copyProcessWrapperIntoExecRoot(execRoot);
@@ -856,7 +854,7 @@ public class LocalSpawnRunnerTest {
assertThat(spawnResult.getWallTime()).isPresent();
assertThat(spawnResult.getWallTime().get()).isAtLeast(minimumWallTimeToSpend);
- assertThat(spawnResult.getWallTime().get()).isAtMost(maximumWallTimeToSpend);
+ // Under heavy starvation, max wall time could be anything, so don't check it here.
assertThat(spawnResult.getUserTime()).isPresent();
assertThat(spawnResult.getUserTime().get()).isAtLeast(minimumUserTimeToSpend);
assertThat(spawnResult.getUserTime().get()).isAtMost(maximumUserTimeToSpend);
@@ -878,9 +876,7 @@ public class LocalSpawnRunnerTest {
LocalExecutionOptions options = Options.getDefaults(LocalExecutionOptions.class);
options.collectLocalExecutionStatistics = false;
- Duration minimumWallTimeToSpend = Duration.ofSeconds(10);
- // Because of e.g. interference, wall time taken may be much larger than CPU time used.
- Duration maximumWallTimeToSpend = Duration.ofSeconds(40);
+ Duration minimumWallTimeToSpend = Duration.ofSeconds(1);
Duration minimumUserTimeToSpend = minimumWallTimeToSpend;
Duration minimumSystemTimeToSpend = Duration.ZERO;
@@ -917,7 +913,7 @@ public class LocalSpawnRunnerTest {
assertThat(spawnResult.getWallTime()).isPresent();
assertThat(spawnResult.getWallTime().get()).isAtLeast(minimumWallTimeToSpend);
- assertThat(spawnResult.getWallTime().get()).isAtMost(maximumWallTimeToSpend);
+ // Under heavy starvation, max wall time could be anything, so don't check it here.
assertThat(spawnResult.getUserTime()).isEmpty();
assertThat(spawnResult.getSystemTime()).isEmpty();
assertThat(spawnResult.getNumBlockOutputOperations()).isEmpty();
diff --git a/src/test/java/com/google/devtools/build/lib/shell/CommandUsingProcessWrapperTest.java b/src/test/java/com/google/devtools/build/lib/shell/CommandUsingProcessWrapperTest.java
index b6643914be..dbcbf48646 100644
--- a/src/test/java/com/google/devtools/build/lib/shell/CommandUsingProcessWrapperTest.java
+++ b/src/test/java/com/google/devtools/build/lib/shell/CommandUsingProcessWrapperTest.java
@@ -98,7 +98,7 @@ public final class CommandUsingProcessWrapperTest {
@Test
public void testProcessWrappedCommand_WithStatistics_SpendUserTime()
throws CommandException, IOException {
- Duration userTimeToSpend = Duration.ofSeconds(10);
+ Duration userTimeToSpend = Duration.ofSeconds(6);
Duration systemTimeToSpend = Duration.ZERO;
checkProcessWrapperStatistics(userTimeToSpend, systemTimeToSpend);
@@ -108,7 +108,7 @@ public final class CommandUsingProcessWrapperTest {
public void testProcessWrappedCommand_WithStatistics_SpendSystemTime()
throws CommandException, IOException {
Duration userTimeToSpend = Duration.ZERO;
- Duration systemTimeToSpend = Duration.ofSeconds(10);
+ Duration systemTimeToSpend = Duration.ofSeconds(6);
checkProcessWrapperStatistics(userTimeToSpend, systemTimeToSpend);
}
@@ -116,8 +116,8 @@ public final class CommandUsingProcessWrapperTest {
@Test
public void testProcessWrappedCommand_WithStatistics_SpendUserAndSystemTime()
throws CommandException, IOException {
- Duration userTimeToSpend = Duration.ofSeconds(10);
- Duration systemTimeToSpend = Duration.ofSeconds(10);
+ Duration userTimeToSpend = Duration.ofSeconds(6);
+ Duration systemTimeToSpend = Duration.ofSeconds(6);
checkProcessWrapperStatistics(userTimeToSpend, systemTimeToSpend);
}
diff --git a/src/test/java/com/google/devtools/build/lib/shell/ExecutionStatisticsTestUtil.java b/src/test/java/com/google/devtools/build/lib/shell/ExecutionStatisticsTestUtil.java
index 221cac995c..612fbf6fbf 100644
--- a/src/test/java/com/google/devtools/build/lib/shell/ExecutionStatisticsTestUtil.java
+++ b/src/test/java/com/google/devtools/build/lib/shell/ExecutionStatisticsTestUtil.java
@@ -44,9 +44,9 @@ public class ExecutionStatisticsTestUtil {
Path statisticsFilePath)
throws CommandException, IOException {
Duration userTimeLowerBound = userTimeToSpend;
- Duration userTimeUpperBound = userTimeToSpend.plusSeconds(2);
+ Duration userTimeUpperBound = userTimeToSpend.plusSeconds(5);
Duration systemTimeLowerBound = systemTimeToSpend;
- Duration systemTimeUpperBound = systemTimeToSpend.plusSeconds(2);
+ Duration systemTimeUpperBound = systemTimeToSpend.plusSeconds(5);
Command command = new Command(fullCommandLine.toArray(new String[0]));
CommandResult commandResult = command.execute();
diff --git a/src/test/shell/integration/linux-sandbox_test.sh b/src/test/shell/integration/linux-sandbox_test.sh
index f7ea4dca77..7352ab9d72 100755
--- a/src/test/shell/integration/linux-sandbox_test.sh
+++ b/src/test/shell/integration/linux-sandbox_test.sh
@@ -261,15 +261,15 @@ function assert_linux_sandbox_exec_time() {
}
function test_stats_high_user_time() {
- assert_linux_sandbox_exec_time 10 12 0 2
+ assert_linux_sandbox_exec_time 6 11 0 5
}
function test_stats_high_system_time() {
- assert_linux_sandbox_exec_time 0 2 10 12
+ assert_linux_sandbox_exec_time 0 5 6 11
}
function test_stats_high_user_time_and_high_system_time() {
- assert_linux_sandbox_exec_time 10 12 10 12
+ assert_linux_sandbox_exec_time 6 11 6 11
}
# The test shouldn't fail if the environment doesn't support running it.
diff --git a/src/test/shell/integration/process-wrapper_test.sh b/src/test/shell/integration/process-wrapper_test.sh
index ee4732ac27..1d04606a08 100755
--- a/src/test/shell/integration/process-wrapper_test.sh
+++ b/src/test/shell/integration/process-wrapper_test.sh
@@ -150,15 +150,15 @@ function assert_process_wrapper_exec_time() {
}
function test_stats_high_user_time() {
- assert_process_wrapper_exec_time 10 12 0 2
+ assert_process_wrapper_exec_time 6 11 0 5
}
function test_stats_high_system_time() {
- assert_process_wrapper_exec_time 0 2 10 12
+ assert_process_wrapper_exec_time 0 5 6 11
}
function test_stats_high_user_time_and_high_system_time() {
- assert_process_wrapper_exec_time 10 12 10 12
+ assert_process_wrapper_exec_time 6 11 6 11
}
run_suite "process-wrapper"
diff --git a/src/test/shell/integration/spend_cpu_time.cc b/src/test/shell/integration/spend_cpu_time.cc
index 636a2a1692..cc0acfaaf5 100644
--- a/src/test/shell/integration/spend_cpu_time.cc
+++ b/src/test/shell/integration/spend_cpu_time.cc
@@ -31,7 +31,7 @@ static void WasteUserTime() {
volatile_counter = 0;
while (true) {
volatile_counter++;
- if (volatile_counter == 10000000) {
+ if (volatile_counter == 1000) {
break;
}
}
@@ -50,7 +50,7 @@ static void WasteSystemTime() {
err(EXIT_FAILURE, "chdir() failed");
}
volatile_counter++;
- if (volatile_counter == 100000) {
+ if (volatile_counter == 1000) {
break;
}
}