summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-03-24 18:06:19 (GMT)
committerBrad King <brad.king@kitware.com>2021-03-24 19:38:30 (GMT)
commita5b178048746383ac8be231c074b11fbfce6f6c8 (patch)
treeb472a3a827ba8159164edfe47c7e7cce38c012d8 /src
parent8cd25aa78c2ff2ca8b3712f8c3630d1a095856d9 (diff)
downloadNinja-a5b178048746383ac8be231c074b11fbfce6f6c8.zip
Ninja-a5b178048746383ac8be231c074b11fbfce6f6c8.tar.gz
Ninja-a5b178048746383ac8be231c074b11fbfce6f6c8.tar.bz2
dyndep: add dedicated test for dyndep-discovered implicit dependencies
Previously this was covered only as part of more complex tests.
Diffstat (limited to 'src')
-rw-r--r--src/graph_test.cc31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/graph_test.cc b/src/graph_test.cc
index 14f6375..6b4bb51 100644
--- a/src/graph_test.cc
+++ b/src/graph_test.cc
@@ -511,6 +511,37 @@ TEST_F(GraphTest, DyndepLoadTrivial) {
EXPECT_FALSE(edge->GetBindingBool("restat"));
}
+TEST_F(GraphTest, DyndepLoadImplicit) {
+ AssertParse(&state_,
+"rule r\n"
+" command = unused\n"
+"build out1: r in || dd\n"
+" dyndep = dd\n"
+"build out2: r in\n"
+ );
+ fs_.Create("dd",
+"ninja_dyndep_version = 1\n"
+"build out1: dyndep | out2\n"
+ );
+
+ string err;
+ ASSERT_TRUE(GetNode("dd")->dyndep_pending());
+ EXPECT_TRUE(scan_.LoadDyndeps(GetNode("dd"), &err));
+ EXPECT_EQ("", err);
+ EXPECT_FALSE(GetNode("dd")->dyndep_pending());
+
+ Edge* edge = GetNode("out1")->in_edge();
+ ASSERT_EQ(1u, edge->outputs_.size());
+ EXPECT_EQ("out1", edge->outputs_[0]->path());
+ ASSERT_EQ(3u, edge->inputs_.size());
+ EXPECT_EQ("in", edge->inputs_[0]->path());
+ EXPECT_EQ("out2", edge->inputs_[1]->path());
+ EXPECT_EQ("dd", edge->inputs_[2]->path());
+ EXPECT_EQ(1u, edge->implicit_deps_);
+ EXPECT_EQ(1u, edge->order_only_deps_);
+ EXPECT_FALSE(edge->GetBindingBool("restat"));
+}
+
TEST_F(GraphTest, DyndepLoadMissingFile) {
AssertParse(&state_,
"rule r\n"