aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib/rules
diff options
context:
space:
mode:
authorGravatar Marcel Hlopko <hlopko@google.com>2017-03-08 12:10:47 +0000
committerGravatar Vladimir Moskva <vladmos@google.com>2017-03-08 13:55:50 +0000
commit967de7358db7cf774910019cefdaf8fd2ff5c789 (patch)
treed84534e2e447e3973d60d3d91dedeb12bf7d71b1 /src/test/java/com/google/devtools/build/lib/rules
parent3b99ad4144bc8530dc7454c539472ec5c7f415e8 (diff)
Do not create symlink pointing at itself with strip_include_prefix/include_prefix
This cl fixes a bug when strip_include_prefix and include_prefix are used in such a way that the resulting virtual header is be accessible from the same path as the original header and bazel would attempt to create symlink pointing at itself. Fixes #2635 -- PiperOrigin-RevId: 149524480 MOS_MIGRATED_REVID=149524480
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/rules')
-rw-r--r--src/test/java/com/google/devtools/build/lib/rules/cpp/CcCommonTest.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/rules/cpp/CcCommonTest.java b/src/test/java/com/google/devtools/build/lib/rules/cpp/CcCommonTest.java
index f25c42509f..ca41179bc9 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/cpp/CcCommonTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/cpp/CcCommonTest.java
@@ -891,6 +891,19 @@ public class CcCommonTest extends BuildViewTestCase {
"header 'third_party/a/v1/b.h' is not under the specified strip prefix 'third_party/a/v2'");
}
+ @Test
+ public void testSymlinkActionIsNotRegisteredWhenIncludePrefixDoesntChangePath() throws Exception {
+ scratch.file(
+ "third_party/BUILD",
+ "licenses(['notice'])",
+ "cc_library(name='a', hdrs=['a.h'], include_prefix='third_party')");
+
+ CppCompilationContext context =
+ getConfiguredTarget("//third_party:a").getProvider(CppCompilationContext.class);
+ assertThat(ActionsTestUtil.prettyArtifactNames(context.getDeclaredIncludeSrcs()))
+ .doesNotContain("third_party/_virtual_includes/a/third_party/a.h");
+ }
+
/**
* A {@code toolchain_lookup} rule for testing that only supports C++.
*/