diff options
author | Brad King <brad.king@kitware.com> | 2015-11-13 21:03:16 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-06-19 15:08:26 (GMT) |
commit | 721d2a26b629d8556b73ce051f982967428d0738 (patch) | |
tree | 7ab9435ab98f5122d72dd1595a8934e633e9747c /src/build_test.cc | |
parent | b6f020d3640988824b1fe4355996ef0726a2c44c (diff) | |
download | Ninja-721d2a26b629d8556b73ce051f982967428d0738.zip Ninja-721d2a26b629d8556b73ce051f982967428d0738.tar.gz Ninja-721d2a26b629d8556b73ce051f982967428d0738.tar.bz2 |
Drop unnecessary cycle detection in Plan::AddTarget
We now detect and reject cycles in DependencyScan::RecomputeDirty before
Plan::AddTarget is called so we can assume DAG input to the Plan.
Diffstat (limited to 'src/build_test.cc')
-rw-r--r-- | src/build_test.cc | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/src/build_test.cc b/src/build_test.cc index 8c9fb11..a0f898f 100644 --- a/src/build_test.cc +++ b/src/build_test.cc @@ -185,59 +185,6 @@ TEST_F(PlanTest, DoubleDependent) { ASSERT_FALSE(edge); // done } -TEST_F(PlanTest, DependencyCycle) { - ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, -"build out: cat mid\n" -"build mid: cat in\n" -"build in: cat pre\n" -"build pre: cat out\n")); - GetNode("out")->MarkDirty(); - GetNode("mid")->MarkDirty(); - GetNode("in")->MarkDirty(); - GetNode("pre")->MarkDirty(); - - string err; - EXPECT_FALSE(plan_.AddTarget(GetNode("out"), &err)); - ASSERT_EQ("dependency cycle: out -> mid -> in -> pre -> out", err); -} - -TEST_F(PlanTest, CycleInEdgesButNotInNodes1) { - string err; - ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, -"build a b: cat a\n")); - EXPECT_FALSE(plan_.AddTarget(GetNode("b"), &err)); - ASSERT_EQ("dependency cycle: a -> a", err); -} - -TEST_F(PlanTest, CycleInEdgesButNotInNodes2) { - string err; - ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, -"build b a: cat a\n")); - EXPECT_FALSE(plan_.AddTarget(GetNode("b"), &err)); - ASSERT_EQ("dependency cycle: a -> a", err); -} - -TEST_F(PlanTest, CycleInEdgesButNotInNodes3) { - string err; - ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, -"build a b: cat c\n" -"build c: cat a\n")); - EXPECT_FALSE(plan_.AddTarget(GetNode("b"), &err)); - ASSERT_EQ("dependency cycle: c -> a -> c", err); -} - -TEST_F(PlanTest, CycleInEdgesButNotInNodes4) { - string err; - ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, -"build d: cat c\n" -"build c: cat b\n" -"build b: cat a\n" -"build a e: cat d\n" -"build f: cat e\n")); - EXPECT_FALSE(plan_.AddTarget(GetNode("f"), &err)); - ASSERT_EQ("dependency cycle: d -> c -> b -> a -> d", err); -} - void PlanTest::TestPoolWithDepthOne(const char* test_case) { ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, test_case)); GetNode("out1")->MarkDirty(); |