diff options
author | Evan Martin <martine@danga.com> | 2011-01-08 22:43:35 (GMT) |
---|---|---|
committer | Evan Martin <martine@danga.com> | 2011-01-08 22:43:35 (GMT) |
commit | 51f8b71d96674ba28fa47287a65b84bffad7769f (patch) | |
tree | 530e818cc83c306038f15894fbfcbce4cbf6b8a6 | |
parent | fd7dd853e9cae9725ddae0c60252d2d212632bcc (diff) | |
download | Ninja-51f8b71d96674ba28fa47287a65b84bffad7769f.zip Ninja-51f8b71d96674ba28fa47287a65b84bffad7769f.tar.gz Ninja-51f8b71d96674ba28fa47287a65b84bffad7769f.tar.bz2 |
remove ResetDirty
-rw-r--r-- | src/build_test.cc | 14 | ||||
-rw-r--r-- | src/ninja_test.cc | 9 | ||||
-rw-r--r-- | src/test.h | 3 |
3 files changed, 4 insertions, 22 deletions
diff --git a/src/build_test.cc b/src/build_test.cc index e6ff1c7..2588174 100644 --- a/src/build_test.cc +++ b/src/build_test.cc @@ -163,7 +163,10 @@ TEST_F(PlanTest, DependencyCycle) { "build mid: cat in\n" "build in: cat pre\n" "build pre: cat out\n"); - ResetDirty(); + GetNode("out")->dirty_ = true; + GetNode("mid")->dirty_ = true; + GetNode("in")->dirty_ = true; + GetNode("pre")->dirty_ = true; string err; EXPECT_FALSE(plan_.AddTarget(GetNode("out"), &err)); @@ -328,8 +331,6 @@ TEST_F(BuildTest, OneStep2) { } TEST_F(BuildTest, TwoStep) { - ResetDirty(); - string err; EXPECT_TRUE(builder_.AddTarget("cat12", &err)); ASSERT_EQ("", err); @@ -360,7 +361,6 @@ TEST_F(BuildTest, Chain) { "build c4: cat c3\n" "build c5: cat c4\n")); - ResetDirty(); fs_.Create("c1", now_, ""); string err; @@ -408,7 +408,6 @@ TEST_F(BuildTest, MakeDirs) { ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "build subdir/dir2/file: cat in1\n")); - ResetDirty(); EXPECT_TRUE(builder_.AddTarget("subdir/dir2/file", &err)); EXPECT_EQ("", err); now_ = 0; // Make all stat()s return file not found. @@ -424,7 +423,6 @@ TEST_F(BuildTest, DepFileMissing) { ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "rule cc\n command = cc $in\n depfile = $out.d\n" "build foo.o: cc foo.c\n")); - ResetDirty(); fs_.Create("foo.c", now_, ""); EXPECT_TRUE(builder_.AddTarget("foo.o", &err)); @@ -439,7 +437,6 @@ TEST_F(BuildTest, DepFileOK) { ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "rule cc\n command = cc $in\n depfile = $out.d\n" "build foo.o: cc foo.c\n")); - ResetDirty(); fs_.Create("foo.c", now_, ""); GetNode("bar.h")->dirty_ = true; // Mark bar.h as missing. fs_.Create("foo.o.d", now_, "foo.o: blah.h bar.h\n"); @@ -462,7 +459,6 @@ TEST_F(BuildTest, DepFileParseError) { ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "rule cc\n command = cc $in\n depfile = $out.d\n" "build foo.o: cc foo.c\n")); - ResetDirty(); fs_.Create("foo.c", now_, ""); fs_.Create("foo.o.d", now_, "foo.o blah.h bar.h\n"); EXPECT_FALSE(builder_.AddTarget("foo.o", &err)); @@ -474,7 +470,6 @@ TEST_F(BuildTest, OrderOnlyDeps) { ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "rule cc\n command = cc $in\n depfile = $out.d\n" "build foo.o: cc foo.c | otherfile\n")); - ResetDirty(); fs_.Create("foo.c", now_, ""); fs_.Create("otherfile", now_, ""); fs_.Create("foo.o.d", now_, "foo.o: blah.h bar.h\n"); @@ -522,7 +517,6 @@ TEST_F(BuildTest, Phony) { ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "build out: cat bar.cc\n" "build all: phony out\n")); - ResetDirty(); fs_.Create("bar.cc", now_, ""); EXPECT_TRUE(builder_.AddTarget("all", &err)); diff --git a/src/ninja_test.cc b/src/ninja_test.cc index b0c19dd..7e8bdc0 100644 --- a/src/ninja_test.cc +++ b/src/ninja_test.cc @@ -23,15 +23,6 @@ Node* StateTestWithBuiltinRules::GetNode(const string& path) { return state_.GetNode(path); } -void StateTestWithBuiltinRules::ResetDirty() { - for (StatCache::Paths::iterator i = state_.stat_cache_.paths_.begin(); - i != state_.stat_cache_.paths_.end(); ++i) { - Node* node = i->second->node_; - // Mark node dirty if we have a way to rebuild it. - node->dirty_ = node->in_edge_ != NULL; - } -} - TEST(State, Basic) { State state; Rule* rule = new Rule("cat"); @@ -7,9 +7,6 @@ struct StateTestWithBuiltinRules : public testing::Test { StateTestWithBuiltinRules(); Node* GetNode(const string& path); - // Mark every non-leaf node dirty. - void ResetDirty(); - State state_; }; |