aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib/analysis
diff options
context:
space:
mode:
authorGravatar Alex Humesky <ahumesky@google.com>2015-10-13 17:27:43 +0000
committerGravatar Florian Weikert <fwe@google.com>2015-10-13 21:12:49 +0000
commit6cfa830c0d11e9bd7908bd0182db95454e5b258b (patch)
treefd22c8694179e10dc766237c38d8a6dde02f773d /src/test/java/com/google/devtools/build/lib/analysis
parent4bf88808e84876fa7296e1161c864d994a27c257 (diff)
Improves the error message for invalid cpu (--cpu or --fat_apk_cpu).
Before: ERROR: No toolchain found for cpu 'x84'. After: ERROR: No toolchain found for cpu 'x84'. Valid cpus are: [ armeabi, armeabi-v7a, armeabi-v7a-hard, armeabi-thumb, armeabi-v7a-thumb, armeabi-v7a-hard-thumb, arm64-v8a, mips, mips64, x86, x86_64, ]. -- MOS_MIGRATED_REVID=105324190
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/analysis')
-rw-r--r--src/test/java/com/google/devtools/build/lib/analysis/config/BuildConfigurationTest.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/config/BuildConfigurationTest.java b/src/test/java/com/google/devtools/build/lib/analysis/config/BuildConfigurationTest.java
index 314e475d58..d40c4a01fa 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/config/BuildConfigurationTest.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/config/BuildConfigurationTest.java
@@ -1,4 +1,4 @@
-// Copyright 2006-2015 Google Inc. All rights reserved.
+// Copyright 2015 The Bazel Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -27,6 +27,7 @@ import com.google.devtools.build.lib.testutil.TestConstants;
import com.google.devtools.common.options.Options;
import java.util.Map;
+import java.util.regex.Pattern;
/**
* Tests for {@link BuildConfiguration}.
@@ -117,17 +118,18 @@ public class BuildConfigurationTest extends ConfigurationTestCase {
assertEquals(a.cacheKey(), b.cacheKey());
}
- private void checkInvalidCpuError(String cpuOption, String expectedMessage) throws Exception {
+ private void checkInvalidCpuError(String cpuOption, Pattern messageRegex) throws Exception {
try {
create("--" + cpuOption + "=bogus");
fail();
} catch (InvalidConfigurationException e) {
- assertThat(e).hasMessage(expectedMessage);
+ assertThat(e.getMessage()).matches(messageRegex);
}
}
public void testInvalidCpu() throws Exception {
- checkInvalidCpuError("cpu", "No toolchain found for cpu 'bogus'");
+ checkInvalidCpuError("cpu", Pattern.compile(
+ "No toolchain found for cpu 'bogus'. Valid cpus are: \\[\n( [\\w-]+,\n)+]"));
}
public void testConfigurationsHaveUniqueOutputDirectories() throws Exception {