From 0f8718176993b3460b12720e639b030be9b86943 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Sat, 1 Jun 2019 23:41:47 -0700 Subject: rfnoc: graph: Add commit/release API --- host/tests/actions_test.cpp | 2 +- host/tests/rfnoc_detailgraph_test.cpp | 4 ++-- host/tests/rfnoc_propprop_test.cpp | 15 +++++++++++---- 3 files changed, 14 insertions(+), 7 deletions(-) (limited to 'host/tests') diff --git a/host/tests/actions_test.cpp b/host/tests/actions_test.cpp index b5feb2521..9218ad231 100644 --- a/host/tests/actions_test.cpp +++ b/host/tests/actions_test.cpp @@ -64,7 +64,7 @@ BOOST_AUTO_TEST_CASE(test_actions_simple_graph) graph.connect(&mock_rx_radio, &mock_ddc, {0, 0, graph_edge_t::DYNAMIC, true}); graph.connect(&mock_ddc, &mock_fifo, {0, 0, graph_edge_t::DYNAMIC, true}); graph.connect(&mock_fifo, &mock_streamer, {0, 0, graph_edge_t::DYNAMIC, true}); - graph.initialize(); + graph.commit(); // Force the DDC to actually set a decimation rate != 1 mock_streamer.set_property("samp_rate", 10e6, 0); diff --git a/host/tests/rfnoc_detailgraph_test.cpp b/host/tests/rfnoc_detailgraph_test.cpp index 6273430e6..efae9ff4f 100644 --- a/host/tests/rfnoc_detailgraph_test.cpp +++ b/host/tests/rfnoc_detailgraph_test.cpp @@ -151,7 +151,7 @@ BOOST_AUTO_TEST_CASE(test_graph) topo_sorted_nodes.at(0)->get_unique_id(), mock_rx_radio.get_unique_id()); // Now initialize the graph (will force a call to resolve_all_properties()) - graph.initialize(); + graph.commit(); // This will be ignored graph.connect(&mock_rx_radio, &mock_tx_radio, edge_info); @@ -195,7 +195,7 @@ BOOST_AUTO_TEST_CASE(test_graph_unresolvable) // Now create the graph and commit: graph.connect(&mock_rx_radio, &mock_tx_radio, edge_info); - graph.initialize(); + graph.commit(); // Now set a property that will cause the graph to fail to resolve: BOOST_REQUIRE_THROW(mock_tx_radio.set_property("master_clock_rate", 100e6, 0), diff --git a/host/tests/rfnoc_propprop_test.cpp b/host/tests/rfnoc_propprop_test.cpp index 20d7d96f5..8942a59f0 100644 --- a/host/tests/rfnoc_propprop_test.cpp +++ b/host/tests/rfnoc_propprop_test.cpp @@ -246,7 +246,7 @@ BOOST_AUTO_TEST_CASE(test_graph_resolve_ddc_radio) // Now create the graph and commit: graph.connect(&mock_rx_radio, &mock_ddc, edge_info); graph.connect(&mock_ddc, &mock_tx_radio, edge_info); - graph.initialize(); + graph.commit(); BOOST_CHECK_EQUAL(mock_ddc._decim.get(), 1); mock_tx_radio.set_property("master_clock_rate", 100e6, 0); @@ -256,6 +256,13 @@ BOOST_AUTO_TEST_CASE(test_graph_resolve_ddc_radio) mock_ddc.set_property("decim", 42, 0); // It will bounce back: BOOST_CHECK_EQUAL(mock_ddc._decim.get(), 2); + + graph.release(); + mock_tx_radio.set_property("master_clock_rate", 200e6, 0); + // Won't change yet: + BOOST_CHECK_EQUAL(mock_ddc._decim.get(), 2); + graph.commit(); + BOOST_CHECK_EQUAL(mock_ddc._decim.get(), 1); } @@ -284,7 +291,7 @@ BOOST_AUTO_TEST_CASE(test_graph_catch_invalid_graph) // Now create the graph and commit: graph.connect(&mock_rx_radio, &mock_tx_radio, edge_info); - BOOST_REQUIRE_THROW(graph.initialize(), uhd::resolve_error); + BOOST_REQUIRE_THROW(graph.commit(), uhd::resolve_error); UHD_LOG_INFO("TEST", "^^^ Expected an error message."); } @@ -314,7 +321,7 @@ BOOST_AUTO_TEST_CASE(test_graph_ro_prop) // Now create the graph and commit: graph.connect(&mock_rx_radio, &mock_tx_radio, edge_info); - graph.initialize(); + graph.commit(); const size_t rx_rssi_resolver_count = mock_rx_radio.rssi_resolver_count; UHD_LOG_DEBUG("TEST", "RX RSSI: " << mock_rx_radio.get_property("rssi")); @@ -408,7 +415,7 @@ BOOST_AUTO_TEST_CASE(test_graph_crisscross_fifo) graph.connect(&mock_fifo, &mock_tx_radio0, {1, 0, graph_edge_t::DYNAMIC, true}); graph.connect(&mock_fifo, &mock_tx_radio1, {0, 0, graph_edge_t::DYNAMIC, true}); UHD_LOG_INFO("TEST", "Now testing criss-cross prop resolution"); - graph.initialize(); + graph.commit(); } BOOST_AUTO_TEST_CASE(test_circular_deps) -- cgit v1.2.3