return 1;
}
+ state.stat_cache()->Dump();
Shell shell;
Builder builder(&state);
- Node* node = builder.AddTarget(argv[1]);
- node->in_edge_->RecomputeDirty(builder.stat_helper_);
+ builder.AddTarget(argv[1]);
state.stat_cache()->Dump();
bool success = builder.Build(&shell, &err);
virtual ~Builder() {}
Node* AddTarget(const string& name) {
- Node* node = plan_.AddTarget(name);
+ Node* node = plan_.state_->GetNode(name);
node->file_->StatIfNecessary(stat_helper_);
+ if (node->in_edge_)
+ node->in_edge_->RecomputeDirty(stat_helper_);
+ plan_.AddTarget(node);
return node;
}
bool Build(Shell* shell, string* err);
ASSERT_TRUE(GetNode("mid1")->dirty_);
ASSERT_EQ("in11", stats_[2]);
}
+
+
+TEST_F(StatTest, Middle) {
+ ASSERT_NO_FATAL_FAILURE(AssertParse(&state_,
+"build out: cat mid\n"
+"build mid: cat in\n"));
+
+ mtimes_["out"] = 1;
+ // mid remains missing.
+ mtimes_["in"] = 1;
+
+ Node* out = GetNode("out");
+ out->file_->Stat(this);
+ ASSERT_EQ(1, stats_.size());
+ Edge* edge = out->in_edge_;
+ edge->RecomputeDirty(this);
+ ASSERT_FALSE(GetNode("in")->dirty_);
+ ASSERT_TRUE(GetNode("mid")->dirty_);
+ ASSERT_TRUE(GetNode("out")->dirty_);
+}