diff options
author | Nico Weber <nicolasweber@gmx.de> | 2015-03-15 23:34:03 (GMT) |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2015-03-15 23:34:03 (GMT) |
commit | 56e9d08c028d2c16f787041dc1f41271464a8bdc (patch) | |
tree | 7c666efb09121fba46787e3bd3b47bf28ddeb5f2 /src/test.h | |
parent | 51f06facf46e7a1a5338a4ca2ec9b8441c44c405 (diff) | |
download | Ninja-56e9d08c028d2c16f787041dc1f41271464a8bdc.zip Ninja-56e9d08c028d2c16f787041dc1f41271464a8bdc.tar.gz Ninja-56e9d08c028d2c16f787041dc1f41271464a8bdc.tar.bz2 |
Build self-consistent graphs for dupe edges with multiple outputs.
Fixes #867, both the crashes and "[stuck]" issues.
The problem was that a duplicate edge would modify the in_edge of the
outputs of the new build rule, but the edge corresponding to the old
build rule would still think that the in_edge points to itself.
`old_edge->outputs_[0]->in_edge()` would not return `old_edge`, which
confused the scan logic.
As fix, let `State::AddOut()` reject changing in_edge if it's already
set. This changes behavior in a minor way: Previously, if there were
multiple edges for a single output, the last edge would be kept. Now,
the first edge is kept. This only had mostly-well-defined semantics if
all duplicate edges are the same (which is the only case I've seen in
practice), and for that case the behavior doesn't change.
For testing, add a VerifyGraph() function and call that every time any
test graph is parsed. That's a bit more code than just copying the test
cases from the bug into build_test.cc, but it also yields better test
coverage overall.
Diffstat (limited to 'src/test.h')
-rw-r--r-- | src/test.h | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -124,6 +124,7 @@ struct StateTestWithBuiltinRules : public testing::Test { void AssertParse(State* state, const char* input); void AssertHash(const char* expected, uint64_t actual); +void VerifyGraph(const State& state); /// An implementation of DiskInterface that uses an in-memory representation /// of disk state. It also logs file accesses and directory creations |