struct Node;
struct FileStat {
- FileStat(const string& path) : path_(path), mtime_(0), node_(NULL) {}
+ FileStat(const string& path) : path_(path), mtime_(-1), node_(NULL) {}
void Touch(int mtime);
// Return true if the file exists (mtime_ got a value).
bool Stat();
string path_;
+ // Possible values of mtime_:
+ // -1: file hasn't been examined
+ // 0: we looked, and file doesn't exist
+ // >0: actual file's mtime
time_t mtime_;
Node* node_;
};
"\n"
"build cat1: cat in1\n"
"build cat2: cat in1 in2\n"
-"build cat12: cat cat1 cat2\n",
+"build cat12: cat cat1 cat2\n"
+"\n"
+"build c2: cat c1\n"
+"build c3: cat c2\n"
+"build c4: cat c3\n"
+"build c5: cat c4\n",
&err));
ASSERT_EQ("", err);
}
EXPECT_EQ("cat in1 in2 > cat2", commands_ran_[3]);
EXPECT_EQ("cat cat1 cat2 > cat12", commands_ran_[4]);
}
+
+TEST_F(BuildTest, Chain) {
+ string err;
+ builder_.AddTarget("c5");
+ EXPECT_TRUE(builder_.Build(this, &err));
+ EXPECT_EQ("", err);
+ ASSERT_EQ(5, commands_ran_.size());
+}