summaryrefslogtreecommitdiffstats
path: root/src/build_test.cc
diff options
context:
space:
mode:
authorEvan Martin <martine@danga.com>2011-09-09 20:48:27 (GMT)
committerEvan Martin <martine@danga.com>2011-09-09 20:48:27 (GMT)
commit639c8f0bad935625f3e61fb9dfac7da17b4d7625 (patch)
tree2bbbec00bd86c2d5e7692c2dc5cbc05508892c4f /src/build_test.cc
parent531c5e5bef4ef26d7456c462673435402697d7b8 (diff)
downloadNinja-639c8f0bad935625f3e61fb9dfac7da17b4d7625.zip
Ninja-639c8f0bad935625f3e61fb9dfac7da17b4d7625.tar.gz
Ninja-639c8f0bad935625f3e61fb9dfac7da17b4d7625.tar.bz2
don't mark phony edges dirty if none of their inputs are dirty
Because the output file is always missing, we'd consider a phony edge dirty even when there wasn't any work to do. Most importantly, that would mean we wouldn't print "nothing to do" in the common case of everything being up to date when building an alias.
Diffstat (limited to 'src/build_test.cc')
-rw-r--r--src/build_test.cc18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/build_test.cc b/src/build_test.cc
index db69628..c8d338b 100644
--- a/src/build_test.cc
+++ b/src/build_test.cc
@@ -541,13 +541,19 @@ TEST_F(BuildTest, Phony) {
EXPECT_TRUE(builder_.Build(&err));
ASSERT_EQ("", err);
ASSERT_EQ(1u, commands_ran_.size());
+}
+
+TEST_F(BuildTest, PhonyNoWork) {
+ string err;
+ ASSERT_NO_FATAL_FAILURE(AssertParse(&state_,
+"build out: cat bar.cc\n"
+"build all: phony out\n"));
+ fs_.Create("bar.cc", now_, "");
+ fs_.Create("out", now_, "");
- // XXX need a test that asserts we do nothing when we only
- // have pending phony rules.
- // fs_.Create("out", now_, "");
- // EXPECT_TRUE(builder_.AddTarget("all", &err));
- // ASSERT_EQ("", err);
- // EXPECT_TRUE(builder_.AlreadyUpToDate());
+ EXPECT_TRUE(builder_.AddTarget("all", &err));
+ ASSERT_EQ("", err);
+ EXPECT_TRUE(builder_.AlreadyUpToDate());
}
TEST_F(BuildTest, Fail) {