diff options
author | Nico Weber <nicolasweber@gmx.de> | 2015-01-20 05:20:15 (GMT) |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2015-01-20 05:20:15 (GMT) |
commit | a87516edd643e15d3a2a51048e6b507683f63ea7 (patch) | |
tree | 6ca0dcfef7aab4aefb5aad5de1011ed886392749 /src | |
parent | 81d43ed3ee5b399f69fdff4b520523d43ae0c2d4 (diff) | |
download | Ninja-a87516edd643e15d3a2a51048e6b507683f63ea7.zip Ninja-a87516edd643e15d3a2a51048e6b507683f63ea7.tar.gz Ninja-a87516edd643e15d3a2a51048e6b507683f63ea7.tar.bz2 |
Remove an incorrect assert.
The assert fires on cyclic manifests (found by afl-fuzz). Since there
was explicit error handing for this case already, just remove the
assert.
Diffstat (limited to 'src')
-rw-r--r-- | src/manifest_parser_test.cc | 10 | ||||
-rw-r--r-- | src/state.cc | 1 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/manifest_parser_test.cc b/src/manifest_parser_test.cc index 6909ea9..a8f2e53 100644 --- a/src/manifest_parser_test.cc +++ b/src/manifest_parser_test.cc @@ -891,6 +891,16 @@ TEST_F(ParserTest, DefaultDefault) { EXPECT_EQ("", err); } +TEST_F(ParserTest, DefaultDefaultCycle) { + ASSERT_NO_FATAL_FAILURE(AssertParse( +"rule cat\n command = cat $in > $out\n" +"build a: cat a\n")); + + string err; + EXPECT_EQ(0u, state.DefaultNodes(&err).size()); + EXPECT_EQ("could not determine root nodes of build graph", err); +} + TEST_F(ParserTest, DefaultStatements) { ASSERT_NO_FATAL_FAILURE(AssertParse( "rule cat\n command = cat $in > $out\n" diff --git a/src/state.cc b/src/state.cc index 6e3e10d..1ceda45 100644 --- a/src/state.cc +++ b/src/state.cc @@ -187,7 +187,6 @@ vector<Node*> State::RootNodes(string* err) { if (!edges_.empty() && root_nodes.empty()) *err = "could not determine root nodes of build graph"; - assert(edges_.empty() || !root_nodes.empty()); return root_nodes; } |