From f0c147d50f1a334e2f1971b27a23107bda4816f7 Mon Sep 17 00:00:00 2001 From: Magnus Jacobsson Date: Mon, 9 Aug 2021 19:41:35 +0200 Subject: [PATCH] fix multiple layout test case using rvalue refs The first layout of a graph must be destroyed before a second layout is created. This failure went undetected in CI since no test programs ran, which in turn was caused by not archiving the test programs or the CTestTestfile.cmake files in the preceding build job. The error message was: ------------------------------------------------------------------------------- Multiple layouts of the same graph can use different contexts passed as rvalue refs ------------------------------------------------------------------------------- ../tests/test_GVLayout_construction.cpp:139 ............................................................................... ../tests/test_GVLayout_construction.cpp:139: FAILED: due to unexpected exception with message: Previous layout not yet destroyed --- tests/test_GVLayout_construction.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/test_GVLayout_construction.cpp b/tests/test_GVLayout_construction.cpp index 146ea7559..ffd5ce8b6 100644 --- a/tests/test_GVLayout_construction.cpp +++ b/tests/test_GVLayout_construction.cpp @@ -143,10 +143,13 @@ TEST_CASE("Multiple layouts of the same graph can use different contexts " auto dot = "graph {}"; auto g = std::make_shared(dot); - const auto layout1 = GVC::GVLayout(std::move(gvc1), g, "dot"); + // create a layout and automatically destroy it + { const auto layout1 = GVC::GVLayout(std::move(gvc1), g, "dot"); } auto gvc2 = GVC::GVContext(lt_preloaded_symbols, demand_loading); - const auto layout2 = GVC::GVLayout(std::move(gvc2), g, "dot"); + + // create another layout and automatically destroy it + { const auto layout2 = GVC::GVLayout(std::move(gvc2), g, "dot"); } } TEST_CASE("Layout with an unknown engine throws an exception") { -- 2.49.0