aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2020-04-02 21:48:26 -0700
committerAaron Rossetto <aaron.rossetto@ni.com>2020-04-08 16:35:03 -0500
commit3f6a98980557554f1f112d2df6e15415137fd731 (patch)
tree3a00a4c76396f048f0178fab99cda8bfaabf2c5d
parent843527d303b4407f273b10a8986d6a51f5eeb389 (diff)
downloaduhd-3f6a98980557554f1f112d2df6e15415137fd731.tar.gz
uhd-3f6a98980557554f1f112d2df6e15415137fd731.tar.bz2
uhd-3f6a98980557554f1f112d2df6e15415137fd731.zip
tests: Fix client_zero_test flush bit test
A test to check the address was using a & instead of a %, resulting in a -Wtautological-compare.
-rw-r--r--host/tests/client_zero_test.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/host/tests/client_zero_test.cpp b/host/tests/client_zero_test.cpp
index 20ce28e8a..285757baf 100644
--- a/host/tests/client_zero_test.cpp
+++ b/host/tests/client_zero_test.cpp
@@ -87,16 +87,19 @@ public:
UHD_THROW_INVALID_CODE_PATH();
}
- if ((addr & SLOT_OFFSET) == 0) {
- UHD_LOG_INFO("MOCK_REG_IFACE", "Set flush timeout to " << data);
+ const size_t blockno = (addr / SLOT_OFFSET) - 1 - NUM_STREAM_ENDPOINTS;
+
+ if ((addr % SLOT_OFFSET) == 0) {
+ UHD_LOG_INFO("MOCK_REG_IFACE",
+ "Block: " << blockno << " Set flush timeout to " << data);
last_flush_timeout = data;
return;
}
- if ((addr & SLOT_OFFSET) == 1) {
+ if ((addr % SLOT_OFFSET) == 4) {
UHD_LOG_INFO("MOCK_REG_IFACE",
- "Set flush/reset bits to flush=" << (data & 0x1) << ",ctrl_rst="
- << ((data >> 1) & 0x1 >> 1)
- << ",chdr_rst=" << ((data >> 2) & 0x1));
+ "Block: " << blockno << " Set flush/reset bits to flush=" << (data & 0x1)
+ << ",ctrl_rst=" << ((data >> 1) & 0x1)
+ << ",chdr_rst=" << ((data >> 2) & 0x1));
}
}
@@ -207,7 +210,9 @@ BOOST_AUTO_TEST_CASE(simple_read_if_chdr_pkt)
BOOST_CHECK_EQUAL(mock_client0->get_flush_active(3), false);
BOOST_CHECK_EQUAL(mock_client0->get_flush_done(3), true);
// Flushing and Reset
+ UHD_LOG_INFO("TEST", "Setting and resetting flush flags...");
BOOST_CHECK_THROW(mock_client0->set_flush(0), uhd::index_error);
+ // First block is on port 3
BOOST_CHECK_NO_THROW(mock_client0->set_flush(3));
BOOST_CHECK_THROW(mock_client0->set_flush(9), uhd::index_error);
BOOST_CHECK_THROW(mock_client0->reset_ctrl(0), uhd::index_error);
@@ -216,6 +221,7 @@ BOOST_AUTO_TEST_CASE(simple_read_if_chdr_pkt)
BOOST_CHECK_THROW(mock_client0->reset_chdr(0), uhd::index_error);
BOOST_CHECK_NO_THROW(mock_client0->reset_chdr(3));
BOOST_CHECK_THROW(mock_client0->reset_chdr(9), uhd::index_error);
+ UHD_LOG_INFO("TEST", "Done Setting and resetting flush flags.");
// Block Config
auto mock_config = mock_client0->get_block_info(3);