aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--host/examples/test_messages.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/host/examples/test_messages.cpp b/host/examples/test_messages.cpp
index 4c07d34b1..4135bca56 100644
--- a/host/examples/test_messages.cpp
+++ b/host/examples/test_messages.cpp
@@ -264,7 +264,12 @@ void flush_async(uhd::tx_streamer::sptr tx_stream){
}
void flush_recv(uhd::rx_streamer::sptr rx_stream){
- std::vector<std::complex<float> > buff(rx_stream->get_max_num_samps());
+ uhd::stream_cmd_t stream_cmd(uhd::stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_DONE);
+ stream_cmd.num_samps = rx_stream->get_max_num_samps()*3;
+ stream_cmd.stream_now = true;
+ rx_stream->issue_stream_cmd(stream_cmd);
+
+ std::vector<std::complex<float> > buff(stream_cmd.num_samps);
uhd::rx_metadata_t md;
do{
@@ -285,6 +290,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
("help", "help message")
("args", po::value<std::string>(&args)->default_value(""), "multi uhd device address args")
("ntests", po::value<size_t>(&ntests)->default_value(50), "number of tests to run")
+ ("test-chain", "Run broken chain tests")
;
po::variables_map vm;
po::store(po::parse_command_line(argc, argv, desc), vm);
@@ -310,15 +316,18 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
//------------------------------------------------------------------
// begin messages test
//------------------------------------------------------------------
- static const uhd::dict<std::string, boost::function<bool(uhd::usrp::multi_usrp::sptr, uhd::rx_streamer::sptr, uhd::tx_streamer::sptr)> >
+ static uhd::dict<std::string, boost::function<bool(uhd::usrp::multi_usrp::sptr, uhd::rx_streamer::sptr, uhd::tx_streamer::sptr)> >
tests = boost::assign::map_list_of
("Test Burst ACK ", &test_burst_ack_message)
("Test Underflow ", &test_underflow_message)
("Test Time Error", &test_time_error_message)
("Test Late Command", &test_late_command_message)
- ("Test Broken Chain", &test_broken_chain_message)
;
+ if (vm.count("test-chain")) {
+ tests["Test Broken Chain"] = &test_broken_chain_message;
+ }
+
//init result counts
uhd::dict<std::string, size_t> failures, successes;
BOOST_FOREACH(const std::string &key, tests.keys()){
@@ -331,8 +340,9 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
for (size_t n = 0; n < ntests; n++){
std::string key = tests.keys()[std::rand() % tests.size()];
bool pass = tests[key](usrp, rx_stream, tx_stream);
- flush_async(tx_stream);
+
flush_recv(rx_stream);
+ flush_async(tx_stream);
//store result
if (pass) successes[key]++;