30 "build in1: cat src1\n" 31 "build out1: cat in1\n" 32 "build in2: cat src2\n" 33 "build out2: cat in2\n"));
60 "build in1: cat src1\n" 61 "build out1: cat in1\n" 62 "build in2: cat src2\n" 63 "build out2: cat in2\n"));
91 "build in1: cat src1\n" 92 "build out1: cat in1\n" 93 "build in2: cat src2\n" 94 "build out2: cat in2\n"));
109 EXPECT_EQ(0,
fs_.
Stat(
"out1"));
111 EXPECT_NE(0,
fs_.
Stat(
"out2"));
121 "build in1: cat src1\n" 122 "build out1: cat in1\n" 123 "build in2: cat src2\n" 124 "build out2: cat in2\n"));
140 EXPECT_NE(0,
fs_.
Stat(
"out1"));
142 EXPECT_NE(0,
fs_.
Stat(
"out2"));
153 " command = cat -e $in > $out\n" 154 "build in1: cat_e src1\n" 155 "build out1: cat in1\n" 156 "build in2: cat_e src2\n" 157 "build out2: cat in2\n"));
166 ASSERT_EQ(0, cleaner.
CleanRule(
"cat_e"));
172 EXPECT_NE(0,
fs_.
Stat(
"out1"));
174 EXPECT_NE(0,
fs_.
Stat(
"out2"));
177 ASSERT_EQ(0, cleaner.
CleanRule(
"cat_e"));
185 " command = cat -e $in > $out\n" 186 "build in1: cat_e src1\n" 187 "build out1: cat in1\n" 188 "build in2: cat_e src2\n" 189 "build out2: cat in2\n"));
199 ASSERT_EQ(0, cleaner.
CleanRule(
"cat_e"));
205 EXPECT_NE(0,
fs_.
Stat(
"out1"));
207 EXPECT_NE(0,
fs_.
Stat(
"out2"));
210 ASSERT_EQ(0, cleaner.
CleanRule(
"cat_e"));
218 " command = cat $in > $out\n" 220 "build out1: cat in1\n" 221 "build out2: regen in2\n"));
232 EXPECT_EQ(0, cleaner.
CleanAll(
true));
240 " command = cc $in > $out\n" 241 " depfile = $out.d\n" 242 "build out1: cc in1\n"));
255 " command = cc $in > $out\n" 256 " depfile = $out.d\n" 257 "build out1: cc in1\n"));
270 " command = cc $in > $out\n" 271 " depfile = $out.d\n" 272 "build out1: cc in1\n"));
285 " command = cc $in > $out\n" 286 " rspfile = $rspfile\n" 287 " rspfile_content=$in\n" 288 "build out1: cc in1\n" 289 " rspfile = cc1.rsp\n"));
302 " command = cat $rspfile > $out\n" 303 " rspfile = $rspfile\n" 304 " rspfile_content = $in\n" 305 "build in1: cat src1\n" 306 "build out1: cat in1\n" 307 "build in2: cat_rsp src2\n" 309 "build out2: cat_rsp in2\n" 310 " rspfile=out2.rsp\n" 325 ASSERT_EQ(0, cleaner.
CleanRule(
"cat_rsp"));
332 EXPECT_EQ(0,
fs_.
Stat(
"out1"));
334 EXPECT_EQ(0,
fs_.
Stat(
"out2"));
335 EXPECT_EQ(0,
fs_.
Stat(
"in2.rsp"));
336 EXPECT_EQ(0,
fs_.
Stat(
"out2.rsp"));
341 "build dir: cat src1\n"));
349 "build phony: phony t1 t2\n" 361 EXPECT_NE(0,
fs_.
Stat(
"phony"));
369 EXPECT_NE(0,
fs_.
Stat(
"phony"));
375 " command = cc $in > $out\n" 376 " depfile = $out.d\n" 378 " command = cc $in > $out\n" 379 " rspfile = $out.rsp\n" 380 " rspfile_content = $in\n" 381 "build out$ 1: cc_dep in$ 1\n" 382 "build out$ 2: cc_rsp in$ 1\n" 394 EXPECT_EQ(0,
fs_.
Stat(
"out 1"));
395 EXPECT_EQ(0,
fs_.
Stat(
"out 2"));
396 EXPECT_EQ(0,
fs_.
Stat(
"out 1.d"));
397 EXPECT_EQ(0,
fs_.
Stat(
"out 2.rsp"));
An implementation of DiskInterface that uses an in-memory representation of disk state.
set< string > files_removed_
void AssertParse(State *state, const char *input)
void Create(const string &path, const string &contents)
"Create" a file with contents.
A base test fixture that includes a State object with a builtin "cat" rule.
int CleanAll(bool generator=false)
Clean all built files, except for files created by generator rules.
int CleanRule(const Rule *rule)
Clean all the file built with the given rule rule.
virtual bool MakeDir(const string &path)
Create a directory, returning false on failure.
virtual TimeStamp Stat(const string &path) const
stat() a file, returning the mtime, or 0 if missing and -1 on other errors.
TEST_F(CleanTest, CleanAll)
Options (e.g. verbosity, parallelism) passed to a build.
int cleaned_files_count() const
int CleanTarget(Node *target)
Clean the given target and all the file built for it.