summaryrefslogtreecommitdiffstats
path: root/base/test
diff options
context:
space:
mode:
authorPaweł Hajdan, Jr <phajdan.jr@chromium.org>2014-08-25 14:39:29 +0200
committerPaweł Hajdan, Jr <phajdan.jr@chromium.org>2014-08-25 12:40:59 +0000
commite8e762a3d4f51fc5d765cf23dd8d3f7d138d779c (patch)
tree8d21f3c4a0f13aa1e4f587d4387eaba5c99c8117 /base/test
parenta4b8fb8fdb4580f847e54e1e59419aa8182809e7 (diff)
downloadchromium_src-e8e762a3d4f51fc5d765cf23dd8d3f7d138d779c.zip
chromium_src-e8e762a3d4f51fc5d765cf23dd8d3f7d138d779c.tar.gz
chromium_src-e8e762a3d4f51fc5d765cf23dd8d3f7d138d779c.tar.bz2
Implement unit test specific test launcher timeout
BUG=402213 R=dalecurtis@chromium.org, jam@chromium.org Review URL: https://codereview.chromium.org/476543004 Cr-Commit-Position: refs/heads/master@{#291673}
Diffstat (limited to 'base/test')
-rw-r--r--base/test/launcher/unit_test_launcher.cc6
-rw-r--r--base/test/test_switches.cc1
-rw-r--r--base/test/test_switches.h1
-rw-r--r--base/test/test_timeouts.cc9
-rw-r--r--base/test/test_timeouts.h10
5 files changed, 21 insertions, 6 deletions
diff --git a/base/test/launcher/unit_test_launcher.cc b/base/test/launcher/unit_test_launcher.cc
index 0cbae2f..57552e0 100644
--- a/base/test/launcher/unit_test_launcher.cc
+++ b/base/test/launcher/unit_test_launcher.cc
@@ -186,7 +186,7 @@ class UnitTestLauncherDelegate : public TestLauncherDelegate {
test_launcher->LaunchChildGTestProcess(
cmd_line,
std::string(),
- TestTimeouts::test_launcher_timeout(),
+ TestTimeouts::test_launcher_unit_timeout(),
use_job_objects_ ? TestLauncher::USE_JOB_OBJECTS : 0,
Bind(&UnitTestLauncherDelegate::SerialGTestCallback,
Unretained(this),
@@ -218,7 +218,7 @@ class UnitTestLauncherDelegate : public TestLauncherDelegate {
// Note: do NOT parse child's stdout to do that, it's known to be
// unreliable (e.g. buffering issues can mix up the output).
base::TimeDelta timeout =
- test_names.size() * TestTimeouts::test_launcher_timeout();
+ test_names.size() * TestTimeouts::test_launcher_unit_timeout();
GTestCallbackState callback_state;
callback_state.test_launcher = test_launcher;
@@ -345,7 +345,7 @@ class UnitTestLauncherDelegate : public TestLauncherDelegate {
// For consistent handling of tests independent of order and other
// factors, mark them as timing out.
if (test_result.elapsed_time >
- TestTimeouts::test_launcher_timeout()) {
+ TestTimeouts::test_launcher_unit_timeout()) {
test_result.status = TestResult::TEST_TIMEOUT;
}
}
diff --git a/base/test/test_switches.cc b/base/test/test_switches.cc
index c970fd2..b23538c 100644
--- a/base/test/test_switches.cc
+++ b/base/test/test_switches.cc
@@ -50,6 +50,7 @@ const char switches::kTestLauncherTotalShards[] =
// Time (in milliseconds) that the tests should wait before timing out.
const char switches::kTestLauncherTimeout[] = "test-launcher-timeout";
+const char switches::kTestLauncherUnitTimeout[] = "test-launcher-unit-timeout";
// TODO(phajdan.jr): Clean up the switch names.
const char switches::kTestTinyTimeout[] = "test-tiny-timeout";
const char switches::kUiTestActionTimeout[] = "ui-test-action-timeout";
diff --git a/base/test/test_switches.h b/base/test/test_switches.h
index c228cf0..b7d0860 100644
--- a/base/test/test_switches.h
+++ b/base/test/test_switches.h
@@ -21,6 +21,7 @@ extern const char kTestLauncherPrintTestStdio[];
extern const char kTestLauncherShardIndex[];
extern const char kTestLauncherTotalShards[];
extern const char kTestLauncherTimeout[];
+extern const char kTestLauncherUnitTimeout[];
extern const char kTestTinyTimeout[];
extern const char kUiTestActionTimeout[];
extern const char kUiTestActionMaxTimeout[];
diff --git a/base/test/test_timeouts.cc b/base/test/test_timeouts.cc
index 7392450..92bcf9b 100644
--- a/base/test/test_timeouts.cc
+++ b/base/test/test_timeouts.cc
@@ -72,6 +72,7 @@ int TestTimeouts::action_max_timeout_ms_ = 45000;
int TestTimeouts::action_max_timeout_ms_ = 30000;
#endif // NDEBUG
+int TestTimeouts::test_launcher_unit_timeout_ms_ = 5000;
int TestTimeouts::test_launcher_timeout_ms_ = 45000;
// static
@@ -98,12 +99,16 @@ void TestTimeouts::Initialize() {
&action_max_timeout_ms_);
// Test launcher timeout is independent from anything above action timeout.
- InitializeTimeout(switches::kTestLauncherTimeout, action_timeout_ms_,
+ InitializeTimeout(switches::kTestLauncherUnitTimeout, action_timeout_ms_,
+ &test_launcher_unit_timeout_ms_);
+ InitializeTimeout(switches::kTestLauncherTimeout,
+ test_launcher_unit_timeout_ms_,
&test_launcher_timeout_ms_);
// The timeout values should be increasing in the right order.
CHECK(tiny_timeout_ms_ <= action_timeout_ms_);
CHECK(action_timeout_ms_ <= action_max_timeout_ms_);
- CHECK(action_timeout_ms_ <= test_launcher_timeout_ms_);
+ CHECK(action_timeout_ms_ <= test_launcher_unit_timeout_ms_);
+ CHECK(test_launcher_unit_timeout_ms_ <= test_launcher_timeout_ms_);
}
diff --git a/base/test/test_timeouts.h b/base/test/test_timeouts.h
index 2819e4a..5f79264 100644
--- a/base/test/test_timeouts.h
+++ b/base/test/test_timeouts.h
@@ -38,7 +38,14 @@ class TestTimeouts {
return base::TimeDelta::FromMilliseconds(action_max_timeout_ms_);
}
- // Timeout for a single test launched used built-in test launcher.
+ // Timeout for a single unit test launched using built-in test launcher.
+ // Do not use outside of the test launcher.
+ static base::TimeDelta test_launcher_unit_timeout() {
+ DCHECK(initialized_);
+ return base::TimeDelta::FromMilliseconds(test_launcher_unit_timeout_ms_);
+ }
+
+ // Timeout for a single test launched using built-in test launcher.
// Do not use outside of the test launcher.
static base::TimeDelta test_launcher_timeout() {
DCHECK(initialized_);
@@ -51,6 +58,7 @@ class TestTimeouts {
static int tiny_timeout_ms_;
static int action_timeout_ms_;
static int action_max_timeout_ms_;
+ static int test_launcher_unit_timeout_ms_;
static int test_launcher_timeout_ms_;
DISALLOW_IMPLICIT_CONSTRUCTORS(TestTimeouts);