summaryrefslogtreecommitdiffstats
path: root/chrome/test
diff options
context:
space:
mode:
authorjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-19 23:58:14 +0000
committerjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-19 23:58:14 +0000
commit28b08d00fdd75868cdad078077059e80931a7d81 (patch)
treeea8ecff3766674b517465cce2498733c520169c9 /chrome/test
parent8090ab7bf06c16484a63439976d6fd03b9d4b0fe (diff)
downloadchromium_src-28b08d00fdd75868cdad078077059e80931a7d81.zip
chromium_src-28b08d00fdd75868cdad078077059e80931a7d81.tar.gz
chromium_src-28b08d00fdd75868cdad078077059e80931a7d81.tar.bz2
Making the browser tests run out-of-process on Windows.
Windows was the only platform where they were run in-process. Arguably running out-of-proc is more stable (a test that crashes won't crash the entire test suite run). I timed in-proc/out-of-proc runs, the out-of-proc is also slightly faster. This as the added benefit that we don't need the --lib flag anymore. This CL also adds usage and fixes the --help flag. BUG=27677 TEST=Make sure browser tests run well on Windows. Try using the --help flag, the --gtest_help flag and a combination of --gtest_filter and --single-process. Review URL: http://codereview.chromium.org/402061 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32570 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r--chrome/test/test_launcher/out_of_proc_test_runner.cc33
1 files changed, 30 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 e6f861b..32fb66c 100644
--- a/chrome/test/test_launcher/out_of_proc_test_runner.cc
+++ b/chrome/test/test_launcher/out_of_proc_test_runner.cc
@@ -16,7 +16,13 @@
namespace {
const char kGTestListTestsFlag[] = "gtest_list_tests";
+const char kGTestHelpFlag[] = "gtest_help";
+const char kSingleProcessFlag[] = "single-process";
+const char kSingleProcessAltFlag[] = "single_process";
+// 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";
class OutOfProcTestRunner : public tests::TestRunner {
public:
@@ -39,6 +45,7 @@ class OutOfProcTestRunner : public tests::TestRunner {
#else
CommandLine new_cmd_line(cmd_line->argv());
#endif
+
// Always enable disabled tests. This method is not called with disabled
// tests unless this flag was specified to the browser test executable.
new_cmd_line.AppendSwitch("gtest_also_run_disabled_tests");
@@ -74,18 +81,38 @@ class OutOfProcTestRunnerFactory : public tests::TestRunnerFactory {
DISALLOW_COPY_AND_ASSIGN(OutOfProcTestRunnerFactory);
};
+void PrintUsage() {
+ fprintf(stdout, "Runs tests using the gtest framework, each test being run in"
+ " 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 "
+ "--help\n Shows this message.\n --gtest_help\n Shows the gtest "
+ "help message\n");
+}
+
} // namespace
int main(int argc, char** argv) {
CommandLine::Init(argc, argv);
const CommandLine* command_line = CommandLine::ForCurrentProcess();
- if (command_line->HasSwitch(kChildProcessFlag))
- return ChromeTestSuite(argc, argv).Run();
+ if (command_line->HasSwitch(kHelpFlag)) {
+ PrintUsage();
+ return 0;
+ }
- if (command_line->HasSwitch(kGTestListTestsFlag))
+ if (command_line->HasSwitch(kChildProcessFlag) ||
+ command_line->HasSwitch(kSingleProcessFlag) ||
+ command_line->HasSwitch(kSingleProcessAltFlag) ||
+ command_line->HasSwitch(kGTestListTestsFlag) ||
+ command_line->HasSwitch(kGTestHelpFlag)) {
return ChromeTestSuite(argc, argv).Run();
+ }
+ fprintf(stdout,
+ "Starting tests...\nIMPORTANT DEBUGGING NOTE: each test is run inside"
+ " its own process.\nFor debugging a test inside a debugger, use the "
+ "--single-process and\n--gtest_filter=<your_test_name> flags.\n");
OutOfProcTestRunnerFactory test_runner_factory;
return tests::RunTests(test_runner_factory) ? 0 : 1;
}