diff options
Diffstat (limited to 'host/tests/rfnoc_graph_mock_nodes.hpp')
-rw-r--r-- | host/tests/rfnoc_graph_mock_nodes.hpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/host/tests/rfnoc_graph_mock_nodes.hpp b/host/tests/rfnoc_graph_mock_nodes.hpp index 63e8bc534..c28256b67 100644 --- a/host/tests/rfnoc_graph_mock_nodes.hpp +++ b/host/tests/rfnoc_graph_mock_nodes.hpp @@ -11,6 +11,7 @@ #include <uhd/rfnoc/node.hpp> #include <uhd/types/stream_cmd.hpp> #include <uhdlib/rfnoc/node_accessor.hpp> +#include <list> using namespace uhd::rfnoc; @@ -358,11 +359,22 @@ class mock_terminator_t : public node_t public: static size_t counter; - mock_terminator_t(const size_t num_ports) + mock_terminator_t( + const size_t num_ports, const std::vector<std::string> expected_actions = {}) : _num_ports(num_ports), _term_count(counter++) { set_prop_forwarding_policy(forwarding_policy_t::DROP); set_action_forwarding_policy(forwarding_policy_t::DROP); + for (const auto& action_key : expected_actions) { + RFNOC_LOG_DEBUG("Adding action handler for key " << action_key); + register_action_handler( + action_key, [this](const res_source_info& src, action_info::sptr action) { + RFNOC_LOG_INFO( + "Received action: key=" << action->key << ", id=" << action->id + << ", src edge=" << src.to_string()); + received_actions.push_back(action); + }); + } } std::string get_unique_id() const @@ -405,6 +417,8 @@ public: return get_property<data_t>(id, edge_info); } + std::list<action_info::sptr> received_actions; + private: const size_t _num_ports; const size_t _term_count; |