OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <string> | 5 #include <string> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
10 | 10 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 return new OutOfProcTestRunner(); | 77 return new OutOfProcTestRunner(); |
78 } | 78 } |
79 | 79 |
80 private: | 80 private: |
81 DISALLOW_COPY_AND_ASSIGN(OutOfProcTestRunnerFactory); | 81 DISALLOW_COPY_AND_ASSIGN(OutOfProcTestRunnerFactory); |
82 }; | 82 }; |
83 | 83 |
84 void PrintUsage() { | 84 void PrintUsage() { |
85 fprintf(stdout, "Runs tests using the gtest framework, each test being run in" | 85 fprintf(stdout, "Runs tests using the gtest framework, each test being run in" |
86 " its own process.\nAny gtest flags can be specified.\n" | 86 " its own process.\nAny gtest flags can be specified.\n" |
87 " --single-process\n Runs the tests and the launcher in the same " | 87 " --single_process\n Runs the tests and the launcher in the same " |
88 "process. Useful for debugging a\n specific test in a debugger\n " | 88 "process. Useful for debugging a\n specific test in a debugger\n " |
89 "--help\n Shows this message.\n --gtest_help\n Shows the gtest " | 89 "--help\n Shows this message.\n --gtest_help\n Shows the gtest " |
90 "help message\n"); | 90 "help message\n"); |
91 } | 91 } |
92 | 92 |
93 } // namespace | 93 } // namespace |
94 | 94 |
95 int main(int argc, char** argv) { | 95 int main(int argc, char** argv) { |
96 CommandLine::Init(argc, argv); | 96 CommandLine::Init(argc, argv); |
97 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 97 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
98 | 98 |
99 if (command_line->HasSwitch(kHelpFlag)) { | 99 if (command_line->HasSwitch(kHelpFlag)) { |
100 PrintUsage(); | 100 PrintUsage(); |
101 return 0; | 101 return 0; |
102 } | 102 } |
103 | 103 |
| 104 if (command_line->HasSwitch(kSingleProcessFlag)) { |
| 105 fprintf(stdout, |
| 106 "\n Did you mean --%s instead? (note underscore)\n\n", |
| 107 kSingleProcessAltFlag); |
| 108 } |
| 109 |
104 if (command_line->HasSwitch(kChildProcessFlag) || | 110 if (command_line->HasSwitch(kChildProcessFlag) || |
105 command_line->HasSwitch(kSingleProcessFlag) || | 111 command_line->HasSwitch(kSingleProcessFlag) || |
106 command_line->HasSwitch(kSingleProcessAltFlag) || | 112 command_line->HasSwitch(kSingleProcessAltFlag) || |
107 command_line->HasSwitch(kGTestListTestsFlag) || | 113 command_line->HasSwitch(kGTestListTestsFlag) || |
108 command_line->HasSwitch(kGTestHelpFlag)) { | 114 command_line->HasSwitch(kGTestHelpFlag)) { |
109 return ChromeTestSuite(argc, argv).Run(); | 115 return ChromeTestSuite(argc, argv).Run(); |
110 } | 116 } |
111 | 117 |
112 fprintf(stdout, | 118 fprintf(stdout, |
113 "Starting tests...\nIMPORTANT DEBUGGING NOTE: each test is run inside" | 119 "Starting tests...\nIMPORTANT DEBUGGING NOTE: each test is run inside" |
114 " its own process.\nFor debugging a test inside a debugger, use the " | 120 " its own process.\nFor debugging a test inside a debugger, use the " |
115 "--single-process and\n--gtest_filter=<your_test_name> flags.\n"); | 121 "--single_process and\n--gtest_filter=<your_test_name> flags.\n"); |
116 OutOfProcTestRunnerFactory test_runner_factory; | 122 OutOfProcTestRunnerFactory test_runner_factory; |
117 return tests::RunTests(test_runner_factory) ? 0 : 1; | 123 return tests::RunTests(test_runner_factory) ? 0 : 1; |
118 } | 124 } |
OLD | NEW |