From 1d2ec743170b03a1c1f9618cb48809b2d9794084 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Wed, 16 Mar 2022 16:50:16 +0100 Subject: rfnoc: replay: Add ability to capture and read async info - Add action handlers to the replay block to store TX and RX events. - Adds two new APIs: get_{record,play}_async_metadata() to read back async info. - Add unit tests. --- host/tests/rfnoc_block_tests/replay_block_test.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'host/tests') diff --git a/host/tests/rfnoc_block_tests/replay_block_test.cpp b/host/tests/rfnoc_block_tests/replay_block_test.cpp index 11c621b5a..94f1ce882 100644 --- a/host/tests/rfnoc_block_tests/replay_block_test.cpp +++ b/host/tests/rfnoc_block_tests/replay_block_test.cpp @@ -749,8 +749,6 @@ BOOST_FIXTURE_TEST_CASE(replay_test_graph, replay_block_fixture) node_accessor.init_props(&mock_ddc_block); mock_sink_term.set_edge_property( "type", "sc16", {res_source_info::INPUT_EDGE, 0}); - mock_sink_term.set_edge_property( - "type", "sc16", {res_source_info::INPUT_EDGE, 1}); UHD_LOG_INFO("TEST", "Creating graph..."); graph.connect(&mock_radio_block, &mock_ddc_block, edge_port_info); @@ -758,7 +756,22 @@ BOOST_FIXTURE_TEST_CASE(replay_test_graph, replay_block_fixture) graph.connect(test_replay.get(), &mock_sink_term, edge_port_info); UHD_LOG_INFO("TEST", "Committing graph..."); graph.commit(); + mock_sink_term.set_edge_property( + "tick_rate", 1.0, {res_source_info::INPUT_EDGE, 0}); UHD_LOG_INFO("TEST", "Commit complete."); + + mock_radio_block.generate_overrun(0); + uhd::rx_metadata_t rx_md; + BOOST_REQUIRE(test_replay->get_record_async_metadata(rx_md, 1.0)); + BOOST_CHECK(rx_md.error_code == uhd::rx_metadata_t::ERROR_CODE_OVERFLOW); + + mock_sink_term.post_action(res_source_info{res_source_info::INPUT_EDGE, 0}, + tx_event_action_info::make(uhd::async_metadata_t::EVENT_CODE_UNDERFLOW, 1234ul)); + uhd::async_metadata_t tx_md; + BOOST_REQUIRE(test_replay->get_play_async_metadata(tx_md, 1.0)); + BOOST_CHECK(tx_md.event_code == uhd::async_metadata_t::EVENT_CODE_UNDERFLOW); + BOOST_CHECK(tx_md.has_time_spec); + BOOST_CHECK(tx_md.time_spec == 1234.0); } /* -- cgit v1.2.3