29 "build out: cat in | implicit\n"));
41 EXPECT_TRUE(
GetNode(
"out")->dirty());
46 "build out: cat in | implicit\n"));
58 EXPECT_TRUE(
GetNode(
"out")->dirty());
65 " command = cat $in > $out\n" 66 "build out.o: catdep foo.cc\n"));
68 fs_.
Create(
"out.o.d",
"out.o: ./foo/../implicit.h\n");
80 EXPECT_TRUE(
GetNode(
"out.o")->dirty());
87 " command = cat $in > $out\n" 88 "build implicit.h: cat data\n" 89 "build out.o: catdep foo.cc || implicit.h\n"));
92 fs_.
Create(
"out.o.d",
"out.o: implicit.h\n");
105 EXPECT_TRUE(
GetNode(
"out.o")->dirty());
111 " depfile = $out.d\n" 112 " command = cat $in > $out\n" 113 "build ./out.o: catdep ./foo.cc\n"));
115 fs_.
Create(
"out.o.d",
"out.o: foo.cc\n");
123 EXPECT_FALSE(
GetNode(
"out.o")->dirty());
128 "build out1: cat in1\n" 129 "build mid1: cat in1\n" 130 "build out2: cat mid1\n" 131 "build out3 out4: cat mid1\n"));
135 EXPECT_EQ(4u, root_nodes.size());
136 for (
size_t i = 0; i < root_nodes.size(); ++i) {
137 string name = root_nodes[i]->path();
138 EXPECT_EQ(
"out", name.substr(0, 3));
144 "build a$ b: cat no'space with$ space$$ no\"space2\n"));
148 EXPECT_EQ(
"cat no'space \"with space$\" \"no\\\"space2\" > \"a b\"",
151 EXPECT_EQ(
"cat 'no'\\''space' 'with space$' 'no\"space2' > 'a b'",
160 " depfile = $out.d\n" 161 " command = cat $in > $out\n" 162 "build ./out.o: catdep ./foo.cc\n"));
164 fs_.
Create(
"out.o.d",
"out.o: bar/../foo.cc\n");
172 EXPECT_FALSE(
GetNode(
"out.o")->dirty());
179 " depfile = $out.d\n" 180 " command = cat $in > $out\n" 181 "build ./out.o: catdep ./foo.cc\n"));
192 EXPECT_FALSE(
GetNode(
"out.o")->dirty());
198 EXPECT_TRUE(
GetNode(
"out.o")->dirty());
206 " command = depfile is $depfile\n" 207 "build out: r in\n"));
217 " command = unused\n" 229 " command = depfile is $depfile\n" 233 EXPECT_EQ(
"depfile is y", edge->
GetBinding(
"command"));
240 "build n2: phony n1\n"
An implementation of DiskInterface that uses an in-memory representation of disk state.
Node * GetNode(const string &path)
Short way to get a Node by its path from state_.
int Tick()
Tick "time" forwards; subsequent file operations will be newer than previous ones.
Plan stores the state of a build plan: what we intend to build, which steps we're ready to execute...
bool more_to_do() const
Returns true if there's more work to be done.
bool RecomputeDirty(Edge *edge, string *err)
Examine inputs, outputs, and command lines to judge whether an edge needs to be re-run, and update outputs_ready_ and each outputs' |dirty_| state accordingly.
bool AddTarget(Node *node, string *err)
Add a target to our plan (including all its dependencies).
void AssertParse(State *state, const char *input)
void Create(const string &path, const string &contents)
"Create" a file with contents.
An edge in the dependency graph; links between Nodes using Rules.
string EvaluateCommand(bool incl_rsp_file=false)
Expand all variables in a command and return it as a string.
A base test fixture that includes a State object with a builtin "cat" rule.
int command_edge_count() const
Number of edges with commands to run.
vector< Node * > RootNodes(string *error)
string GetBinding(const string &key)
Returns the shell-escaped value of |key|.
DependencyScan manages the process of scanning the files in a graph and updating the dirty/outputs_re...
virtual int RemoveFile(const string &path)
Remove the file named path.
TEST_F(GraphTest, MissingImplicit)