29 "build out: cat in | implicit\n"));
31 fs_.Create(
"out",
"");
33 Edge* edge = GetNode(
"out")->in_edge();
35 EXPECT_TRUE(scan_.RecomputeDirty(edge, &err));
41 EXPECT_TRUE(GetNode(
"out")->dirty());
46 "build out: cat in | implicit\n"));
48 fs_.Create(
"out",
"");
50 fs_.Create(
"implicit",
"");
52 Edge* edge = GetNode(
"out")->in_edge();
54 EXPECT_TRUE(scan_.RecomputeDirty(edge, &err));
58 EXPECT_TRUE(GetNode(
"out")->dirty());
65 " command = cat $in > $out\n"
66 "build out.o: catdep foo.cc\n"));
67 fs_.Create(
"foo.cc",
"");
68 fs_.Create(
"out.o.d",
"out.o: ./foo/../implicit.h\n");
69 fs_.Create(
"out.o",
"");
71 fs_.Create(
"implicit.h",
"");
73 Edge* edge = GetNode(
"out.o")->in_edge();
75 EXPECT_TRUE(scan_.RecomputeDirty(edge, &err));
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"));
90 fs_.Create(
"implicit.h",
"");
91 fs_.Create(
"foo.cc",
"");
92 fs_.Create(
"out.o.d",
"out.o: implicit.h\n");
93 fs_.Create(
"out.o",
"");
95 fs_.Create(
"data",
"");
97 Edge* edge = GetNode(
"out.o")->in_edge();
99 EXPECT_TRUE(scan_.RecomputeDirty(edge, &err));
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"));
114 fs_.Create(
"foo.cc",
"");
115 fs_.Create(
"out.o.d",
"out.o: foo.cc\n");
116 fs_.Create(
"out.o",
"");
118 Edge* edge = GetNode(
"out.o")->in_edge();
120 EXPECT_TRUE(scan_.RecomputeDirty(edge, &err));
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"));
134 vector<Node*> root_nodes = state_.RootNodes(&err);
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"));
146 Edge* edge = GetNode(
"a b")->in_edge();
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"));
163 fs_.Create(
"foo.cc",
"");
164 fs_.Create(
"out.o.d",
"out.o: bar/../foo.cc\n");
165 fs_.Create(
"out.o",
"");
167 Edge* edge = GetNode(
"out.o")->in_edge();
169 EXPECT_TRUE(scan_.RecomputeDirty(edge, &err));
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"));
182 fs_.Create(
"foo.h",
"");
183 fs_.Create(
"foo.cc",
"");
185 fs_.Create(
"out.o.d",
"out.o: foo.h\n");
186 fs_.Create(
"out.o",
"");
188 Edge* edge = GetNode(
"out.o")->in_edge();
190 EXPECT_TRUE(scan_.RecomputeDirty(edge, &err));
192 EXPECT_FALSE(GetNode(
"out.o")->dirty());
195 fs_.RemoveFile(
"out.o.d");
196 EXPECT_TRUE(scan_.RecomputeDirty(edge, &err));
198 EXPECT_TRUE(GetNode(
"out.o")->dirty());
206 " command = depfile is $depfile\n"
207 "build out: r in\n"));
208 Edge* edge = GetNode(
"out")->in_edge();
217 " command = unused\n"
220 Edge* edge = GetNode(
"out")->in_edge();
229 " command = depfile is $depfile\n"
232 Edge* edge = GetNode(
"out")->in_edge();
233 EXPECT_EQ(
"depfile is y", edge->
GetBinding(
"command"));
240 "build n2: phony n1\n"
243 Edge* edge = GetNode(
"n2")->in_edge();
244 EXPECT_TRUE(scan_.RecomputeDirty(edge, &err));
248 EXPECT_TRUE(plan_.
AddTarget(GetNode(
"n2"), &err));
An implementation of DiskInterface that uses an in-memory representation of disk state.
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 AddTarget(Node *node, string *err)
Add a target to our plan (including all its dependencies).
void AssertParse(State *state, const char *input)
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.
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...
TEST_F(GraphTest, MissingImplicit)