diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2011-09-18 02:07:35 (GMT) |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2011-10-18 22:01:48 (GMT) |
commit | 5ff5891f5bed923b983c0f5a23c16d988d55f30e (patch) | |
tree | d882ee9f327e7ab138429dcee85625b88d7fa915 /src/build_test.cc | |
parent | afbe2185a3bbd2453d6b1c27ee8f7c1cce6371a3 (diff) | |
download | Ninja-5ff5891f5bed923b983c0f5a23c16d988d55f30e.zip Ninja-5ff5891f5bed923b983c0f5a23c16d988d55f30e.tar.gz Ninja-5ff5891f5bed923b983c0f5a23c16d988d55f30e.tar.bz2 |
Split Node::dirty_ into two flags: Node::dirty_ and Edge::outputs_ready_
dirty_ is intended to remain static during the build (unless a restat
occurs), while outputs_ready_ reflects the dynamic state of the build.
Diffstat (limited to 'src/build_test.cc')
-rw-r--r-- | src/build_test.cc | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/src/build_test.cc b/src/build_test.cc index 84359a3..a4bf256 100644 --- a/src/build_test.cc +++ b/src/build_test.cc @@ -42,7 +42,6 @@ TEST_F(PlanTest, Basic) { ASSERT_FALSE(plan_.FindWork()); - GetNode("mid")->dirty_ = false; plan_.EdgeFinished(edge); edge = plan_.FindWork(); @@ -50,7 +49,6 @@ TEST_F(PlanTest, Basic) { ASSERT_EQ("mid", edge->inputs_[0]->file_->path_); ASSERT_EQ("out", edge->outputs_[0]->file_->path_); - GetNode("out")->dirty_ = false; plan_.EdgeFinished(edge); ASSERT_FALSE(plan_.more_to_do()); @@ -75,13 +73,10 @@ TEST_F(PlanTest, DoubleOutputDirect) { Edge* edge; edge = plan_.FindWork(); ASSERT_TRUE(edge); // cat in - GetNode("mid1")->dirty_ = false; - GetNode("mid2")->dirty_ = false; plan_.EdgeFinished(edge); edge = plan_.FindWork(); ASSERT_TRUE(edge); // cat mid1 mid2 - GetNode("in")->dirty_ = false; plan_.EdgeFinished(edge); edge = plan_.FindWork(); @@ -108,23 +103,18 @@ TEST_F(PlanTest, DoubleOutputIndirect) { Edge* edge; edge = plan_.FindWork(); ASSERT_TRUE(edge); // cat in - GetNode("a1")->dirty_ = false; - GetNode("a2")->dirty_ = false; plan_.EdgeFinished(edge); edge = plan_.FindWork(); ASSERT_TRUE(edge); // cat a1 - GetNode("b1")->dirty_ = false; plan_.EdgeFinished(edge); edge = plan_.FindWork(); ASSERT_TRUE(edge); // cat a2 - GetNode("b2")->dirty_ = false; plan_.EdgeFinished(edge); edge = plan_.FindWork(); ASSERT_TRUE(edge); // cat b1 b2 - GetNode("out")->dirty_ = false; plan_.EdgeFinished(edge); edge = plan_.FindWork(); @@ -151,22 +141,18 @@ TEST_F(PlanTest, DoubleDependent) { Edge* edge; edge = plan_.FindWork(); ASSERT_TRUE(edge); // cat in - GetNode("mid")->dirty_ = false; plan_.EdgeFinished(edge); edge = plan_.FindWork(); ASSERT_TRUE(edge); // cat mid - GetNode("a1")->dirty_ = false; plan_.EdgeFinished(edge); edge = plan_.FindWork(); ASSERT_TRUE(edge); // cat mid - GetNode("a2")->dirty_ = false; plan_.EdgeFinished(edge); edge = plan_.FindWork(); ASSERT_TRUE(edge); // cat a1 a2 - GetNode("out")->dirty_ = false; plan_.EdgeFinished(edge); edge = plan_.FindWork(); @@ -324,10 +310,12 @@ TEST_F(BuildTest, TwoStep) { EXPECT_EQ("cat cat1 cat2 > cat12", commands_ran_[2]); + now_++; + // Modifying in2 requires rebuilding one intermediate file // and the final file. - GetNode("cat2")->dirty_ = true; - GetNode("cat12")->dirty_ = true; + fs_.Create("in2", now_, ""); + state_.Reset(); EXPECT_TRUE(builder_.AddTarget("cat12", &err)); ASSERT_EQ("", err); EXPECT_TRUE(builder_.Build(&err)); @@ -372,7 +360,7 @@ TEST_F(BuildTest, Chain) { err.clear(); commands_ran_.clear(); - state_.stat_cache_.Invalidate(); + state_.Reset(); EXPECT_TRUE(builder_.AddTarget("c5", &err)); ASSERT_EQ("", err); EXPECT_TRUE(builder_.AlreadyUpToDate()); @@ -382,7 +370,7 @@ TEST_F(BuildTest, Chain) { fs_.Create("c3", now_, ""); err.clear(); commands_ran_.clear(); - state_.stat_cache_.Invalidate(); + state_.Reset(); EXPECT_TRUE(builder_.AddTarget("c5", &err)); ASSERT_EQ("", err); EXPECT_FALSE(builder_.AlreadyUpToDate()); @@ -518,7 +506,7 @@ TEST_F(BuildTest, OrderOnlyDeps) { fs_.Create("blah.h", now_, ""); fs_.Create("bar.h", now_, ""); commands_ran_.clear(); - state_.stat_cache_.Invalidate(); + state_.Reset(); EXPECT_TRUE(builder_.AddTarget("foo.o", &err)); EXPECT_TRUE(builder_.Build(&err)); ASSERT_EQ("", err); @@ -529,7 +517,7 @@ TEST_F(BuildTest, OrderOnlyDeps) { // order only dep dirty, no rebuild. fs_.Create("otherfile", now_, ""); commands_ran_.clear(); - state_.stat_cache_.Invalidate(); + state_.Reset(); EXPECT_TRUE(builder_.AddTarget("foo.o", &err)); EXPECT_EQ("", err); EXPECT_TRUE(builder_.AlreadyUpToDate()); @@ -537,7 +525,7 @@ TEST_F(BuildTest, OrderOnlyDeps) { // implicit dep missing, expect rebuild. fs_.RemoveFile("bar.h"); commands_ran_.clear(); - state_.stat_cache_.Invalidate(); + state_.Reset(); EXPECT_TRUE(builder_.AddTarget("foo.o", &err)); EXPECT_TRUE(builder_.Build(&err)); ASSERT_EQ("", err); |