xref: /aosp_15_r20/external/cronet/base/test/test_switches.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2012 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "base/test/test_switches.h"
6 
7 #include "build/build_config.h"
8 
9 // Flag to show the help message.
10 const char switches::kHelpFlag[] = "help";
11 
12 const char switches::kIsolatedScriptTestLauncherRetryLimit[] =
13     "isolated-script-test-launcher-retry-limit";
14 
15 // Makes pixel tests overwrite their reference if the output and reference
16 // don't match.
17 const char switches::kRebaselinePixelTests[] = "rebaseline-pixel-tests";
18 
19 // Flag to run all tests and the launcher in a single process. Useful for
20 // debugging a specific test in a debugger.
21 const char switches::kSingleProcessTests[] = "single-process-tests";
22 
23 // Maximum number of tests to run in a single batch.
24 const char switches::kTestLauncherBatchLimit[] = "test-launcher-batch-limit";
25 
26 // Sets defaults desirable for the continuous integration bots, e.g. parallel
27 // test execution and test retries.
28 const char switches::kTestLauncherBotMode[] =
29     "test-launcher-bot-mode";
30 
31 // Makes it possible to debug the launcher itself. By default the launcher
32 // automatically switches to single process mode when it detects presence
33 // of debugger.
34 const char switches::kTestLauncherDebugLauncher[] =
35     "test-launcher-debug-launcher";
36 
37 // List of paths to files (separated by ';') containing test filters (one
38 // pattern per line).
39 const char switches::kTestLauncherFilterFile[] = "test-launcher-filter-file";
40 
41 // Force running the test cases listed in the positive filter file with full
42 // name (not wildcard). If set, only exact positive filter from the filter
43 // file is allowed. Passing --gtest_filter, positive wildcard filters, or
44 // negative filters will fail the test launcher.
45 // If any test case is disabled or deleted in source files, the test suite
46 // fails.
47 const char switches::kEnforceExactPositiveFilter[] =
48     "enforce-exact-positive-filter";
49 
50 // Force running all requested tests and retries even if too many test errors
51 // occur.
52 const char switches::kTestLauncherForceRunBrokenTests[] =
53     "test-launcher-force-run-broken-tests";
54 
55 // Whether the test launcher should launch in "interactive mode", which disables
56 // timeouts (and may have other effects for specific test types).
57 const char switches::kTestLauncherInteractive[] = "test-launcher-interactive";
58 
59 // Number of parallel test launcher jobs.
60 const char switches::kTestLauncherJobs[] = "test-launcher-jobs";
61 
62 // Path to list of compiled in tests.
63 const char switches::kTestLauncherListTests[] = "test-launcher-list-tests";
64 
65 // Path to test results file in our custom test launcher format.
66 const char switches::kTestLauncherOutput[] = "test-launcher-output";
67 
68 // Maximum output bytes allowed from a single test. Exceeding this limit
69 // results in truncating the output and failing the test.
70 const char switches::kTestLauncherOutputBytesLimit[] =
71     "test-launcher-output-bytes-limit";
72 
73 // Causes the test launcher to print information about leaked files and/or
74 // directories in child process's temporary directories.
75 const char switches::kTestLauncherPrintTempLeaks[] =
76     "test-launcher-print-temp-leaks";
77 
78 // Flag controlling when test stdio is displayed as part of the launcher's
79 // standard output.
80 const char switches::kTestLauncherPrintTestStdio[] =
81     "test-launcher-print-test-stdio";
82 
83 // Print timestamps in test launcher. This is helpful for debugging test
84 // slowness. Currently it prints out the following log:
85 //   * The time at the end of each test.
86 //   * The time while waiting for a test to run.
87 // Using this flag helps you answer questions like "how long did it take
88 // to run the first 10000 tests".
89 // Please only keep this flag on builders temporarily because those logs
90 // are a bit spammy.
91 const char switches::kTestLauncherPrintTimestamps[] =
92     "test-launcher-print-timestamps";
93 
94 // Print a writable path and exit (for internal use).
95 const char switches::kTestLauncherPrintWritablePath[] =
96     "test-launcher-print-writable-path";
97 
98 // Indicate how many retries are left. Tests in general should not pass in this
99 // flag. This flag is used for launcher to pass retries-left information
100 // to the runner process.
101 const char switches::kTestLauncherRetriesLeft[] = "test-launcher-retries-left";
102 
103 // These two flags has the same effect, but don't use them at the same time.
104 // And isolated-script-test-launcher-retry-limit is preferred in the future.
105 // Maximum number of times to retry a test after failure.
106 const char switches::kTestLauncherRetryLimit[] = "test-launcher-retry-limit";
107 
108 // Index of the test shard to run, starting from 0 (first shard) to total shards
109 // minus one (last shard).
110 const char switches::kTestLauncherShardIndex[] =
111     "test-launcher-shard-index";
112 
113 // Path to test results file with all the info from the test launcher.
114 const char switches::kTestLauncherSummaryOutput[] =
115     "test-launcher-summary-output";
116 
117 // Limit of test part results in the output. Default limit is 10.
118 // Negative value will completely disable limit.
119 const char switches::kTestLauncherTestPartResultsLimit[] =
120     "test-launcher-test-part-results-limit";
121 
122 // Total number of shards. Must be the same for all shards.
123 const char switches::kTestLauncherTotalShards[] =
124     "test-launcher-total-shards";
125 
126 // Time (in milliseconds) that the tests should wait before timing out.
127 const char switches::kTestLauncherTimeout[] = "test-launcher-timeout";
128 
129 // Path where to save a trace of test launcher's execution.
130 const char switches::kTestLauncherTrace[] = "test-launcher-trace";
131 
132 // TODO(phajdan.jr): Clean up the switch names.
133 const char switches::kTestTinyTimeout[] = "test-tiny-timeout";
134 const char switches::kUiTestActionMaxTimeout[] = "ui-test-action-max-timeout";
135 const char switches::kUiTestActionTimeout[] = "ui-test-action-timeout";
136 
137 // Do not suppress stack traces in death tests.
138 const char switches::kWithDeathTestStackTraces[] =
139     "with-death-test-stack-traces";
140 
141 #if BUILDFLAG(IS_IOS)
142 // If enabled, runs unittests using the XCTest test runner.
143 const char switches::kEnableRunIOSUnittestsWithXCTest[] =
144     "enable-run-ios-unittests-with-xctest";
145 // Write a compiled test json file to a location where writable.
146 const char switches::kWriteCompiledTestsJsonToWritablePath[] =
147     "write-compiled-tests-json-to-writable-path";
148 #endif
149