diff options
author | 2018-02-12 04:37:41 -0800 | |
---|---|---|
committer | 2018-02-12 04:39:21 -0800 | |
commit | c7e343ad314aeab6283b5939bc8126a112140a11 (patch) | |
tree | 26d3e9e06f114916512310b218ef2af447063b4b /src/test/java/com/google/devtools | |
parent | c527b4f1f9e8c4c48b136b190b6e92e9c80b09a4 (diff) |
C++: Allows adding linkopts through file.
The file can be generated during execution by a different rule.
RELNOTES:none
PiperOrigin-RevId: 185361140
Diffstat (limited to 'src/test/java/com/google/devtools')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/rules/cpp/LinkBuildVariablesTest.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/rules/cpp/LinkBuildVariablesTest.java b/src/test/java/com/google/devtools/build/lib/rules/cpp/LinkBuildVariablesTest.java index aa21798b4c..1f039cf095 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/cpp/LinkBuildVariablesTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/cpp/LinkBuildVariablesTest.java @@ -105,6 +105,26 @@ public class LinkBuildVariablesTest extends LinkBuildVariablesTestCase { } @Test + public void testLinkoptsFileIsExported() throws Exception { + AnalysisMock.get().ccSupport().setupCrosstool(mockToolsConfig); + useConfiguration(); + + scratch.file( + "x/BUILD", + "cc_binary(", + " name = 'bin',", + " srcs = ['bin.cc'],", + " linkopts_file= 'bin.linkopts_file'", + ")"); + + ConfiguredTarget target = getConfiguredTarget("//x:bin"); + Variables variables = getLinkBuildVariables(target, Link.LinkTargetType.EXECUTABLE); + String variableValue = + getVariableValue(variables, CppLinkActionBuilder.LINK_OPTS_FILE_VARIABLE); + assertThat(variableValue).matches("x/bin.linkopts_file"); + } + + @Test public void testInterfaceLibraryBuildingVariablesWhenGenerationPossible() throws Exception { // Make sure the interface shared object generation is enabled in the configuration // (which it is not by default for some windows toolchains) |