From 0738580e6ef03f9676632ffc3bc7e8d9fb0bc09f Mon Sep 17 00:00:00 2001 From: Trung Tran Date: Tue, 9 Oct 2018 11:22:28 -0700 Subject: tests: device3_test: add graph impl test --- host/tests/common/mock_zero_copy.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 host/tests/common/mock_zero_copy.cpp (limited to 'host/tests/common/mock_zero_copy.cpp') diff --git a/host/tests/common/mock_zero_copy.cpp b/host/tests/common/mock_zero_copy.cpp new file mode 100644 index 000000000..b1d384ec7 --- /dev/null +++ b/host/tests/common/mock_zero_copy.cpp @@ -0,0 +1,29 @@ +// +// Copyright 2018 Ettus Research, a National Instruments Company +// +// SPDX-License-Identifier: GPL-3.0-or-later +// + + +#include "mock_zero_copy.hpp" +#include + +uhd::transport::managed_recv_buffer::sptr mock_zero_copy::get_recv_buff(double) { + if (_rx_mems.empty()) { + return uhd::transport::managed_recv_buffer::sptr(); // timeout + } + _mrbs.push_back(boost::make_shared()); + uhd::transport::managed_recv_buffer::sptr mrb = + _mrbs.back()->get_new(_rx_mems.front(), _rx_lens.front()); + _rx_mems.pop_front(); + _rx_lens.pop_front(); + return mrb; +} + +uhd::transport::managed_send_buffer::sptr mock_zero_copy::get_send_buff(double) { + _msbs.push_back(boost::make_shared()); + _tx_mems.push_back( + boost::shared_array(new uint8_t[SEND_BUFF_SIZE])); + _tx_lens.push_back(SEND_BUFF_SIZE); + return _msbs.back()->get_new(_tx_mems.back(), &_tx_lens.back()); +} -- cgit v1.2.3