aboutsummaryrefslogtreecommitdiffstats
path: root/host/tests
diff options
context:
space:
mode:
Diffstat (limited to 'host/tests')
-rw-r--r--host/tests/CMakeLists.txt4
-rw-r--r--host/tests/sph_recv_test.cpp166
-rw-r--r--host/tests/sph_send_test.cpp44
3 files changed, 94 insertions, 120 deletions
diff --git a/host/tests/CMakeLists.txt b/host/tests/CMakeLists.txt
index 25679a33e..28cc1c5da 100644
--- a/host/tests/CMakeLists.txt
+++ b/host/tests/CMakeLists.txt
@@ -29,8 +29,8 @@ SET(test_sources
msg_test.cpp
property_test.cpp
ranges_test.cpp
- #TODO restore sph_recv_test.cpp
- #TODO restore sph_send_test.cpp
+ sph_recv_test.cpp
+ sph_send_test.cpp
subdev_spec_test.cpp
time_spec_test.cpp
vrt_test.cpp
diff --git a/host/tests/sph_recv_test.cpp b/host/tests/sph_recv_test.cpp
index 1387e3b66..3ca123ef2 100644
--- a/host/tests/sph_recv_test.cpp
+++ b/host/tests/sph_recv_test.cpp
@@ -16,6 +16,7 @@
//
#include <boost/test/unit_test.hpp>
+#define SRPH_TEST_MODE_ONE_PACKET
#include "../lib/transport/super_recv_packet_handler.hpp"
#include <boost/shared_array.hpp>
#include <boost/bind.hpp>
@@ -67,8 +68,8 @@ private:
**********************************************************************/
class dummy_recv_xport_class{
public:
- dummy_recv_xport_class(const uhd::otw_type_t &otw_type){
- _otw_type = otw_type;
+ dummy_recv_xport_class(const std::string &end){
+ _end = end;
}
void push_back_packet(
@@ -77,10 +78,10 @@ public:
){
const size_t max_pkt_len = (ifpi.num_payload_words32 + uhd::transport::vrt::max_if_hdr_words32 + 1/*tlr*/)*sizeof(boost::uint32_t);
_mems.push_back(boost::shared_array<char>(new char[max_pkt_len]));
- if (_otw_type.byteorder == uhd::otw_type_t::BO_BIG_ENDIAN){
+ if (_end == "big"){
uhd::transport::vrt::if_hdr_pack_be(reinterpret_cast<boost::uint32_t *>(_mems.back().get()), ifpi);
}
- if (_otw_type.byteorder == uhd::otw_type_t::BO_LITTLE_ENDIAN){
+ if (_end == "little"){
uhd::transport::vrt::if_hdr_pack_le(reinterpret_cast<boost::uint32_t *>(_mems.back().get()), ifpi);
}
(reinterpret_cast<boost::uint32_t *>(_mems.back().get()) + ifpi.num_header_words32)[0] = optional_msg_word | uhd::byteswap(optional_msg_word);
@@ -100,18 +101,19 @@ private:
std::list<boost::shared_array<char> > _mems;
std::list<size_t> _lens;
std::list<dummy_mrb> _mrbs; //list means no-realloc
- uhd::otw_type_t _otw_type;
+ std::string _end;
};
////////////////////////////////////////////////////////////////////////
BOOST_AUTO_TEST_CASE(test_sph_recv_one_channel_normal){
////////////////////////////////////////////////////////////////////////
- uhd::otw_type_t otw_type;
- otw_type.width = 16;
- otw_type.shift = 0;
- otw_type.byteorder = uhd::otw_type_t::BO_BIG_ENDIAN;
+ uhd::convert::id_type id;
+ id.input_markup = "sc16_item32_be";
+ id.num_inputs = 1;
+ id.output_markup = "fc32";
+ id.num_outputs = 1;
- dummy_recv_xport_class dummy_recv_xport(otw_type);
+ dummy_recv_xport_class dummy_recv_xport("big");
uhd::transport::vrt::if_packet_info_t ifpi;
ifpi.packet_type = uhd::transport::vrt::if_packet_info_t::PACKET_TYPE_DATA;
ifpi.num_payload_words32 = 0;
@@ -144,7 +146,7 @@ BOOST_AUTO_TEST_CASE(test_sph_recv_one_channel_normal){
handler.set_tick_rate(TICK_RATE);
handler.set_samp_rate(SAMP_RATE);
handler.set_xport_chan_get_buff(0, boost::bind(&dummy_recv_xport_class::get_recv_buff, &dummy_recv_xport, _1));
- handler.set_converter(otw_type);
+ handler.set_converter(id);
//check the received packets
size_t num_accum_samps = 0;
@@ -153,9 +155,7 @@ BOOST_AUTO_TEST_CASE(test_sph_recv_one_channel_normal){
for (size_t i = 0; i < NUM_PKTS_TO_TEST; i++){
std::cout << "data check " << i << std::endl;
size_t num_samps_ret = handler.recv(
- &buff.front(), buff.size(), metadata,
- uhd::io_type_t::COMPLEX_FLOAT32,
- uhd::device::RECV_MODE_ONE_PACKET, 1.0
+ &buff.front(), buff.size(), metadata, 1.0
);
BOOST_CHECK_EQUAL(metadata.error_code, uhd::rx_metadata_t::ERROR_CODE_NONE);
BOOST_CHECK(not metadata.more_fragments);
@@ -169,9 +169,7 @@ BOOST_AUTO_TEST_CASE(test_sph_recv_one_channel_normal){
for (size_t i = 0; i < 3; i++){
std::cout << "timeout check " << i << std::endl;
handler.recv(
- &buff.front(), buff.size(), metadata,
- uhd::io_type_t::COMPLEX_FLOAT32,
- uhd::device::RECV_MODE_ONE_PACKET, 1.0
+ &buff.front(), buff.size(), metadata, 1.0
);
BOOST_CHECK_EQUAL(metadata.error_code, uhd::rx_metadata_t::ERROR_CODE_TIMEOUT);
}
@@ -180,12 +178,13 @@ BOOST_AUTO_TEST_CASE(test_sph_recv_one_channel_normal){
////////////////////////////////////////////////////////////////////////
BOOST_AUTO_TEST_CASE(test_sph_recv_one_channel_sequence_error){
////////////////////////////////////////////////////////////////////////
- uhd::otw_type_t otw_type;
- otw_type.width = 16;
- otw_type.shift = 0;
- otw_type.byteorder = uhd::otw_type_t::BO_BIG_ENDIAN;
+ uhd::convert::id_type id;
+ id.input_markup = "sc16_item32_be";
+ id.num_inputs = 1;
+ id.output_markup = "fc32";
+ id.num_outputs = 1;
- dummy_recv_xport_class dummy_recv_xport(otw_type);
+ dummy_recv_xport_class dummy_recv_xport("big");
uhd::transport::vrt::if_packet_info_t ifpi;
ifpi.packet_type = uhd::transport::vrt::if_packet_info_t::PACKET_TYPE_DATA;
ifpi.num_payload_words32 = 0;
@@ -220,7 +219,7 @@ BOOST_AUTO_TEST_CASE(test_sph_recv_one_channel_sequence_error){
handler.set_tick_rate(TICK_RATE);
handler.set_samp_rate(SAMP_RATE);
handler.set_xport_chan_get_buff(0, boost::bind(&dummy_recv_xport_class::get_recv_buff, &dummy_recv_xport, _1));
- handler.set_converter(otw_type);
+ handler.set_converter(id);
//check the received packets
size_t num_accum_samps = 0;
@@ -229,9 +228,7 @@ BOOST_AUTO_TEST_CASE(test_sph_recv_one_channel_sequence_error){
for (size_t i = 0; i < NUM_PKTS_TO_TEST; i++){
std::cout << "data check " << i << std::endl;
size_t num_samps_ret = handler.recv(
- &buff.front(), buff.size(), metadata,
- uhd::io_type_t::COMPLEX_FLOAT32,
- uhd::device::RECV_MODE_ONE_PACKET, 1.0
+ &buff.front(), buff.size(), metadata, 1.0
);
if (i == NUM_PKTS_TO_TEST/2){
//must get the soft overflow here
@@ -253,9 +250,7 @@ BOOST_AUTO_TEST_CASE(test_sph_recv_one_channel_sequence_error){
for (size_t i = 0; i < 3; i++){
std::cout << "timeout check " << i << std::endl;
handler.recv(
- &buff.front(), buff.size(), metadata,
- uhd::io_type_t::COMPLEX_FLOAT32,
- uhd::device::RECV_MODE_ONE_PACKET, 1.0
+ &buff.front(), buff.size(), metadata, 1.0
);
BOOST_CHECK_EQUAL(metadata.error_code, uhd::rx_metadata_t::ERROR_CODE_TIMEOUT);
}
@@ -264,12 +259,13 @@ BOOST_AUTO_TEST_CASE(test_sph_recv_one_channel_sequence_error){
////////////////////////////////////////////////////////////////////////
BOOST_AUTO_TEST_CASE(test_sph_recv_one_channel_inline_message){
////////////////////////////////////////////////////////////////////////
- uhd::otw_type_t otw_type;
- otw_type.width = 16;
- otw_type.shift = 0;
- otw_type.byteorder = uhd::otw_type_t::BO_BIG_ENDIAN;
+ uhd::convert::id_type id;
+ id.input_markup = "sc16_item32_be";
+ id.num_inputs = 1;
+ id.output_markup = "fc32";
+ id.num_outputs = 1;
- dummy_recv_xport_class dummy_recv_xport(otw_type);
+ dummy_recv_xport_class dummy_recv_xport("big");
uhd::transport::vrt::if_packet_info_t ifpi;
ifpi.packet_type = uhd::transport::vrt::if_packet_info_t::PACKET_TYPE_DATA;
ifpi.num_payload_words32 = 0;
@@ -310,7 +306,7 @@ BOOST_AUTO_TEST_CASE(test_sph_recv_one_channel_inline_message){
handler.set_tick_rate(TICK_RATE);
handler.set_samp_rate(SAMP_RATE);
handler.set_xport_chan_get_buff(0, boost::bind(&dummy_recv_xport_class::get_recv_buff, &dummy_recv_xport, _1));
- handler.set_converter(otw_type);
+ handler.set_converter(id);
//create an overflow handler
overflow_handler_type overflow_handler;
@@ -323,9 +319,7 @@ BOOST_AUTO_TEST_CASE(test_sph_recv_one_channel_inline_message){
for (size_t i = 0; i < NUM_PKTS_TO_TEST; i++){
std::cout << "data check " << i << std::endl;
size_t num_samps_ret = handler.recv(
- &buff.front(), buff.size(), metadata,
- uhd::io_type_t::COMPLEX_FLOAT32,
- uhd::device::RECV_MODE_ONE_PACKET, 1.0
+ &buff.front(), buff.size(), metadata, 1.0
);
BOOST_CHECK_EQUAL(metadata.error_code, uhd::rx_metadata_t::ERROR_CODE_NONE);
BOOST_CHECK(not metadata.more_fragments);
@@ -335,9 +329,7 @@ BOOST_AUTO_TEST_CASE(test_sph_recv_one_channel_inline_message){
num_accum_samps += num_samps_ret;
if (i == NUM_PKTS_TO_TEST/2){
handler.recv(
- &buff.front(), buff.size(), metadata,
- uhd::io_type_t::COMPLEX_FLOAT32,
- uhd::device::RECV_MODE_ONE_PACKET, 1.0
+ &buff.front(), buff.size(), metadata, 1.0
);
std::cout << "metadata.error_code " << metadata.error_code << std::endl;
BOOST_REQUIRE(metadata.error_code == uhd::rx_metadata_t::ERROR_CODE_OVERFLOW);
@@ -350,9 +342,7 @@ BOOST_AUTO_TEST_CASE(test_sph_recv_one_channel_inline_message){
for (size_t i = 0; i < 3; i++){
std::cout << "timeout check " << i << std::endl;
handler.recv(
- &buff.front(), buff.size(), metadata,
- uhd::io_type_t::COMPLEX_FLOAT32,
- uhd::device::RECV_MODE_ONE_PACKET, 1.0
+ &buff.front(), buff.size(), metadata, 1.0
);
BOOST_CHECK_EQUAL(metadata.error_code, uhd::rx_metadata_t::ERROR_CODE_TIMEOUT);
}
@@ -361,10 +351,11 @@ BOOST_AUTO_TEST_CASE(test_sph_recv_one_channel_inline_message){
////////////////////////////////////////////////////////////////////////
BOOST_AUTO_TEST_CASE(test_sph_recv_multi_channel_normal){
////////////////////////////////////////////////////////////////////////
- uhd::otw_type_t otw_type;
- otw_type.width = 16;
- otw_type.shift = 0;
- otw_type.byteorder = uhd::otw_type_t::BO_BIG_ENDIAN;
+ uhd::convert::id_type id;
+ id.input_markup = "sc16_item32_be";
+ id.num_inputs = 1;
+ id.output_markup = "fc32";
+ id.num_outputs = 1;
uhd::transport::vrt::if_packet_info_t ifpi;
ifpi.packet_type = uhd::transport::vrt::if_packet_info_t::PACKET_TYPE_DATA;
@@ -386,7 +377,7 @@ BOOST_AUTO_TEST_CASE(test_sph_recv_multi_channel_normal){
static const size_t NUM_SAMPS_PER_BUFF = 20;
static const size_t NCHANNELS = 4;
- std::vector<dummy_recv_xport_class> dummy_recv_xports(NCHANNELS, dummy_recv_xport_class(otw_type));
+ std::vector<dummy_recv_xport_class> dummy_recv_xports(NCHANNELS, dummy_recv_xport_class("big"));
//generate a bunch of packets
for (size_t i = 0; i < NUM_PKTS_TO_TEST; i++){
@@ -406,7 +397,7 @@ BOOST_AUTO_TEST_CASE(test_sph_recv_multi_channel_normal){
for (size_t ch = 0; ch < NCHANNELS; ch++){
handler.set_xport_chan_get_buff(ch, boost::bind(&dummy_recv_xport_class::get_recv_buff, &dummy_recv_xports[ch], _1));
}
- handler.set_converter(otw_type);
+ handler.set_converter(id);
//check the received packets
size_t num_accum_samps = 0;
@@ -419,9 +410,7 @@ BOOST_AUTO_TEST_CASE(test_sph_recv_multi_channel_normal){
for (size_t i = 0; i < NUM_PKTS_TO_TEST; i++){
std::cout << "data check " << i << std::endl;
size_t num_samps_ret = handler.recv(
- buffs, NUM_SAMPS_PER_BUFF, metadata,
- uhd::io_type_t::COMPLEX_FLOAT32,
- uhd::device::RECV_MODE_ONE_PACKET, 1.0
+ buffs, NUM_SAMPS_PER_BUFF, metadata, 1.0
);
BOOST_CHECK_EQUAL(metadata.error_code, uhd::rx_metadata_t::ERROR_CODE_NONE);
BOOST_CHECK(not metadata.more_fragments);
@@ -435,9 +424,7 @@ BOOST_AUTO_TEST_CASE(test_sph_recv_multi_channel_normal){
for (size_t i = 0; i < 3; i++){
std::cout << "timeout check " << i << std::endl;
handler.recv(
- buffs, NUM_SAMPS_PER_BUFF, metadata,
- uhd::io_type_t::COMPLEX_FLOAT32,
- uhd::device::RECV_MODE_ONE_PACKET, 1.0
+ buffs, NUM_SAMPS_PER_BUFF, metadata, 1.0
);
BOOST_CHECK_EQUAL(metadata.error_code, uhd::rx_metadata_t::ERROR_CODE_TIMEOUT);
}
@@ -447,10 +434,11 @@ BOOST_AUTO_TEST_CASE(test_sph_recv_multi_channel_normal){
////////////////////////////////////////////////////////////////////////
BOOST_AUTO_TEST_CASE(test_sph_recv_multi_channel_sequence_error){
////////////////////////////////////////////////////////////////////////
- uhd::otw_type_t otw_type;
- otw_type.width = 16;
- otw_type.shift = 0;
- otw_type.byteorder = uhd::otw_type_t::BO_BIG_ENDIAN;
+ uhd::convert::id_type id;
+ id.input_markup = "sc16_item32_be";
+ id.num_inputs = 1;
+ id.output_markup = "fc32";
+ id.num_outputs = 1;
uhd::transport::vrt::if_packet_info_t ifpi;
ifpi.packet_type = uhd::transport::vrt::if_packet_info_t::PACKET_TYPE_DATA;
@@ -472,7 +460,7 @@ BOOST_AUTO_TEST_CASE(test_sph_recv_multi_channel_sequence_error){
static const size_t NUM_SAMPS_PER_BUFF = 20;
static const size_t NCHANNELS = 4;
- std::vector<dummy_recv_xport_class> dummy_recv_xports(NCHANNELS, dummy_recv_xport_class(otw_type));
+ std::vector<dummy_recv_xport_class> dummy_recv_xports(NCHANNELS, dummy_recv_xport_class("big"));
//generate a bunch of packets
for (size_t i = 0; i < NUM_PKTS_TO_TEST; i++){
@@ -495,7 +483,7 @@ BOOST_AUTO_TEST_CASE(test_sph_recv_multi_channel_sequence_error){
for (size_t ch = 0; ch < NCHANNELS; ch++){
handler.set_xport_chan_get_buff(ch, boost::bind(&dummy_recv_xport_class::get_recv_buff, &dummy_recv_xports[ch], _1));
}
- handler.set_converter(otw_type);
+ handler.set_converter(id);
//check the received packets
size_t num_accum_samps = 0;
@@ -508,9 +496,7 @@ BOOST_AUTO_TEST_CASE(test_sph_recv_multi_channel_sequence_error){
for (size_t i = 0; i < NUM_PKTS_TO_TEST; i++){
std::cout << "data check " << i << std::endl;
size_t num_samps_ret = handler.recv(
- buffs, NUM_SAMPS_PER_BUFF, metadata,
- uhd::io_type_t::COMPLEX_FLOAT32,
- uhd::device::RECV_MODE_ONE_PACKET, 1.0
+ buffs, NUM_SAMPS_PER_BUFF, metadata, 1.0
);
if (i == NUM_PKTS_TO_TEST/2){
//must get the soft overflow here
@@ -532,9 +518,7 @@ BOOST_AUTO_TEST_CASE(test_sph_recv_multi_channel_sequence_error){
for (size_t i = 0; i < 3; i++){
std::cout << "timeout check " << i << std::endl;
handler.recv(
- buffs, NUM_SAMPS_PER_BUFF, metadata,
- uhd::io_type_t::COMPLEX_FLOAT32,
- uhd::device::RECV_MODE_ONE_PACKET, 1.0
+ buffs, NUM_SAMPS_PER_BUFF, metadata, 1.0
);
BOOST_CHECK_EQUAL(metadata.error_code, uhd::rx_metadata_t::ERROR_CODE_TIMEOUT);
}
@@ -543,10 +527,11 @@ BOOST_AUTO_TEST_CASE(test_sph_recv_multi_channel_sequence_error){
////////////////////////////////////////////////////////////////////////
BOOST_AUTO_TEST_CASE(test_sph_recv_multi_channel_time_error){
////////////////////////////////////////////////////////////////////////
- uhd::otw_type_t otw_type;
- otw_type.width = 16;
- otw_type.shift = 0;
- otw_type.byteorder = uhd::otw_type_t::BO_BIG_ENDIAN;
+ uhd::convert::id_type id;
+ id.input_markup = "sc16_item32_be";
+ id.num_inputs = 1;
+ id.output_markup = "fc32";
+ id.num_outputs = 1;
uhd::transport::vrt::if_packet_info_t ifpi;
ifpi.packet_type = uhd::transport::vrt::if_packet_info_t::PACKET_TYPE_DATA;
@@ -568,7 +553,7 @@ BOOST_AUTO_TEST_CASE(test_sph_recv_multi_channel_time_error){
static const size_t NUM_SAMPS_PER_BUFF = 20;
static const size_t NCHANNELS = 4;
- std::vector<dummy_recv_xport_class> dummy_recv_xports(NCHANNELS, dummy_recv_xport_class(otw_type));
+ std::vector<dummy_recv_xport_class> dummy_recv_xports(NCHANNELS, dummy_recv_xport_class("big"));
//generate a bunch of packets
for (size_t i = 0; i < NUM_PKTS_TO_TEST; i++){
@@ -591,7 +576,7 @@ BOOST_AUTO_TEST_CASE(test_sph_recv_multi_channel_time_error){
for (size_t ch = 0; ch < NCHANNELS; ch++){
handler.set_xport_chan_get_buff(ch, boost::bind(&dummy_recv_xport_class::get_recv_buff, &dummy_recv_xports[ch], _1));
}
- handler.set_converter(otw_type);
+ handler.set_converter(id);
//check the received packets
size_t num_accum_samps = 0;
@@ -604,9 +589,7 @@ BOOST_AUTO_TEST_CASE(test_sph_recv_multi_channel_time_error){
for (size_t i = 0; i < NUM_PKTS_TO_TEST; i++){
std::cout << "data check " << i << std::endl;
size_t num_samps_ret = handler.recv(
- buffs, NUM_SAMPS_PER_BUFF, metadata,
- uhd::io_type_t::COMPLEX_FLOAT32,
- uhd::device::RECV_MODE_ONE_PACKET, 1.0
+ buffs, NUM_SAMPS_PER_BUFF, metadata, 1.0
);
BOOST_CHECK_EQUAL(metadata.error_code, uhd::rx_metadata_t::ERROR_CODE_NONE);
BOOST_CHECK(not metadata.more_fragments);
@@ -623,9 +606,7 @@ BOOST_AUTO_TEST_CASE(test_sph_recv_multi_channel_time_error){
for (size_t i = 0; i < 3; i++){
std::cout << "timeout check " << i << std::endl;
handler.recv(
- buffs, NUM_SAMPS_PER_BUFF, metadata,
- uhd::io_type_t::COMPLEX_FLOAT32,
- uhd::device::RECV_MODE_ONE_PACKET, 1.0
+ buffs, NUM_SAMPS_PER_BUFF, metadata, 1.0
);
BOOST_CHECK_EQUAL(metadata.error_code, uhd::rx_metadata_t::ERROR_CODE_TIMEOUT);
}
@@ -634,10 +615,11 @@ BOOST_AUTO_TEST_CASE(test_sph_recv_multi_channel_time_error){
////////////////////////////////////////////////////////////////////////
BOOST_AUTO_TEST_CASE(test_sph_recv_multi_channel_fragment){
////////////////////////////////////////////////////////////////////////
- uhd::otw_type_t otw_type;
- otw_type.width = 16;
- otw_type.shift = 0;
- otw_type.byteorder = uhd::otw_type_t::BO_BIG_ENDIAN;
+ uhd::convert::id_type id;
+ id.input_markup = "sc16_item32_be";
+ id.num_inputs = 1;
+ id.output_markup = "fc32";
+ id.num_outputs = 1;
uhd::transport::vrt::if_packet_info_t ifpi;
ifpi.packet_type = uhd::transport::vrt::if_packet_info_t::PACKET_TYPE_DATA;
@@ -659,7 +641,7 @@ BOOST_AUTO_TEST_CASE(test_sph_recv_multi_channel_fragment){
static const size_t NUM_SAMPS_PER_BUFF = 10;
static const size_t NCHANNELS = 4;
- std::vector<dummy_recv_xport_class> dummy_recv_xports(NCHANNELS, dummy_recv_xport_class(otw_type));
+ std::vector<dummy_recv_xport_class> dummy_recv_xports(NCHANNELS, dummy_recv_xport_class("big"));
//generate a bunch of packets
for (size_t i = 0; i < NUM_PKTS_TO_TEST; i++){
@@ -679,7 +661,7 @@ BOOST_AUTO_TEST_CASE(test_sph_recv_multi_channel_fragment){
for (size_t ch = 0; ch < NCHANNELS; ch++){
handler.set_xport_chan_get_buff(ch, boost::bind(&dummy_recv_xport_class::get_recv_buff, &dummy_recv_xports[ch], _1));
}
- handler.set_converter(otw_type);
+ handler.set_converter(id);
//check the received packets
size_t num_accum_samps = 0;
@@ -692,9 +674,7 @@ BOOST_AUTO_TEST_CASE(test_sph_recv_multi_channel_fragment){
for (size_t i = 0; i < NUM_PKTS_TO_TEST; i++){
std::cout << "data check " << i << std::endl;
size_t num_samps_ret = handler.recv(
- buffs, NUM_SAMPS_PER_BUFF, metadata,
- uhd::io_type_t::COMPLEX_FLOAT32,
- uhd::device::RECV_MODE_ONE_PACKET, 1.0
+ buffs, NUM_SAMPS_PER_BUFF, metadata, 1.0
);
BOOST_CHECK_EQUAL(metadata.error_code, uhd::rx_metadata_t::ERROR_CODE_NONE);
BOOST_CHECK(metadata.has_time_spec);
@@ -705,9 +685,7 @@ BOOST_AUTO_TEST_CASE(test_sph_recv_multi_channel_fragment){
if (not metadata.more_fragments) continue;
num_samps_ret = handler.recv(
- buffs, NUM_SAMPS_PER_BUFF, metadata,
- uhd::io_type_t::COMPLEX_FLOAT32,
- uhd::device::RECV_MODE_ONE_PACKET, 1.0
+ buffs, NUM_SAMPS_PER_BUFF, metadata, 1.0
);
BOOST_CHECK_EQUAL(metadata.error_code, uhd::rx_metadata_t::ERROR_CODE_NONE);
BOOST_CHECK(not metadata.more_fragments);
@@ -722,9 +700,7 @@ BOOST_AUTO_TEST_CASE(test_sph_recv_multi_channel_fragment){
for (size_t i = 0; i < 3; i++){
std::cout << "timeout check " << i << std::endl;
handler.recv(
- buffs, NUM_SAMPS_PER_BUFF, metadata,
- uhd::io_type_t::COMPLEX_FLOAT32,
- uhd::device::RECV_MODE_ONE_PACKET, 1.0
+ buffs, NUM_SAMPS_PER_BUFF, metadata, 1.0
);
BOOST_CHECK_EQUAL(metadata.error_code, uhd::rx_metadata_t::ERROR_CODE_TIMEOUT);
}
diff --git a/host/tests/sph_send_test.cpp b/host/tests/sph_send_test.cpp
index ed2f54371..9a91008af 100644
--- a/host/tests/sph_send_test.cpp
+++ b/host/tests/sph_send_test.cpp
@@ -55,18 +55,18 @@ private:
**********************************************************************/
class dummy_send_xport_class{
public:
- dummy_send_xport_class(const uhd::otw_type_t &otw_type){
- _otw_type = otw_type;
+ dummy_send_xport_class(const std::string &end){
+ _end = end;
}
void pop_front_packet(
uhd::transport::vrt::if_packet_info_t &ifpi
){
ifpi.num_packet_words32 = _lens.front()/sizeof(boost::uint32_t);
- if (_otw_type.byteorder == uhd::otw_type_t::BO_BIG_ENDIAN){
+ if (_end == "big"){
uhd::transport::vrt::if_hdr_unpack_be(reinterpret_cast<boost::uint32_t *>(_mems.front().get()), ifpi);
}
- if (_otw_type.byteorder == uhd::otw_type_t::BO_LITTLE_ENDIAN){
+ if (_end == "little"){
uhd::transport::vrt::if_hdr_unpack_le(reinterpret_cast<boost::uint32_t *>(_mems.front().get()), ifpi);
}
_mems.pop_front();
@@ -85,18 +85,19 @@ private:
std::list<boost::shared_array<char> > _mems;
std::list<size_t> _lens;
std::list<dummy_msb> _msbs; //list means no-realloc
- uhd::otw_type_t _otw_type;
+ std::string _end;
};
////////////////////////////////////////////////////////////////////////
BOOST_AUTO_TEST_CASE(test_sph_send_one_channel_one_packet_mode){
////////////////////////////////////////////////////////////////////////
- uhd::otw_type_t otw_type;
- otw_type.width = 16;
- otw_type.shift = 0;
- otw_type.byteorder = uhd::otw_type_t::BO_BIG_ENDIAN;
+ uhd::convert::id_type id;
+ id.input_markup = "fc32";
+ id.num_inputs = 1;
+ id.output_markup = "sc16_item32_be";
+ id.num_outputs = 1;
- dummy_send_xport_class dummy_send_xport(otw_type);
+ dummy_send_xport_class dummy_send_xport("big");
static const double TICK_RATE = 100e6;
static const double SAMP_RATE = 10e6;
@@ -108,7 +109,7 @@ BOOST_AUTO_TEST_CASE(test_sph_send_one_channel_one_packet_mode){
handler.set_tick_rate(TICK_RATE);
handler.set_samp_rate(SAMP_RATE);
handler.set_xport_chan_get_buff(0, boost::bind(&dummy_send_xport_class::get_send_buff, &dummy_send_xport, _1));
- handler.set_converter(otw_type);
+ handler.set_converter(id);
handler.set_max_samples_per_packet(20);
//allocate metadata and buffer
@@ -122,9 +123,7 @@ BOOST_AUTO_TEST_CASE(test_sph_send_one_channel_one_packet_mode){
metadata.start_of_burst = (i == 0);
metadata.end_of_burst = (i == NUM_PKTS_TO_TEST-1);
const size_t num_sent = handler.send(
- &buff.front(), 10 + i%10, metadata,
- uhd::io_type_t::COMPLEX_FLOAT32,
- uhd::device::SEND_MODE_ONE_PACKET, 1.0
+ &buff.front(), 10 + i%10, metadata, 1.0
);
BOOST_CHECK_EQUAL(num_sent, 10 + i%10);
metadata.time_spec += uhd::time_spec_t(0, num_sent, SAMP_RATE);
@@ -150,12 +149,13 @@ BOOST_AUTO_TEST_CASE(test_sph_send_one_channel_one_packet_mode){
////////////////////////////////////////////////////////////////////////
BOOST_AUTO_TEST_CASE(test_sph_send_one_channel_full_buffer_mode){
////////////////////////////////////////////////////////////////////////
- uhd::otw_type_t otw_type;
- otw_type.width = 16;
- otw_type.shift = 0;
- otw_type.byteorder = uhd::otw_type_t::BO_BIG_ENDIAN;
+ uhd::convert::id_type id;
+ id.input_markup = "fc32";
+ id.num_inputs = 1;
+ id.output_markup = "sc16_item32_be";
+ id.num_outputs = 1;
- dummy_send_xport_class dummy_send_xport(otw_type);
+ dummy_send_xport_class dummy_send_xport("big");
static const double TICK_RATE = 100e6;
static const double SAMP_RATE = 10e6;
@@ -167,7 +167,7 @@ BOOST_AUTO_TEST_CASE(test_sph_send_one_channel_full_buffer_mode){
handler.set_tick_rate(TICK_RATE);
handler.set_samp_rate(SAMP_RATE);
handler.set_xport_chan_get_buff(0, boost::bind(&dummy_send_xport_class::get_send_buff, &dummy_send_xport, _1));
- handler.set_converter(otw_type);
+ handler.set_converter(id);
handler.set_max_samples_per_packet(20);
//allocate metadata and buffer
@@ -180,9 +180,7 @@ BOOST_AUTO_TEST_CASE(test_sph_send_one_channel_full_buffer_mode){
//generate the test data
const size_t num_sent = handler.send(
- &buff.front(), buff.size(), metadata,
- uhd::io_type_t::COMPLEX_FLOAT32,
- uhd::device::SEND_MODE_FULL_BUFF, 1.0
+ &buff.front(), buff.size(), metadata, 1.0
);
BOOST_CHECK_EQUAL(num_sent, buff.size());