aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/com/google/devtools/build/lib/rules/objc/AppleBinaryTest.java17
-rw-r--r--src/test/java/com/google/devtools/build/lib/rules/objc/AppleDynamicLibraryTest.java5
-rw-r--r--src/test/java/com/google/devtools/build/lib/rules/objc/AppleStaticLibraryTest.java2
-rw-r--r--src/test/java/com/google/devtools/build/lib/rules/objc/ObjcRuleTestCase.java45
4 files changed, 57 insertions, 12 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/rules/objc/AppleBinaryTest.java b/src/test/java/com/google/devtools/build/lib/rules/objc/AppleBinaryTest.java
index 2c4026e678..14638946e5 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/objc/AppleBinaryTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/objc/AppleBinaryTest.java
@@ -1104,7 +1104,7 @@ public class AppleBinaryTest extends ObjcRuleTestCase {
Action lipoAction = actionProducingArtifact("//examples:bin", "_lipobin");
Artifact armv7Binary = getSingleArchBinary(lipoAction, "armv7");
- Artifact arm64Binary = getSingleArchBinary(lipoAction, "arm64");;
+ Artifact arm64Binary = getSingleArchBinary(lipoAction, "arm64");
Artifact armv7ProtoLib =
getFirstArtifactEndingWith(
@@ -1131,16 +1131,6 @@ public class AppleBinaryTest extends ObjcRuleTestCase {
getGeneratingAction(arm64ProtoObjcSource).getInputs(), "two.proto")).isNotNull();
}
- private Artifact getSingleArchBinary(Action lipoAction, String arch) throws Exception {
- for (Artifact archBinary : lipoAction.getInputs()) {
- String execPath = archBinary.getExecPathString();
- if (execPath.endsWith("bin_bin") && execPath.contains(arch)) {
- return archBinary;
- }
- }
- throw new AssertionError("Lipo action does not contain an input binary from arch " + arch);
- }
-
private SkylarkDict<String, SkylarkDict<String, Artifact>>
generateAppleDebugOutputsSkylarkProviderMap() throws Exception {
scratch.file("examples/rule/BUILD");
@@ -1470,4 +1460,9 @@ public class AppleBinaryTest extends ObjcRuleTestCase {
assertThat(linkArgs).contains(expectedCommandLineFragment);
}
}
+
+ @Test
+ public void testDrops32BitArchitecture() throws Exception {
+ verifyDrops32BitArchitecture(RULE_TYPE);
+ }
}
diff --git a/src/test/java/com/google/devtools/build/lib/rules/objc/AppleDynamicLibraryTest.java b/src/test/java/com/google/devtools/build/lib/rules/objc/AppleDynamicLibraryTest.java
index 82b875afc7..169483aa60 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/objc/AppleDynamicLibraryTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/objc/AppleDynamicLibraryTest.java
@@ -203,4 +203,9 @@ public class AppleDynamicLibraryTest extends ObjcRuleTestCase {
public void testMinimumOsDifferentTargets() throws Exception {
checkMinimumOsDifferentTargets(RULE_TYPE, "_lipobin", "_bin");
}
+
+ @Test
+ public void testDrops32BitArchitecture() throws Exception {
+ verifyDrops32BitArchitecture(RULE_TYPE);
+ }
}
diff --git a/src/test/java/com/google/devtools/build/lib/rules/objc/AppleStaticLibraryTest.java b/src/test/java/com/google/devtools/build/lib/rules/objc/AppleStaticLibraryTest.java
index d76970aa85..a990858e50 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/objc/AppleStaticLibraryTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/objc/AppleStaticLibraryTest.java
@@ -623,4 +623,4 @@ public class AppleStaticLibraryTest extends ObjcRuleTestCase {
assertThat(Artifact.toRootRelativePaths(action.getInputs())).doesNotContain(
"package/libavoidCcLib.a");
}
-} \ No newline at end of file
+}
diff --git a/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcRuleTestCase.java b/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcRuleTestCase.java
index 8ac35877dc..b28980800f 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcRuleTestCase.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcRuleTestCase.java
@@ -111,6 +111,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
+import javax.annotation.Nullable;
import org.junit.Before;
/**
@@ -4981,6 +4982,29 @@ public abstract class ObjcRuleTestCase extends BuildViewTestCase {
.contains("-mios-simulator-version-min=9.0");
}
+ protected void verifyDrops32BitArchitecture(RuleType ruleType) throws Exception {
+ scratch.file("libs/BUILD",
+ "objc_library(",
+ " name = 'objc_lib',",
+ " srcs = ['a.m'],",
+ ")");
+
+ ruleType.scratchTarget(
+ scratch,
+ "deps", "['//libs:objc_lib']",
+ "platform_type", "'ios'",
+ "minimum_os_version", "'11.0'"); // Does not support 32-bit architectures.
+
+ useConfiguration("--ios_multi_cpus=armv7,arm64,i386,x86_64");
+
+ Action lipoAction = actionProducingArtifact("//x:x", "_lipobin");
+
+ getSingleArchBinary(lipoAction, "arm64");
+ getSingleArchBinary(lipoAction, "x86_64");
+ assertThat(getSingleArchBinaryIfAvailable(lipoAction, "armv7")).isNull();
+ assertThat(getSingleArchBinaryIfAvailable(lipoAction, "i386")).isNull();
+ }
+
/** Returns the full label string for labels within the main tools repository. */
protected static String toolsRepoLabel(String label) {
return TestConstants.TOOLS_REPOSITORY + label;
@@ -4992,4 +5016,25 @@ public abstract class ObjcRuleTestCase extends BuildViewTestCase {
protected static String toolsRepoExecPath(String execPath) {
return TestConstants.TOOLS_REPOSITORY_PATH_PREFIX + execPath;
}
+
+ @Nullable
+ protected Artifact getSingleArchBinaryIfAvailable(Action lipoAction, String arch)
+ throws Exception {
+ for (Artifact archBinary : lipoAction.getInputs()) {
+ String execPath = archBinary.getExecPathString();
+ if (execPath.endsWith("_bin") && execPath.contains(arch)) {
+ return archBinary;
+ }
+ }
+ return null;
+ }
+
+ protected Artifact getSingleArchBinary(Action lipoAction, String arch) throws Exception {
+ Artifact result = getSingleArchBinaryIfAvailable(lipoAction, arch);
+ if (result != null) {
+ return result;
+ } else {
+ throw new AssertionError("Lipo action does not contain an input binary from arch " + arch);
+ }
+ }
}