| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/test/launcher/unit_test_launcher.h" | 5 #include "base/test/launcher/unit_test_launcher.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 const char kBraveNewTestLauncherFlag[] = "brave-new-test-launcher"; | 37 const char kBraveNewTestLauncherFlag[] = "brave-new-test-launcher"; |
| 38 | 38 |
| 39 // Flag to run all tests in a single process. | 39 // Flag to run all tests in a single process. |
| 40 const char kSingleProcessTestsFlag[] = "single-process-tests"; | 40 const char kSingleProcessTestsFlag[] = "single-process-tests"; |
| 41 | 41 |
| 42 void PrintUsage() { | 42 void PrintUsage() { |
| 43 fprintf(stdout, | 43 fprintf(stdout, |
| 44 "Runs tests using the gtest framework, each batch of tests being\n" | 44 "Runs tests using the gtest framework, each batch of tests being\n" |
| 45 "run in their own process. Supported command-line flags:\n" | 45 "run in their own process. Supported command-line flags:\n" |
| 46 "\n" | 46 "\n" |
| 47 " Common flags:\n" |
| 48 " --gtest_filter=...\n" |
| 49 " Runs a subset of tests (see --gtest_help for more info).\n" |
| 50 "\n" |
| 51 " --help\n" |
| 52 " Shows this message.\n" |
| 53 "\n" |
| 54 " --gtest_help\n" |
| 55 " Shows the gtest help message.\n" |
| 56 "\n" |
| 57 " --test-launcher-jobs=N\n" |
| 58 " Sets the number of parallel test jobs to N.\n" |
| 59 "\n" |
| 47 " --single-process-tests\n" | 60 " --single-process-tests\n" |
| 48 " Runs the tests and the launcher in the same process. Useful\n" | 61 " Runs the tests and the launcher in the same process. Useful\n" |
| 49 " for debugging a specific test in a debugger.\n" | 62 " for debugging a specific test in a debugger.\n" |
| 50 " --test-launcher-jobs=N\n" | 63 "\n" |
| 51 " Sets the number of parallel test jobs to N.\n" | 64 " Other flags:\n" |
| 52 " --test-launcher-batch-limit=N\n" | 65 " --test-launcher-batch-limit=N\n" |
| 53 " Sets the limit of test batch to run in a single process to N.\n" | 66 " Sets the limit of test batch to run in a single process to N.\n" |
| 54 " --gtest_filter=...\n" | 67 "\n" |
| 55 " Runs a subset of tests (see --gtest_help for more info).\n" | 68 " --test-launcher-retry-limit=N\n" |
| 56 " --help\n" | 69 " Sets the limit of test retries on failures to N.\n" |
| 57 " Shows this message.\n" | 70 "\n" |
| 58 " --gtest_help\n" | 71 " --test-launcher-summary-output=PATH\n" |
| 59 " Shows the gtest help message.\n"); | 72 " Saves a JSON machine-readable summary of the run.\n" |
| 73 "\n" |
| 74 " --test-launcher-print-test-stdio=auto|always|never\n" |
| 75 " Controls when full test output is printed.\n" |
| 76 " auto means to print it when the test failed.\n" |
| 77 "\n" |
| 78 " --test-launcher-total-shards=N\n" |
| 79 " Sets the total number of shards to N.\n" |
| 80 "\n" |
| 81 " --test-launcher-shard-index=N\n" |
| 82 " Sets the shard index to run to N (from 0 to TOTAL - 1).\n"); |
| 60 fflush(stdout); | 83 fflush(stdout); |
| 61 } | 84 } |
| 62 | 85 |
| 63 // Returns command line for child GTest process based on the command line | 86 // Returns command line for child GTest process based on the command line |
| 64 // of current process. |test_names| is a vector of test full names | 87 // of current process. |test_names| is a vector of test full names |
| 65 // (e.g. "A.B"), |output_file| is path to the GTest XML output file. | 88 // (e.g. "A.B"), |output_file| is path to the GTest XML output file. |
| 66 CommandLine GetCommandLineForChildGTestProcess( | 89 CommandLine GetCommandLineForChildGTestProcess( |
| 67 const std::vector<std::string>& test_names, | 90 const std::vector<std::string>& test_names, |
| 68 const base::FilePath& output_file) { | 91 const base::FilePath& output_file) { |
| 69 CommandLine new_cmd_line(*CommandLine::ForCurrentProcess()); | 92 CommandLine new_cmd_line(*CommandLine::ForCurrentProcess()); |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 argc, argv, run_test_suite, SysInfo::NumberOfProcessors()); | 518 argc, argv, run_test_suite, SysInfo::NumberOfProcessors()); |
| 496 } | 519 } |
| 497 | 520 |
| 498 int LaunchUnitTestsSerially(int argc, | 521 int LaunchUnitTestsSerially(int argc, |
| 499 char** argv, | 522 char** argv, |
| 500 const RunTestSuiteCallback& run_test_suite) { | 523 const RunTestSuiteCallback& run_test_suite) { |
| 501 return LaunchUnitTestsInternal(argc, argv, run_test_suite, 1); | 524 return LaunchUnitTestsInternal(argc, argv, run_test_suite, 1); |
| 502 } | 525 } |
| 503 | 526 |
| 504 } // namespace base | 527 } // namespace base |
| OLD | NEW |