aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar George Gensure <ggensure@uberatc.com>2017-02-27 12:16:39 +0000
committerGravatar Yue Gan <yueg@google.com>2017-02-27 15:09:50 +0000
commitabc933266ebdebe0bd8fc8cc78a8aed3f4fc87fb (patch)
tree3699916d470b91779b8ebad22ce9bea4e2f9ad7d
parent1410c21494e791d351abacecfdc78cd9339bacf3 (diff)
Regression test for ActionCache shutdown roundtrip
Determines whether an action cache loaded after bazel daemon shutdown is accurate to prevent C++ recompilation. Demonstrates the validity of a28b540 and should prevent future regressions in the input discovery space for C++. Closes #2586. -- Reviewed-on: https://github.com/bazelbuild/bazel/pull/2586 PiperOrigin-RevId: 148634934 MOS_MIGRATED_REVID=148634934
-rwxr-xr-xsrc/test/shell/integration/cpp_test.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/test/shell/integration/cpp_test.sh b/src/test/shell/integration/cpp_test.sh
index 0e8fd3ae3f..bb7a8f693a 100755
--- a/src/test/shell/integration/cpp_test.sh
+++ b/src/test/shell/integration/cpp_test.sh
@@ -90,4 +90,30 @@ EOF
bazel build //a || fail "build failled"
}
+function test_no_recompile_on_shutdown() {
+ mkdir -p a
+ cat > a/BUILD <<EOF
+cc_binary(name="a", srcs=["a.cc"], deps=["b"])
+cc_library(name="b", includes=["."], hdrs=["b.h"])
+EOF
+
+ cat > a/a.cc <<EOF
+#include "b.h"
+
+int main(void) {
+ return B_RETURN_VALUE;
+}
+EOF
+
+ cat > a/b.h <<EOF
+#define B_RETURN_VALUE 31
+EOF
+
+ bazel build -s //a >& $TEST_log || fail "build failed"
+ expect_log "Compiling a/a.cc"
+ bazel shutdown >& /dev/null || fail "query failed"
+ bazel build -s //a >& $TEST_log || fail "build failed"
+ expect_not_log "Compiling a/a.cc"
+}
+
run_suite "Tests for Bazel's C++ rules"