diff options
| author | Martin Braun <martin.braun@ettus.com> | 2022-03-16 16:49:21 +0100 | 
|---|---|---|
| committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2022-03-30 10:28:07 -0700 | 
| commit | 4cd0d9bea9833872ce3ff7cf2999015d53ebabed (patch) | |
| tree | 7bf13a83cde1b165159876e411e85da5f87e6e43 | |
| parent | 9573640db723386d029a294620c5b48c4d4d13d6 (diff) | |
| download | uhd-4cd0d9bea9833872ce3ff7cf2999015d53ebabed.tar.gz uhd-4cd0d9bea9833872ce3ff7cf2999015d53ebabed.tar.bz2 uhd-4cd0d9bea9833872ce3ff7cf2999015d53ebabed.zip | |
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
| -rw-r--r-- | host/tests/rfnoc_graph_mock_nodes.hpp | 21 | 
1 files changed, 21 insertions, 0 deletions
| 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<data_t>(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<action_info::sptr> received_actions;  private: | 
