aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/test/java/com/google/devtools/build/lib/analysis/DuplicateActionTest.java46
-rw-r--r--src/test/java/com/google/devtools/build/lib/analysis/mock/BazelAnalysisMock.java5
2 files changed, 50 insertions, 1 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/DuplicateActionTest.java b/src/test/java/com/google/devtools/build/lib/analysis/DuplicateActionTest.java
new file mode 100644
index 0000000000..89020e235c
--- /dev/null
+++ b/src/test/java/com/google/devtools/build/lib/analysis/DuplicateActionTest.java
@@ -0,0 +1,46 @@
+//// Copyright 2015 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.google.devtools.build.lib.analysis;
+
+import com.google.devtools.build.lib.analysis.util.AnalysisTestCase;
+
+/**
+ * Tests for duplicate action detection and handling when incremental analysis is enabled.
+ */
+public class DuplicateActionTest extends AnalysisTestCase {
+ public void testDuplicateBuildInfoHeaderAction() throws Exception {
+ scratch.file("a/stamp.cc",
+ "// Empty."
+ );
+ scratch.file("a/BUILD",
+ "cc_binary(name = 'a', srcs = ['a.cc'], deps = [':c'], stamp = 1)",
+ "cc_binary(name = 'b', srcs = ['b.cc'], deps = [':c'], stamp = 1)",
+ "cc_library(name = 'c', linkstamp = 'stamp.cc')");
+ update("//a:a", "//a:b");
+ assertFalse(hasErrors(getConfiguredTarget("//a:a")));
+ assertFalse(hasErrors(getConfiguredTarget("//a:b")));
+ }
+
+ /**
+ * Same test with loading phase disabled.
+ */
+ public static class DuplicateActionTestWithoutLoading extends DuplicateActionTest {
+ @Override
+ public void setUp() throws Exception {
+ disableLoading();
+ super.setUp();
+ }
+ }
+}
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/mock/BazelAnalysisMock.java b/src/test/java/com/google/devtools/build/lib/analysis/mock/BazelAnalysisMock.java
index b8e0642161..eef30e7c0e 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/mock/BazelAnalysisMock.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/mock/BazelAnalysisMock.java
@@ -67,7 +67,9 @@ public class BazelAnalysisMock extends AnalysisMock {
" name = 'objc_proto_cpp_lib',",
" actual = '//objcproto:ProtocolBuffersCPP_lib',",
")",
- "bind(name = 'android/sdk', actual='//tools/android:sdk')"));
+ "bind(name = 'android/sdk', actual='//tools/android:sdk')",
+ "bind(name = 'tools/cpp', actual='//tools/cpp')"
+ ));
config.overwrite("WORKSPACE", workspaceContents.toArray(new String[workspaceContents.size()]));
config.create("tools/jdk/BUILD",
@@ -86,6 +88,7 @@ public class BazelAnalysisMock extends AnalysisMock {
" 'JavaBuilderCanary_deploy.jar', 'ijar', 'GenClass_deploy.jar'])");
config.create("tools/cpp/BUILD",
"cc_library(name = 'stl')",
+ "cc_library(name = 'malloc')",
"filegroup(name = 'toolchain', ",
" srcs = [':cc-compiler-local', ':cc-compiler-darwin', ':cc-compiler-piii',",
" ':cc-compiler-armeabi-v7a', ':empty'],",