From 4cd0d9bea9833872ce3ff7cf2999015d53ebabed Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Wed, 16 Mar 2022 16:49:21 +0100 Subject: tests: rfnoc: Amend mock nodes with action support - Allow mock radios to generate mock overruns/underruns - Allow terminator blocks to inject arbitrary actions for testing purposes --- host/tests/rfnoc_graph_mock_nodes.hpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/host/tests/rfnoc_graph_mock_nodes.hpp b/host/tests/rfnoc_graph_mock_nodes.hpp index 0cde78cdc..123d08990 100644 --- a/host/tests/rfnoc_graph_mock_nodes.hpp +++ b/host/tests/rfnoc_graph_mock_nodes.hpp @@ -126,6 +126,22 @@ public: return 1; } + // Mock overrun + void generate_overrun(const size_t chan) + { + auto rx_event_action = + rx_event_action_info::make(uhd::rx_metadata_t::ERROR_CODE_OVERFLOW); + post_action(res_source_info{res_source_info::OUTPUT_EDGE, chan}, rx_event_action); + } + + // Mock underrun (note: we use tick rate 1.0 for calculating ticks from time!) + void generate_underrun(const size_t chan, uhd::time_spec_t time_spec) + { + auto tx_event_action = tx_event_action_info::make( + uhd::async_metadata_t::EVENT_CODE_UNDERFLOW, time_spec.to_ticks(1.0)); + post_action(res_source_info{res_source_info::INPUT_EDGE, chan}, tx_event_action); + } + // Some public attributes that help debugging size_t rssi_resolver_count = 0; bool disable_samp_out_resolver = false; @@ -416,6 +432,11 @@ public: return get_property(id, edge_info); } + void post_action(const res_source_info& edge_info, action_info::sptr action) + { + node_t::post_action(edge_info, action); + } + std::list received_actions; private: -- cgit v1.2.3