aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java
diff options
context:
space:
mode:
authorGravatar jcater <jcater@google.com>2018-02-20 14:00:33 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2018-02-20 14:02:23 -0800
commit2dd46e6178a7e99e38c56a0fddc1a6e533b53bf0 (patch)
tree9bcf07b3577951466dbaea11b2e25069eeb8a18e /src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java
parent80a0633bbeef3f84ab6eb6513a5d36936cd1bdbb (diff)
Update --flaky_test_attempts to also take a repeatable argument of the form
regex@attempts, similarly to --runs_per_test. Also re-arrange some option converters to be closer to their options. RELNOTES: flaky_test_attempts supports the regex@attempts syntax, like runs_per_test. PiperOrigin-RevId: 186358437
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java47
1 files changed, 0 insertions, 47 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java b/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java
index 59c5badf37..3f2a463c43 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java
@@ -384,53 +384,6 @@ public class BuildConfiguration implements BuildConfigurationInterface {
}
}
- /** TODO(bazel-team): document this */
- public static class RunsPerTestConverter extends PerLabelOptions.PerLabelOptionsConverter {
- @Override
- public PerLabelOptions convert(String input) throws OptionsParsingException {
- try {
- return parseAsInteger(input);
- } catch (NumberFormatException ignored) {
- return parseAsRegex(input);
- }
- }
-
- private PerLabelOptions parseAsInteger(String input)
- throws NumberFormatException, OptionsParsingException {
- int numericValue = Integer.parseInt(input);
- if (numericValue <= 0) {
- throw new OptionsParsingException("'" + input + "' should be >= 1");
- } else {
- RegexFilter catchAll = new RegexFilter(Collections.singletonList(".*"),
- Collections.<String>emptyList());
- return new PerLabelOptions(catchAll, Collections.singletonList(input));
- }
- }
-
- private PerLabelOptions parseAsRegex(String input) throws OptionsParsingException {
- PerLabelOptions testRegexps = super.convert(input);
- if (testRegexps.getOptions().size() != 1) {
- throw new OptionsParsingException(
- "'" + input + "' has multiple runs for a single pattern");
- }
- String runsPerTest = Iterables.getOnlyElement(testRegexps.getOptions());
- try {
- int numericRunsPerTest = Integer.parseInt(runsPerTest);
- if (numericRunsPerTest <= 0) {
- throw new OptionsParsingException("'" + input + "' has a value < 1");
- }
- } catch (NumberFormatException e) {
- throw new OptionsParsingException("'" + input + "' has a non-numeric value", e);
- }
- return testRegexps;
- }
-
- @Override
- public String getTypeDescription() {
- return "a positive integer or test_regex@runs. This flag may be passed more than once";
- }
- }
-
/**
* Values for the --strict_*_deps option
*/