|
μHAL (v2.7.9)
Part of the IPbus software repository
|
Go to the documentation of this file.
41 #include <boost/test/unit_test.hpp>
42 #include <boost/filesystem.hpp>
61 uint32_t x1 =
static_cast<uint32_t
> ( rand() );
62 uint32_t x2 =
static_cast<uint32_t
> ( rand() );
84 boost::filesystem::path conn_fn ( connectionFileURI );
85 boost::filesystem::path
fn (
"dummy_address.xml" );
89 std::string
uri = getHwInterface().uri();
93 uint32_t
x =
static_cast<uint32_t
> ( rand() );
108 std::vector<std::string> ids = manager.getDevices (
"^" + deviceId +
"$" );
109 BOOST_CHECK ( std::find ( ids.begin(),ids.end(), deviceId ) != ids.end() );
A class which bundles a node tree and an IPbus client interface together providing everything you nee...
HwInterface getDevice(const std::string &aId)
Retrieves protocol, host, and port from the connection file to create an IPbus Client Retrieves the a...
on_the_fly_connect_write_read
bool valid()
Return whether the Validated memory is marked as valid.
BOOST_CHECK(!mem.valid())
void setTimeoutPeriod(const uint32_t &aTimeoutPeriod)
A method to modify the timeout period for any pending or future transactions.
BOOST_CHECK_THROW(hw.getNode("REG").writeBlockOffset(xx, 0), uhal::exception::BulkTransferOffsetRequestedForSingleRegister)
T value() const
Return the value of the validated memory with check on validity.
void dispatch()
Make the IPbus client issue a dispatch.
boost::filesystem::path fn("dummy_address.xml")
UHAL_TESTS_DEFINE_CLIENT_TEST_CASES(BlockReadWriteTestSuite, block_write_read, DummyHardwareFixture, { std::vector< size_t > lDepths=getBlockUnitTestDepths(quickTest ? N_1MB :N_10MB);for(size_t i=0;i< lDepths.size();i++) { const size_t N=lDepths.at(i);BOOST_TEST_MESSAGE(" N = "<< N);HwInterface hw=getHwInterface();std::vector< uint32_t > xx;xx.reserve(N);for(size_t i=0;i!=N;++i) { xx.push_back(static_cast< uint32_t >(rand()));} hw.getNode("LARGE_MEM").writeBlock(xx);ValVector< uint32_t > mem=hw.getNode("LARGE_MEM").readBlock(N);BOOST_CHECK(!mem.valid());BOOST_CHECK_EQUAL(mem.size(), N);if(N > 0) { BOOST_CHECK_THROW(mem.at(0), uhal::exception::NonValidatedMemory);} BOOST_CHECK_THROW(mem.value(), uhal::exception::NonValidatedMemory);BOOST_CHECK_NO_THROW(hw.dispatch());BOOST_CHECK(mem.valid());BOOST_CHECK_EQUAL(mem.size(), N);if(N< N_10MB) { bool correct_block_write_read=true;std::vector< uint32_t >::const_iterator j=xx.begin();for(ValVector< uint32_t >::const_iterator i(mem.begin());i!=mem.end();++i,++j) { correct_block_write_read=correct_block_write_read &&(*i== *j);} BOOST_CHECK(correct_block_write_read);} } }) UHAL_TESTS_DEFINE_CLIENT_TEST_CASES(BlockReadWriteTestSuite
ValWord< uint32_t > read() const
Read a single, unmasked, unsigned word.
A class to open and manage XML connection files and wrap up the interfaces to the NodeTreeBuilder and...
std::vector< T > value() const
Return the value of the validated memory with check on validity.
BOOST_CHECK_NO_THROW(hw.getNode("REG").writeBlock(xx))
ValVector< uint32_t > mem
bool valid()
Return whether the Validated memory is marked as valid.
BOOST_CHECK_EQUAL(mem.size(), N)
ValHeader write(const uint32_t &aValue) const
Write a single, unmasked word to a register.
const Node & getNode() const
Retrieve the top-level node.