diff options
author | 2016-08-10 16:05:00 +0000 | |
---|---|---|
committer | 2016-08-11 09:13:55 +0000 | |
commit | c511cb53595cd724900fff026c45b2702950f115 (patch) | |
tree | 773690cb882af09415150d134201bfa3490739ed /src/test | |
parent | 92fbef0f816107a70e934624043169b414fef892 (diff) |
Store non-code inputs to link actions separately.
This is a re-submission of commit 99de0d07574f808fee36826289cb1f5c83e3b3e0 (rolled back in commit eff8b365c172b7e904ac6f7bba0c893fed7c91a8) and a few tweaks: - The fix for the bug that caused the rollback (see line 888 in CppModel.java -- we now use addNonCodeInputs() instead of addObjectFiles() to pass in the processed header tokens)
- A few extra assertions
- A test case
- The re-submission of the parts of commit 603b540bbcd7414cd3e2c0b92c1c8985b035e41b that were also rolled back as collateral damage.
The bug report didn't contain a precise reproduction, but the bug is trivial enough that I'm comfortable with things this way.
--
MOS_MIGRATED_REVID=129872117
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/rules/cpp/CcLibraryConfiguredTargetTest.java | 17 | ||||
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionTest.java | 2 |
2 files changed, 16 insertions, 3 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/rules/cpp/CcLibraryConfiguredTargetTest.java b/src/test/java/com/google/devtools/build/lib/rules/cpp/CcLibraryConfiguredTargetTest.java index bfe490e258..6b354e4b73 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/cpp/CcLibraryConfiguredTargetTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/cpp/CcLibraryConfiguredTargetTest.java @@ -299,12 +299,12 @@ public class CcLibraryConfiguredTargetTest extends BuildViewTestCase { .setupCrosstool(mockToolsConfig, "artifact_name_pattern {" + " category_name: 'object_file'" - + " pattern: '%{base_name}.obj'" + + " pattern: 'object_%{base_name}.o'" + "}"); useConfiguration(); ConfiguredTarget hello = getConfiguredTarget("//hello:hello"); - assertThat(artifactByPath(getFilesToBuild(hello), ".a", "hello.obj")).isNotNull(); + assertThat(artifactByPath(getFilesToBuild(hello), ".a", "object_hello.o")).isNotNull(); } @Test @@ -1187,4 +1187,17 @@ public class CcLibraryConfiguredTargetTest extends BuildViewTestCase { + "non-library sources of this rule), which could cause confusion", "cc_library(name = 'foo', srcs = ['foo.cc', 'libfoo.lo'])"); } + + + @Test + public void testProcessedHeadersWithPicSharedLibsAndNoPicBinaries() throws Exception { + AnalysisMock.get() + .ccSupport() + .setupCrosstool(mockToolsConfig, + MockCcSupport.HEADER_PROCESSING_FEATURE_CONFIGURATION); + useConfiguration("--features=parse_headers", "-c", "opt"); + // Should not crash + ConfiguredTarget a = scratchConfiguredTarget("a", "a", + "cc_library(name='a', hdrs=['a.h'])"); + } } diff --git a/src/test/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionTest.java b/src/test/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionTest.java index 863e7c1bf1..963d831af6 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionTest.java @@ -319,7 +319,7 @@ public class CppLinkActionTest extends BuildViewTestCase { new PathFragment(outputPath), getTargetConfiguration().getBinDirectory()), ruleContext.getConfiguration(), shouldIncludeToolchain ? CppHelper.getToolchain(ruleContext) : null) - .addNonLibraryInputs(nonLibraryInputs) + .addObjectFiles(nonLibraryInputs) .addLibraries(NestedSetBuilder.wrap(Order.LINK_ORDER, libraryInputs)) .setLinkType(type) .setCrosstoolInputs(NestedSetBuilder.<Artifact>emptySet(Order.STABLE_ORDER)) |