summaryrefslogtreecommitdiffstats
path: root/chrome/test
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-04 16:42:32 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-04 16:42:32 +0000
commitd5078dcbb7a8403c50995c1c486546cd3103dbdd (patch)
tree1274839405a2ddfbd8043b7d6d25be8ada7d0ec1 /chrome/test
parenta263f4091acb8d3f85fc4a246857cb3c85b5007c (diff)
downloadchromium_src-d5078dcbb7a8403c50995c1c486546cd3103dbdd.zip
chromium_src-d5078dcbb7a8403c50995c1c486546cd3103dbdd.tar.gz
chromium_src-d5078dcbb7a8403c50995c1c486546cd3103dbdd.tar.bz2
Implement a command-line switch to control the out-of-process
test termination timeout. Usually when running in Valgrind and other tools that slow down the execution, we want to increase the timeouts. TEST=none BUG=41965 Review URL: http://codereview.chromium.org/1942001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46354 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r--chrome/test/test_launcher/out_of_proc_test_runner.cc18
1 files changed, 15 insertions, 3 deletions
diff --git a/chrome/test/test_launcher/out_of_proc_test_runner.cc b/chrome/test/test_launcher/out_of_proc_test_runner.cc
index 4d929a9..23aa631 100644
--- a/chrome/test/test_launcher/out_of_proc_test_runner.cc
+++ b/chrome/test/test_launcher/out_of_proc_test_runner.cc
@@ -19,12 +19,13 @@ const char kGTestListTestsFlag[] = "gtest_list_tests";
const char kGTestHelpFlag[] = "gtest_help";
const char kSingleProcessFlag[] = "single-process";
const char kSingleProcessAltFlag[] = "single_process";
+const char kTestTerminateTimeoutFlag[] = "test-terminate-timeout";
// The following is kept for historical reasons (so people that are used to
// using it don't get surprised).
const char kChildProcessFlag[] = "child";
const char kHelpFlag[] = "help";
-const int64 kTestTimeoutMs = 30000;
+const int64 kDefaultTestTimeoutMs = 30000;
class OutOfProcTestRunner : public tests::TestRunner {
public:
@@ -58,10 +59,19 @@ class OutOfProcTestRunner : public tests::TestRunner {
if (!base::LaunchApp(new_cmd_line, false, false, &process_handle))
return false;
+ int test_terminate_timeout_ms = kDefaultTestTimeoutMs;
+ if (cmd_line->HasSwitch(kTestTerminateTimeoutFlag)) {
+ std::wstring timeout_str(
+ cmd_line->GetSwitchValue(kTestTerminateTimeoutFlag));
+ int timeout = StringToInt(WideToUTF16Hack(timeout_str));
+ test_terminate_timeout_ms = std::max(test_terminate_timeout_ms, timeout);
+ }
+
int exit_code = 0;
if (!base::WaitForExitCodeWithTimeout(process_handle, &exit_code,
- kTestTimeoutMs)) {
- LOG(ERROR) << "Test timeout exceeded!";
+ test_terminate_timeout_ms)) {
+ LOG(ERROR) << "Test timeout (" << test_terminate_timeout_ms
+ << " ms) exceeded!";
exit_code = -1; // Set a non-zero exit code to signal a failure.
@@ -93,6 +103,8 @@ void PrintUsage() {
" its own process.\nAny gtest flags can be specified.\n"
" --single_process\n Runs the tests and the launcher in the same "
"process. Useful for debugging a\n specific test in a debugger\n "
+ "--test-terminate-timeout\n Specifies a timeout (in milliseconds) "
+ "after which a running test will be\n forcefully terminated\n "
"--help\n Shows this message.\n --gtest_help\n Shows the gtest "
"help message\n");
}