Commit e8e762a3 authored by Paweł Hajdan, Jr's avatar Paweł Hajdan, Jr

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}
parent a4b8fb8f
...@@ -186,7 +186,7 @@ class UnitTestLauncherDelegate : public TestLauncherDelegate { ...@@ -186,7 +186,7 @@ class UnitTestLauncherDelegate : public TestLauncherDelegate {
test_launcher->LaunchChildGTestProcess( test_launcher->LaunchChildGTestProcess(
cmd_line, cmd_line,
std::string(), std::string(),
TestTimeouts::test_launcher_timeout(), TestTimeouts::test_launcher_unit_timeout(),
use_job_objects_ ? TestLauncher::USE_JOB_OBJECTS : 0, use_job_objects_ ? TestLauncher::USE_JOB_OBJECTS : 0,
Bind(&UnitTestLauncherDelegate::SerialGTestCallback, Bind(&UnitTestLauncherDelegate::SerialGTestCallback,
Unretained(this), Unretained(this),
...@@ -218,7 +218,7 @@ class UnitTestLauncherDelegate : public TestLauncherDelegate { ...@@ -218,7 +218,7 @@ class UnitTestLauncherDelegate : public TestLauncherDelegate {
// Note: do NOT parse child's stdout to do that, it's known to be // 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). // unreliable (e.g. buffering issues can mix up the output).
base::TimeDelta timeout = base::TimeDelta timeout =
test_names.size() * TestTimeouts::test_launcher_timeout(); test_names.size() * TestTimeouts::test_launcher_unit_timeout();
GTestCallbackState callback_state; GTestCallbackState callback_state;
callback_state.test_launcher = test_launcher; callback_state.test_launcher = test_launcher;
...@@ -345,7 +345,7 @@ class UnitTestLauncherDelegate : public TestLauncherDelegate { ...@@ -345,7 +345,7 @@ class UnitTestLauncherDelegate : public TestLauncherDelegate {
// For consistent handling of tests independent of order and other // For consistent handling of tests independent of order and other
// factors, mark them as timing out. // factors, mark them as timing out.
if (test_result.elapsed_time > if (test_result.elapsed_time >
TestTimeouts::test_launcher_timeout()) { TestTimeouts::test_launcher_unit_timeout()) {
test_result.status = TestResult::TEST_TIMEOUT; test_result.status = TestResult::TEST_TIMEOUT;
} }
} }
......
...@@ -50,6 +50,7 @@ const char switches::kTestLauncherTotalShards[] = ...@@ -50,6 +50,7 @@ const char switches::kTestLauncherTotalShards[] =
// Time (in milliseconds) that the tests should wait before timing out. // Time (in milliseconds) that the tests should wait before timing out.
const char switches::kTestLauncherTimeout[] = "test-launcher-timeout"; const char switches::kTestLauncherTimeout[] = "test-launcher-timeout";
const char switches::kTestLauncherUnitTimeout[] = "test-launcher-unit-timeout";
// TODO(phajdan.jr): Clean up the switch names. // TODO(phajdan.jr): Clean up the switch names.
const char switches::kTestTinyTimeout[] = "test-tiny-timeout"; const char switches::kTestTinyTimeout[] = "test-tiny-timeout";
const char switches::kUiTestActionTimeout[] = "ui-test-action-timeout"; const char switches::kUiTestActionTimeout[] = "ui-test-action-timeout";
......
...@@ -21,6 +21,7 @@ extern const char kTestLauncherPrintTestStdio[]; ...@@ -21,6 +21,7 @@ extern const char kTestLauncherPrintTestStdio[];
extern const char kTestLauncherShardIndex[]; extern const char kTestLauncherShardIndex[];
extern const char kTestLauncherTotalShards[]; extern const char kTestLauncherTotalShards[];
extern const char kTestLauncherTimeout[]; extern const char kTestLauncherTimeout[];
extern const char kTestLauncherUnitTimeout[];
extern const char kTestTinyTimeout[]; extern const char kTestTinyTimeout[];
extern const char kUiTestActionTimeout[]; extern const char kUiTestActionTimeout[];
extern const char kUiTestActionMaxTimeout[]; extern const char kUiTestActionMaxTimeout[];
......
...@@ -72,6 +72,7 @@ int TestTimeouts::action_max_timeout_ms_ = 45000; ...@@ -72,6 +72,7 @@ int TestTimeouts::action_max_timeout_ms_ = 45000;
int TestTimeouts::action_max_timeout_ms_ = 30000; int TestTimeouts::action_max_timeout_ms_ = 30000;
#endif // NDEBUG #endif // NDEBUG
int TestTimeouts::test_launcher_unit_timeout_ms_ = 5000;
int TestTimeouts::test_launcher_timeout_ms_ = 45000; int TestTimeouts::test_launcher_timeout_ms_ = 45000;
// static // static
...@@ -98,12 +99,16 @@ void TestTimeouts::Initialize() { ...@@ -98,12 +99,16 @@ void TestTimeouts::Initialize() {
&action_max_timeout_ms_); &action_max_timeout_ms_);
// Test launcher timeout is independent from anything above action timeout. // 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_); &test_launcher_timeout_ms_);
// The timeout values should be increasing in the right order. // The timeout values should be increasing in the right order.
CHECK(tiny_timeout_ms_ <= action_timeout_ms_); CHECK(tiny_timeout_ms_ <= action_timeout_ms_);
CHECK(action_timeout_ms_ <= action_max_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_);
} }
...@@ -38,7 +38,14 @@ class TestTimeouts { ...@@ -38,7 +38,14 @@ class TestTimeouts {
return base::TimeDelta::FromMilliseconds(action_max_timeout_ms_); 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. // Do not use outside of the test launcher.
static base::TimeDelta test_launcher_timeout() { static base::TimeDelta test_launcher_timeout() {
DCHECK(initialized_); DCHECK(initialized_);
...@@ -51,6 +58,7 @@ class TestTimeouts { ...@@ -51,6 +58,7 @@ class TestTimeouts {
static int tiny_timeout_ms_; static int tiny_timeout_ms_;
static int action_timeout_ms_; static int action_timeout_ms_;
static int action_max_timeout_ms_; static int action_max_timeout_ms_;
static int test_launcher_unit_timeout_ms_;
static int test_launcher_timeout_ms_; static int test_launcher_timeout_ms_;
DISALLOW_IMPLICIT_CONSTRUCTORS(TestTimeouts); DISALLOW_IMPLICIT_CONSTRUCTORS(TestTimeouts);
......
...@@ -207,26 +207,33 @@ static void RunDemuxerBenchmark(const std::string& filename) { ...@@ -207,26 +207,33 @@ static void RunDemuxerBenchmark(const std::string& filename) {
true); true);
} }
#if defined(OS_WIN) class DemuxerPerfTest : public testing::TestWithParam<const char*> {
// http://crbug.com/399002 };
#define MAYBE_Demuxer DISABLED_Demuxer
#else const char* kDemuxerBenchmarks[] = {
#define MAYBE_Demuxer Demuxer "bear.ogv",
#endif "bear-640x360.webm",
TEST(DemuxerPerfTest, MAYBE_Demuxer) { "sfx_s16le.wav",
RunDemuxerBenchmark("bear.ogv");
RunDemuxerBenchmark("bear-640x360.webm");
RunDemuxerBenchmark("sfx_s16le.wav");
#if defined(USE_PROPRIETARY_CODECS) #if defined(USE_PROPRIETARY_CODECS)
RunDemuxerBenchmark("bear-1280x720.mp4"); "bear-1280x720.mp4",
RunDemuxerBenchmark("sfx.mp3"); "sfx.mp3",
#endif #endif
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
RunDemuxerBenchmark("bear.flac"); "bear.flac",
#endif #endif
#if defined(USE_PROPRIETARY_CODECS) && defined(OS_CHROMEOS) #if defined(USE_PROPRIETARY_CODECS) && defined(OS_CHROMEOS)
RunDemuxerBenchmark("bear.avi"); "bear.avi",
#endif #endif
};
TEST_P(DemuxerPerfTest, Demuxer) {
RunDemuxerBenchmark(GetParam());
} }
#if !defined(OS_WIN)
// http://crbug.com/399002
INSTANTIATE_TEST_CASE_P(, DemuxerPerfTest,
testing::ValuesIn(kDemuxerBenchmarks));
#endif // !defined(OS_WIN)
} // namespace media } // namespace media
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment