summaryrefslogtreecommitdiffstats
path: root/src/build_test.cc
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2015-03-17 01:21:15 (GMT)
committerNico Weber <nicolasweber@gmx.de>2015-03-17 01:21:15 (GMT)
commit717619a260633ca0e7c9eb2366130fc06ebacfff (patch)
tree98394c40861c61c7c2ff9d535728c72b35e1b7e0 /src/build_test.cc
parentd5746fdd1754cbd539ab3ca7a58c7b75502ed4c4 (diff)
parent157a71f39b19d4fac43c814211c2093de205adab (diff)
downloadNinja-717619a260633ca0e7c9eb2366130fc06ebacfff.zip
Ninja-717619a260633ca0e7c9eb2366130fc06ebacfff.tar.gz
Ninja-717619a260633ca0e7c9eb2366130fc06ebacfff.tar.bz2
Merge pull request #930 from nico/depcolon
On unexpected output in a .d file, rebuild instead erroring.
Diffstat (limited to 'src/build_test.cc')
-rw-r--r--src/build_test.cc20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/build_test.cc b/src/build_test.cc
index bd1cd30..65d189d 100644
--- a/src/build_test.cc
+++ b/src/build_test.cc
@@ -816,8 +816,7 @@ TEST_F(BuildTest, DepFileParseError) {
fs_.Create("foo.c", "");
fs_.Create("foo.o.d", "randomtext\n");
EXPECT_FALSE(builder_.AddTarget("foo.o", &err));
- EXPECT_EQ("expected depfile 'foo.o.d' to mention 'foo.o', got 'randomtext'",
- err);
+ EXPECT_EQ("foo.o.d: expected ':' in depfile", err);
}
TEST_F(BuildTest, OrderOnlyDeps) {
@@ -2043,6 +2042,23 @@ TEST_F(BuildWithDepsLogTest, RestatMissingDepfileDepslog) {
ASSERT_EQ(0u, command_runner_.commands_ran_.size());
}
+TEST_F(BuildTest, WrongOutputInDepfileCausesRebuild) {
+ string err;
+ const char* manifest =
+"rule cc\n"
+" command = cc $in\n"
+" depfile = $out.d\n"
+"build foo.o: cc foo.c\n";
+
+ fs_.Create("foo.c", "");
+ fs_.Create("foo.o", "");
+ fs_.Create("header.h", "");
+ fs_.Create("foo.o.d", "bar.o.d: header.h\n");
+
+ RebuildTarget("foo.o", manifest, "build_log", "ninja_deps");
+ ASSERT_EQ(1u, command_runner_.commands_ran_.size());
+}
+
TEST_F(BuildTest, Console) {
ASSERT_NO_FATAL_FAILURE(AssertParse(&state_,
"rule console\n"