diff options
author | 2017-07-14 16:45:43 +0200 | |
---|---|---|
committer | 2017-07-17 10:10:37 +0200 | |
commit | 681b8174d5ae989cf9489716e4c15a54c2d36bc4 (patch) | |
tree | 11b9fef3e184fd4df6a6b24e7fdff88ab7ff2fc9 /src/test/java/com/google/devtools/build/lib/rules/objc/ObjcLibraryTest.java | |
parent | a5d977b2efccd06b9ff25572c518c176b379f61b (diff) |
Promote getPossibleInputsForTesting from CppCompileAction to CommandAction, in
order to allow tests that depend on pruned inputs to work for both the legacy
and crosstool cases.
PiperOrigin-RevId: 161955432
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/rules/objc/ObjcLibraryTest.java')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/rules/objc/ObjcLibraryTest.java | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcLibraryTest.java b/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcLibraryTest.java index f64d6551ff..6633fcc99a 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcLibraryTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcLibraryTest.java @@ -378,6 +378,36 @@ public class ObjcLibraryTest extends ObjcRuleTestCase { } @Test + public void testNonPropagatedDepsDiamond() throws Exception { + // Non-propagated. + createLibraryTargetWriter("//objc:lib") + .setAndCreateFiles("srcs", "a.m", "b.m", "private.h") + .setAndCreateFiles("hdrs", "a.h") + .write(); + // Conflicts with non-propagated. + createLibraryTargetWriter("//objc2:lib") + .setAndCreateFiles("srcs", "a.m", "b.m", "private.h") + .setAndCreateFiles("hdrs", "a.h") + .write(); + + createLibraryTargetWriter("//objc3:lib") + .setAndCreateFiles("srcs", "a.m", "b.m", "private.h") + .setAndCreateFiles("hdrs", "b.h") + .setList("non_propagated_deps", "//objc:lib") + .write(); + + createLibraryTargetWriter("//objc4:lib") + .setAndCreateFiles("srcs", "a.m", "b.m", "private.h") + .setAndCreateFiles("hdrs", "c.h") + .setList("deps", "//objc2:lib", "//objc3:lib") + .write(); + + CommandAction action = compileAction("//objc4:lib", "a.o"); + assertThat(Artifact.toRootRelativePaths(action.getPossibleInputsForTesting())) + .containsAllOf("objc2/a.h", "objc3/b.h", "objc4/c.h", "objc4/a.m", "objc4/private.h"); + } + + @Test public void testCompilationActions_simulator() throws Exception { useConfiguration( "--crosstool_top=" + MockObjcSupport.DEFAULT_OSX_CROSSTOOL, @@ -1258,6 +1288,29 @@ public class ObjcLibraryTest extends ObjcRuleTestCase { } @Test + public void testCompilesWithHdrs() throws Exception { + checkCompilesWithHdrs(ObjcLibraryTest.RULE_TYPE); + } + + @Test + public void testCompilesAssemblyWithPreprocessing() throws Exception { + createLibraryTargetWriter("//objc:lib") + .setAndCreateFiles("srcs", "a.m", "b.S") + .setAndCreateFiles("hdrs", "c.h") + .write(); + + CommandAction compileAction = compileAction("//objc:lib", "b.o"); + + // Clang automatically preprocesses .S files, so the assembler-with-cpp flag is unnecessary. + // Regression test for b/22636858. + assertThat(compileAction.getArguments()).doesNotContain("-x"); + assertThat(compileAction.getArguments()).doesNotContain("assembler-with-cpp"); + assertThat(baseArtifactNames(compileAction.getOutputs())).containsExactly("b.o", "b.d"); + assertThat(baseArtifactNames(compileAction.getPossibleInputsForTesting())) + .containsAllOf("c.h", "b.S"); + } + + @Test public void testUsesDotdPruning() throws Exception { useConfiguration( "--crosstool_top=" + MockObjcSupport.DEFAULT_OSX_CROSSTOOL, "--objc_use_dotd_pruning"); |