μHAL (v2.7.9)
Part of the IPbus software repository
Classes | Enumerations | Functions | Variables
uhal::tests Namespace Reference

Classes

struct  AbstractFixture
 
struct  AddressTableOverlapFixture
 
struct  DummyAddressFileFixture
 Fixture for tests based on 'dummy' address files. More...
 
class  DummyChildNode
 Class further derived from Level1. More...
 
class  DummyClient
 Empty client class, written to test registration. More...
 
class  DummyHardware
 Abstract base class to emulate IPbus hardware. More...
 
struct  DummyHardwareFixture
 
class  DummyHardwareInterface
 Common abstract base class for IPbus 1.3 and 2.0 dummy hardware. More...
 
struct  DummyHardwareOptions
 Struct to store the dummy hardware command line options. More...
 
class  DummyHardwareRunner
 
class  DummyParentNode
 
struct  MinimalFixture
 
struct  MinimalFixture< IPBUS_2_0_PCIE >
 
struct  NodeProperties
 
class  PCIeDummyHardware
 
class  PerfTester
 
struct  SimpleAddressTableFixture
 
class  TCPDummyHardware
 Concrete implementation of emulator of hardware using TCP. More...
 
class  Timer
 A very simple timer. More...
 
class  UDPDummyHardware
 Concrete implementation of emulator of hardware using UDP. More...
 

Enumerations

enum  DeviceType {
  IPBUS_1_3_UDP, IPBUS_1_3_TCP, IPBUS_1_3_CONTROLHUB, IPBUS_2_0_UDP,
  IPBUS_2_0_TCP, IPBUS_2_0_CONTROLHUB, IPBUS_2_0_PCIE
}
 

Functions

double measureReadLatency (ClientInterface &aClient, uint32_t aBaseAddr, uint32_t aDepth, size_t aNrIterations, bool aDispatchEachIteration, bool aVerbose)
 
double measureReadLatency (const std::vector< ClientInterface * > &aClients, uint32_t aBaseAddr, uint32_t aDepth, size_t aNrIterations, bool aDispatchEachIteration, bool aVerbose)
 
double measureWriteLatency (ClientInterface &aClient, uint32_t aBaseAddr, uint32_t aDepth, size_t aNrIterations, bool aDispatchEachIteration, bool aVerbose)
 
double measureWriteLatency (const std::vector< ClientInterface * > &aClients, uint32_t aBaseAddr, uint32_t aDepth, size_t aNrIterations, bool aDispatchEachIteration, bool aVerbose)
 
double measureFileReadLatency (const std::string &aFilePath, uint32_t aBaseAddr, uint32_t aDepth, size_t aNrIterations, bool aVerbose)
 
double measureFileWriteLatency (const std::string &aFilePath, uint32_t aBaseAddr, uint32_t aDepth, size_t aNrIterations, bool aVerbose)
 
std::vector< size_t > getBlockUnitTestDepths (const size_t aMaxSize)
 
 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
 
 for (size_t i=0;i< lDepths.size();i++)
 
 UHAL_TESTS_DEFINE_CLIENT_TEST_CASES (BlockReadWriteTestSuite, block_offset_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);std::vector< uint32_t > yy;yy.reserve(N);for(size_t i=0;i!=N;++i) { xx.push_back(static_cast< uint32_t >(rand()));yy.push_back(static_cast< uint32_t >(rand()));} hw.getNode("LARGE_MEM").writeBlockOffset(xx, 0);ValVector< uint32_t > mem=hw.getNode("LARGE_MEM").readBlockOffset(N, 0);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);hw.getNode("LARGE_MEM").writeBlockOffset(yy, N);ValVector< uint32_t > mem2=hw.getNode("LARGE_MEM").readBlockOffset(N, N);BOOST_CHECK(!mem2.valid());BOOST_CHECK_EQUAL(mem2.size(), N);if(N > 0) { BOOST_CHECK_THROW(mem2.at(0), uhal::exception::NonValidatedMemory);} BOOST_CHECK_THROW(mem2.value(), uhal::exception::NonValidatedMemory);BOOST_CHECK_NO_THROW(hw.dispatch());BOOST_CHECK(mem.valid());BOOST_CHECK_EQUAL(mem.size(), N);BOOST_CHECK(mem2.valid());BOOST_CHECK_EQUAL(mem2.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);} j=yy.begin();for(ValVector< uint32_t >::const_iterator i(mem2.begin());i!=mem2.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
 
xx resize (N_4B)
 
 BOOST_CHECK_NO_THROW (hw.getNode("REG").writeBlock(xx))
 
 BOOST_CHECK_NO_THROW (ValVector< uint32_t > mem=hw.getNode("REG").readBlock(N_4B))
 
 BOOST_CHECK_THROW (hw.getNode("REG").writeBlockOffset(xx, 0), uhal::exception::BulkTransferOffsetRequestedForSingleRegister)
 
 BOOST_CHECK_THROW (ValVector< uint32_t > mem=hw.getNode("REG").readBlockOffset(N_1kB, 0), uhal::exception::BulkTransferOffsetRequestedForSingleRegister)
 
xx resize (N_1kB)
 
 BOOST_CHECK_THROW (hw.getNode("REG").writeBlock(xx), uhal::exception::BulkTransferOnSingleRegister)
 
 BOOST_CHECK_THROW (ValVector< uint32_t > mem=hw.getNode("REG").readBlock(N_1kB), uhal::exception::BulkTransferOnSingleRegister)
 
 BOOST_CHECK_THROW (hw.getNode("FIFO").writeBlockOffset(xx, 1), uhal::exception::BulkTransferOffsetRequestedForFifo)
 
 BOOST_CHECK_THROW (ValVector< uint32_t > mem=hw.getNode("FIFO").readBlockOffset(N_1kB, 1), uhal::exception::BulkTransferOffsetRequestedForFifo)
 
 UHAL_TESTS_DEFINE_CLIENT_TEST_CASES (BlockReadWriteTestSuite, block_bigger_than_size_attribute, MinimalFixture, { HwInterface hw=getHwInterface();std::vector< uint32_t > xx;xx.resize(N_1MB);BOOST_CHECK_THROW(hw.getNode("SMALL_MEM").writeBlock(xx), uhal::exception::BulkTransferRequestedTooLarge);BOOST_CHECK_THROW(ValVector< uint32_t > mem=hw.getNode("SMALL_MEM").readBlock(N_1MB), uhal::exception::BulkTransferRequestedTooLarge);}) UHAL_TESTS_DEFINE_CLIENT_TEST_CASES(BlockReadWriteTestSuite
 
 BOOST_CHECK_THROW (hw.getNode("SMALL_MEM").writeBlockOffset(xx, 256), uhal::exception::BulkTransferRequestedTooLarge)
 
 BOOST_CHECK_THROW (ValVector< uint32_t > mem=hw.getNode("SMALL_MEM").readBlockOffset(N_4B, 256), uhal::exception::BulkTransferRequestedTooLarge)
 
 BOOST_CHECK_THROW (hw.getNode("SMALL_MEM").writeBlockOffset(xx, 1), uhal::exception::BulkTransferRequestedTooLarge)
 
template<class T >
void checkClientFactory (const std::string &aId, const std::string &aURI, const std::vector< std::string > &aUserClientActivationList)
 
template<class T >
void checkClientFactory (const std::string &aId, const std::string &aURI)
 
 BOOST_AUTO_TEST_CASE (core_clients)
 
 BOOST_AUTO_TEST_CASE (user_clients)
 
 UHAL_TESTS_DEFINE_CLIENT_TEST_CASES (ConfigSpaceTestSuite, read_fullWord, DummyHardwareFixture, { HwInterface hw=getHwInterface();IPbusCore &client=dynamic_cast< IPbusCore & >(hw.getClient());for(size_t i=0;i< 10;i++) { const uint32_t expectedValue=uint16_t(getpid())<< 16|i;switch(deviceType) { case IPBUS_1_3_UDP :case IPBUS_1_3_TCP :case IPBUS_1_3_CONTROLHUB :BOOST_CHECK_THROW(client.readConfigurationSpace(i), exception::ValidationError);break;default:ValWord< uint32_t > x=client.readConfigurationSpace(i);client.dispatch();BOOST_CHECK_EQUAL(x.value(), expectedValue);} } }) UHAL_TESTS_DEFINE_CLIENT_TEST_CASES(ConfigSpaceTestSuite
 
 UHAL_TESTS_DEFINE_CLIENT_TEST_CASES (EmptyDispatchTestSuite, empty_dispatch, MinimalFixture, { HwInterface hw=getHwInterface();BOOST_CHECK_NO_THROW(hw.dispatch());}) UHAL_TESTS_DEFINE_CLIENT_TEST_CASES(EmptyDispatchTestSuite
 
 BOOST_CHECK_NO_THROW (ValWord< uint32_t > r=hw.getNode("REG").read())
 
 BOOST_CHECK_NO_THROW (hw.dispatch())
 
void job_multiple (const std::string &connection, const std::string &id, const size_t timeout)
 
 UHAL_TESTS_DEFINE_CLIENT_TEST_CASES (MultithreadedTestSuite, multiple_hwinterfaces, DummyHardwareFixture, { std::vector< boost::thread * > jobs;for(size_t i=0;i!=N_THREADS;++i) { log(Warning(), ThisLocation(), ":", Integer(i));jobs.push_back(new boost::thread(job_multiple, connectionFileURI, deviceId, timeout));} for(size_t i=0;i!=N_THREADS;++i) { log(Warning(), ThisLocation(), ":", Integer(i));jobs[i]->join();delete jobs[i];} log(Warning(), ThisLocation());}) void job_single(HwInterface &hw)
 
 UHAL_TESTS_DEFINE_CLIENT_TEST_CASES (MultithreadedTestSuite, single_hwinterface, DummyHardwareFixture, { for(size_t iter=0;iter!=N_ITERATIONS ;++iter) { HwInterface hw=getHwInterface();std::vector< boost::thread * > jobs;for(size_t i=0;i!=N_THREADS;++i) { jobs.push_back(new boost::thread(job_single, hw));} for(size_t i=0;i!=N_THREADS;++i) { jobs[i]->join();delete jobs[i];} } }) void job_single_copied(HwInterface hw)
 
void checkProperties (const uhal::Node &aNode, const NodeProperties &aExpected)
 
void checkExceptionsThrownByReadWrite (const uhal::Node &aNode, const NodeProperties &aProperties)
 
void checkDescendants (const uhal::Node &aNode, const NodeProperties &aProperties)
 
bool nodeAddrCompare (const Node *aNodeL, const Node *aNodeR)
 
void checkIteration (const uhal::Node &aNode, const NodeProperties &aProperties)
 
void checkLineage (const uhal::Node &aTopNode, const uhal::Node &aNode)
 
void checkNodeTree (const uhal::Node &aNode, const std::vector< NodeProperties > &aExpectedProperties)
 
pugi::xml_node getNthChild (const pugi::xml_node &aNode, const size_t aIndex)
 
void setAttribute (pugi::xml_node aNode, const std::string &aName, const std::string &aValue)
 
 BOOST_FIXTURE_TEST_CASE (dummy_address_files, DummyAddressFileFixture)
 
 BOOST_FIXTURE_TEST_CASE (address_description, DummyAddressFileFixture)
 
 BOOST_FIXTURE_TEST_CASE (valid_default, SimpleAddressTableFixture)
 
 BOOST_FIXTURE_TEST_CASE (missing_ID, SimpleAddressTableFixture)
 
 BOOST_FIXTURE_TEST_CASE (invalid_ID, SimpleAddressTableFixture)
 
 BOOST_FIXTURE_TEST_CASE (invalid_address, SimpleAddressTableFixture)
 
 BOOST_FIXTURE_TEST_CASE (invalid_mask, SimpleAddressTableFixture)
 
 BOOST_FIXTURE_TEST_CASE (invalid_size, SimpleAddressTableFixture)
 
 BOOST_FIXTURE_TEST_CASE (invalid_permission, SimpleAddressTableFixture)
 
 BOOST_FIXTURE_TEST_CASE (invalid_mode, SimpleAddressTableFixture)
 
 BOOST_FIXTURE_TEST_CASE (size_without_node_attribute, SimpleAddressTableFixture)
 
 BOOST_FIXTURE_TEST_CASE (no_overlap, AddressTableOverlapFixture)
 
 BOOST_FIXTURE_TEST_CASE (overlap_unmasked_registers, AddressTableOverlapFixture)
 
 BOOST_FIXTURE_TEST_CASE (overlap_masked_registers_1, AddressTableOverlapFixture)
 
 BOOST_FIXTURE_TEST_CASE (overlap_masked_registers_2, AddressTableOverlapFixture)
 
 BOOST_FIXTURE_TEST_CASE (overlap_ports, AddressTableOverlapFixture)
 
 BOOST_FIXTURE_TEST_CASE (overlap_unmasked_reg_vs_masked_reg, AddressTableOverlapFixture)
 
 BOOST_FIXTURE_TEST_CASE (overlap_unmasked_reg_vs_port, AddressTableOverlapFixture)
 
 BOOST_FIXTURE_TEST_CASE (overlap_masked_reg_vs_port, AddressTableOverlapFixture)
 
 BOOST_FIXTURE_TEST_CASE (overlap_ram, AddressTableOverlapFixture)
 
 BOOST_FIXTURE_TEST_CASE (overlap_multiple_1, AddressTableOverlapFixture)
 
 BOOST_FIXTURE_TEST_CASE (overlap_multiple_2, AddressTableOverlapFixture)
 
 UHAL_TESTS_DEFINE_CLIENT_TEST_CASES (NonreachableTestSuite, check_nonreachable_device, MinimalFixture, { const size_t numTests(quickTest ? 1 :10);for(size_t i=0;i< numTests;i++) { HwInterface hw=getHwInterface();if((hw.uri().find("ipbustcp") !=std::string::npos)||(hw.uri().find("ipbuspcie") !=std::string::npos)) { BOOST_CHECK_THROW({ hw.getNode("REG").read();hw.dispatch();}, uhal::exception::TransportLayerError);} else { BOOST_CHECK_THROW({ hw.getNode("REG").read();hw.dispatch();}, uhal::exception::ClientTimeout);} } }) HwInterface getHwWithModifiedControlHubPort(const std
 
 UHAL_TESTS_DEFINE_CLIENT_TEST_CASES (RawClientTestSuite, single_write_read, DummyHardwareFixture, { HwInterface hw=getHwInterface();ClientInterface *c=&hw.getClient();uint32_t x=static_cast< uint32_t >(rand());uint32_t addr=hw.getNode("REG").getAddress();c->write(addr, x);ValWord< uint32_t > reg=c->read(addr);BOOST_CHECK(!reg.valid());BOOST_CHECK_THROW(reg.value(), uhal::exception::NonValidatedMemory);c->dispatch();BOOST_CHECK(reg.valid());BOOST_CHECK_EQUAL(reg.value(), x);BOOST_CHECK_THROW(c->write(addr, 0xF0000000, 0xF0), uhal::exception::BitsSetWhichAreForbiddenByBitMask);BOOST_CHECK_THROW(c->write(addr, 0xFF, 0x0F), uhal::exception::BitsSetWhichAreForbiddenByBitMask);uint32_t y=static_cast< uint32_t >(rand()) &0xF;c->write(addr, y, 0xF);ValWord< uint32_t > reg2=c->read(addr);BOOST_CHECK(!reg2.valid());BOOST_CHECK_THROW(reg2.value(), uhal::exception::NonValidatedMemory);c->dispatch();BOOST_CHECK(reg2.valid());BOOST_CHECK_EQUAL(reg2.value(),((x &~0xF)|y));ValWord< uint32_t > reg3=c->read(addr, 0xF);BOOST_CHECK(!reg3.valid());BOOST_CHECK_THROW(reg3.value(), uhal::exception::NonValidatedMemory);c->dispatch();BOOST_CHECK(reg3.valid());BOOST_CHECK_EQUAL(reg3.value(), y);}) UHAL_TESTS_DEFINE_CLIENT_TEST_CASES(RawClientTestSuite
 
 for (size_t i=0;i!=N;++i)
 
c writeBlock (addr, xx)
 
 BOOST_CHECK (!mem.valid())
 
 BOOST_CHECK_EQUAL (mem.size(), N)
 
 BOOST_CHECK_THROW (mem.at(0), uhal::exception::NonValidatedMemory)
 
c dispatch ()
 
 BOOST_CHECK (mem.valid())
 
 for (ValVector< uint32_t >::const_iterator i(mem.begin());i!=mem.end();++i,++j)
 
 BOOST_CHECK (correct_block_write_read)
 
 UHAL_TESTS_DEFINE_CLIENT_TEST_CASES (RawClientTestSuite, mem_rmw_bits, DummyHardwareFixture, { HwInterface hw=getHwInterface();ClientInterface *c=&hw.getClient();uint32_t addr=hw.getNode("REG_UPPER_MASK").getAddress();uint32_t x1=static_cast< uint32_t >(rand());uint32_t x2=static_cast< uint32_t >(rand());uint32_t x3=static_cast< uint32_t >(rand());c->write(addr, x1);ValWord< uint32_t > reg1=c->rmw_bits(addr, x2, x3);ValWord< uint32_t > reg2=c->read(addr);c->dispatch();BOOST_CHECK_EQUAL(((x1 &x2)|x3), reg2.value());if(hw.uri().find("ipbusudp-1.3://") !=std::string::npos||hw.uri().find("ipbustcp-1.3://") !=std::string::npos||hw.uri().find("chtcp-1.3://") !=std::string::npos) { BOOST_CHECK_EQUAL(reg1.value(),((x1 &x2)|x3));} else { BOOST_CHECK_EQUAL(reg1.value(), x1);} }) UHAL_TESTS_DEFINE_CLIENT_TEST_CASES(RawClientTestSuite
 
 if (hw.uri().find("ipbusudp-1.3://") !=std::string::npos||hw.uri().find("ipbustcp-1.3://") !=std::string::npos||hw.uri().find("chtcp-1.3://") !=std::string::npos)
 
uint32_t x (0x00000000)
 
c write (addr, xx[0])
 
 BOOST_CHECK_EQUAL (reg.value(), total)
 
 UHAL_TESTS_DEFINE_CLIENT_TEST_CASES (SingleReadWriteTestSuite, connect_write_read, DummyHardwareFixture, { HwInterface hw=getHwInterface();uint32_t x1=static_cast< uint32_t >(rand());uint32_t x2=static_cast< uint32_t >(rand());hw.getNode("SUBSYSTEM1.REG").write(x1);hw.getNode("SUBSYSTEM2.REG").write(x2);ValWord< uint32_t > mem1=hw.getNode("SUBSYSTEM1.REG").read();ValWord< uint32_t > mem2=hw.getNode("SUBSYSTEM2.REG").read();BOOST_CHECK(!mem1.valid());BOOST_CHECK(!mem2.valid());BOOST_CHECK_THROW(mem1.value(), uhal::exception::NonValidatedMemory);BOOST_CHECK_THROW(mem2.value(), uhal::exception::NonValidatedMemory);BOOST_CHECK_NO_THROW(hw.dispatch());BOOST_CHECK(mem1.valid());BOOST_CHECK_EQUAL(mem1.value(), x1);BOOST_CHECK_EQUAL(mem2.value(), x2);}) UHAL_TESTS_DEFINE_CLIENT_TEST_CASES(SingleReadWriteTestSuite
 
boost::filesystem::path fn ("dummy_address.xml")
 
hw setTimeoutPeriod (timeout)
 
hw getNode ("REG").write(x)
 
 BOOST_CHECK_THROW (mem.value(), uhal::exception::NonValidatedMemory)
 
 BOOST_CHECK_EQUAL (mem.value(), x)
 
void report_rx_performance (ClientInterface &aClient, const uint32_t aBaseAddr, const uint32_t aDepth, const size_t aNrIterations, const bool aDispatchEachIteration)
 
void report_tx_performance (ClientInterface &aClient, const uint32_t aBaseAddr, const uint32_t aDepth, const size_t aNrIterations, const bool aDispatchEachIteration)
 
 UHAL_TESTS_DEFINE_CLIENT_TEST_CASES (SoakTestSuite, bandwidth_rx, DummyHardwareFixture, { if(quickTest) BOOST_TEST_MESSAGE(" *** Skipping soak tests since '--quick' flag was used ***");else { HwInterface hw=getHwInterface();BOOST_CHECK_NO_THROW(report_rx_performance(hw.getClient(), 0x01, 1, 100, true));BOOST_CHECK_NO_THROW(report_rx_performance(hw.getClient(), 0x01, 262144, 100, true));} }) UHAL_TESTS_DEFINE_CLIENT_TEST_CASES(SoakTestSuite
 
 BOOST_CHECK_NO_THROW (report_tx_performance(hw.getClient(), 0x01, 1, 100, true))
 
 BOOST_CHECK_NO_THROW (report_tx_performance(hw.getClient(), 0x01, 262144, 100, true))
 
URI parseURI (const std::string &aUri)
 
 BOOST_AUTO_TEST_CASE (udp)
 
 BOOST_AUTO_TEST_CASE (controlhub)
 
 BOOST_AUTO_TEST_CASE (pcie)
 

Variables

static const uint32_t ADDRESSMASK = 0x00FFFFFF
 The mask for the address space (size of the address space in one larger than this) More...
 
static const uint32_t REPLY_HISTORY_DEPTH = 5
 The size of the reply history for IPbus 2.0. More...
 
static const uint32_t BUFFER_SIZE = 100000
 Size of the receive and reply buffers. More...
 
 fifo_write_read
 
 DummyHardwareFixture
 
 block_access_type_violations
 
std::vector< uint32_t > xx
 
 block_offset_bigger_than_size_attribute
 
 MinimalFixture
 
 read_masked
 
IPbusCoreclient = dynamic_cast<IPbusCore&>(hw.getClient())
 
 empty_dispatch_after_read
 
 mem_write_read
 
HwInterface hw = getHwInterface()
 
ClientInterfacec = &hw.getClient()
 
uint32_t addr = hw.getNode ( "MEM" ).getAddress()
 
ValVector< uint32_t > mem = c->readBlock ( addr, N )
 
bool correct_block_write_read = true
 
std::vector< uint32_t >::const_iterator j =xx.begin()
 
 mem_rmw_sum
 
uint32_t total = 0
 
bool IPbus1_3
 
 else
 
ValWord< uint32_t > reg
 
 on_the_fly_connect_write_read
 
 address_file = ( conn_fn.parent_path() /fn ).string()
 
std::string uri = getHwInterface().uri()
 
uint32_t x = static_cast<uint32_t> ( rand() )
 
 bandwidth_tx
 

Enumeration Type Documentation

◆ DeviceType

Enumerator
IPBUS_1_3_UDP 
IPBUS_1_3_TCP 
IPBUS_1_3_CONTROLHUB 
IPBUS_2_0_UDP 
IPBUS_2_0_TCP 
IPBUS_2_0_CONTROLHUB 
IPBUS_2_0_PCIE 

Definition at line 39 of file definitions.hpp.

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/5]

uhal::tests::BOOST_AUTO_TEST_CASE ( controlhub  )

◆ BOOST_AUTO_TEST_CASE() [2/5]

uhal::tests::BOOST_AUTO_TEST_CASE ( core_clients  )

◆ BOOST_AUTO_TEST_CASE() [3/5]

uhal::tests::BOOST_AUTO_TEST_CASE ( pcie  )

◆ BOOST_AUTO_TEST_CASE() [4/5]

uhal::tests::BOOST_AUTO_TEST_CASE ( udp  )

◆ BOOST_AUTO_TEST_CASE() [5/5]

uhal::tests::BOOST_AUTO_TEST_CASE ( user_clients  )

◆ BOOST_CHECK() [1/3]

uhal::tests::BOOST_CHECK ( !mem.  valid())

◆ BOOST_CHECK() [2/3]

uhal::tests::BOOST_CHECK ( correct_block_write_read  )

◆ BOOST_CHECK() [3/3]

uhal::tests::BOOST_CHECK ( mem.  valid())

◆ BOOST_CHECK_EQUAL() [1/3]

uhal::tests::BOOST_CHECK_EQUAL ( mem.  size(),
 
)

◆ BOOST_CHECK_EQUAL() [2/3]

uhal::tests::BOOST_CHECK_EQUAL ( mem.  value(),
x   
)

◆ BOOST_CHECK_EQUAL() [3/3]

uhal::tests::BOOST_CHECK_EQUAL ( reg.  value(),
total   
)

◆ BOOST_CHECK_NO_THROW() [1/6]

uhal::tests::BOOST_CHECK_NO_THROW ( hw.  dispatch())

◆ BOOST_CHECK_NO_THROW() [2/6]

uhal::tests::BOOST_CHECK_NO_THROW ( hw.  getNode"REG").writeBlock(xx)

◆ BOOST_CHECK_NO_THROW() [3/6]

uhal::tests::BOOST_CHECK_NO_THROW ( report_tx_performance(hw.getClient(), 0x01, 1, 100, true)  )

◆ BOOST_CHECK_NO_THROW() [4/6]

uhal::tests::BOOST_CHECK_NO_THROW ( report_tx_performance(hw.getClient(), 0x01, 262144, 100, true)  )

◆ BOOST_CHECK_NO_THROW() [5/6]

uhal::tests::BOOST_CHECK_NO_THROW ( ValVector< uint32_t >  mem = hw.getNode("REG").readBlock(N_4B))

◆ BOOST_CHECK_NO_THROW() [6/6]

uhal::tests::BOOST_CHECK_NO_THROW ( ValWord< uint32_t >  r = hw.getNode("REG").read())

◆ BOOST_CHECK_THROW() [1/11]

uhal::tests::BOOST_CHECK_THROW ( hw.  getNode"FIFO").writeBlockOffset(xx, 1,
uhal::exception::BulkTransferOffsetRequestedForFifo   
)

◆ BOOST_CHECK_THROW() [2/11]

uhal::tests::BOOST_CHECK_THROW ( hw.  getNode"REG").writeBlock(xx,
uhal::exception::BulkTransferOnSingleRegister   
)

◆ BOOST_CHECK_THROW() [3/11]

uhal::tests::BOOST_CHECK_THROW ( hw.  getNode"REG").writeBlockOffset(xx, 0,
uhal::exception::BulkTransferOffsetRequestedForSingleRegister   
)

◆ BOOST_CHECK_THROW() [4/11]

uhal::tests::BOOST_CHECK_THROW ( hw.  getNode"SMALL_MEM").writeBlockOffset(xx, 1,
uhal::exception::BulkTransferRequestedTooLarge   
)

◆ BOOST_CHECK_THROW() [5/11]

uhal::tests::BOOST_CHECK_THROW ( hw.  getNode"SMALL_MEM").writeBlockOffset(xx, 256,
uhal::exception::BulkTransferRequestedTooLarge   
)

◆ BOOST_CHECK_THROW() [6/11]

uhal::tests::BOOST_CHECK_THROW ( mem.  at0,
uhal::exception::NonValidatedMemory   
)

◆ BOOST_CHECK_THROW() [7/11]

uhal::tests::BOOST_CHECK_THROW ( mem.  value(),
uhal::exception::NonValidatedMemory   
)

◆ BOOST_CHECK_THROW() [8/11]

uhal::tests::BOOST_CHECK_THROW ( ValVector< uint32_t >  mem = hw.getNode("FIFO").readBlockOffset(N_1kB, 1),
uhal::exception::BulkTransferOffsetRequestedForFifo   
)

◆ BOOST_CHECK_THROW() [9/11]

uhal::tests::BOOST_CHECK_THROW ( ValVector< uint32_t >  mem = hw.getNode("REG").readBlock(N_1kB),
uhal::exception::BulkTransferOnSingleRegister   
)

◆ BOOST_CHECK_THROW() [10/11]

uhal::tests::BOOST_CHECK_THROW ( ValVector< uint32_t >  mem = hw.getNode("REG").readBlockOffset(N_1kB, 0),
uhal::exception::BulkTransferOffsetRequestedForSingleRegister   
)

◆ BOOST_CHECK_THROW() [11/11]

uhal::tests::BOOST_CHECK_THROW ( ValVector< uint32_t >  mem = hw.getNode("SMALL_MEM").readBlockOffset(N_4B, 256),
uhal::exception::BulkTransferRequestedTooLarge   
)

◆ BOOST_FIXTURE_TEST_CASE() [1/22]

uhal::tests::BOOST_FIXTURE_TEST_CASE ( address_description  ,
DummyAddressFileFixture   
)

◆ BOOST_FIXTURE_TEST_CASE() [2/22]

uhal::tests::BOOST_FIXTURE_TEST_CASE ( dummy_address_files  ,
DummyAddressFileFixture   
)

Definition at line 689 of file test_nodes.cpp.

References checkNodeTree(), and uhal::NodeTreeBuilder::getInstance().

◆ BOOST_FIXTURE_TEST_CASE() [3/22]

uhal::tests::BOOST_FIXTURE_TEST_CASE ( invalid_address  ,
SimpleAddressTableFixture   
)

◆ BOOST_FIXTURE_TEST_CASE() [4/22]

uhal::tests::BOOST_FIXTURE_TEST_CASE ( invalid_ID  ,
SimpleAddressTableFixture   
)

◆ BOOST_FIXTURE_TEST_CASE() [5/22]

uhal::tests::BOOST_FIXTURE_TEST_CASE ( invalid_mask  ,
SimpleAddressTableFixture   
)

◆ BOOST_FIXTURE_TEST_CASE() [6/22]

uhal::tests::BOOST_FIXTURE_TEST_CASE ( invalid_mode  ,
SimpleAddressTableFixture   
)

◆ BOOST_FIXTURE_TEST_CASE() [7/22]

uhal::tests::BOOST_FIXTURE_TEST_CASE ( invalid_permission  ,
SimpleAddressTableFixture   
)

◆ BOOST_FIXTURE_TEST_CASE() [8/22]

uhal::tests::BOOST_FIXTURE_TEST_CASE ( invalid_size  ,
SimpleAddressTableFixture   
)

◆ BOOST_FIXTURE_TEST_CASE() [9/22]

uhal::tests::BOOST_FIXTURE_TEST_CASE ( missing_ID  ,
SimpleAddressTableFixture   
)

◆ BOOST_FIXTURE_TEST_CASE() [10/22]

uhal::tests::BOOST_FIXTURE_TEST_CASE ( no_overlap  ,
AddressTableOverlapFixture   
)

◆ BOOST_FIXTURE_TEST_CASE() [11/22]

uhal::tests::BOOST_FIXTURE_TEST_CASE ( overlap_masked_reg_vs_port  ,
AddressTableOverlapFixture   
)

◆ BOOST_FIXTURE_TEST_CASE() [12/22]

uhal::tests::BOOST_FIXTURE_TEST_CASE ( overlap_masked_registers_1  ,
AddressTableOverlapFixture   
)

◆ BOOST_FIXTURE_TEST_CASE() [13/22]

uhal::tests::BOOST_FIXTURE_TEST_CASE ( overlap_masked_registers_2  ,
AddressTableOverlapFixture   
)

◆ BOOST_FIXTURE_TEST_CASE() [14/22]

uhal::tests::BOOST_FIXTURE_TEST_CASE ( overlap_multiple_1  ,
AddressTableOverlapFixture   
)

◆ BOOST_FIXTURE_TEST_CASE() [15/22]

uhal::tests::BOOST_FIXTURE_TEST_CASE ( overlap_multiple_2  ,
AddressTableOverlapFixture   
)

◆ BOOST_FIXTURE_TEST_CASE() [16/22]

uhal::tests::BOOST_FIXTURE_TEST_CASE ( overlap_ports  ,
AddressTableOverlapFixture   
)

◆ BOOST_FIXTURE_TEST_CASE() [17/22]

uhal::tests::BOOST_FIXTURE_TEST_CASE ( overlap_ram  ,
AddressTableOverlapFixture   
)

◆ BOOST_FIXTURE_TEST_CASE() [18/22]

uhal::tests::BOOST_FIXTURE_TEST_CASE ( overlap_unmasked_reg_vs_masked_reg  ,
AddressTableOverlapFixture   
)

◆ BOOST_FIXTURE_TEST_CASE() [19/22]

uhal::tests::BOOST_FIXTURE_TEST_CASE ( overlap_unmasked_reg_vs_port  ,
AddressTableOverlapFixture   
)

◆ BOOST_FIXTURE_TEST_CASE() [20/22]

uhal::tests::BOOST_FIXTURE_TEST_CASE ( overlap_unmasked_registers  ,
AddressTableOverlapFixture   
)

◆ BOOST_FIXTURE_TEST_CASE() [21/22]

uhal::tests::BOOST_FIXTURE_TEST_CASE ( size_without_node_attribute  ,
SimpleAddressTableFixture   
)

◆ BOOST_FIXTURE_TEST_CASE() [22/22]

uhal::tests::BOOST_FIXTURE_TEST_CASE ( valid_default  ,
SimpleAddressTableFixture   
)

Definition at line 753 of file test_nodes.cpp.

References checkNodeTree(), and uhal::NodeTreeBuilder::getInstance().

◆ checkClientFactory() [1/2]

template<class T >
void uhal::tests::checkClientFactory ( const std::string &  aId,
const std::string &  aURI 
)

◆ checkClientFactory() [2/2]

template<class T >
void uhal::tests::checkClientFactory ( const std::string &  aId,
const std::string &  aURI,
const std::vector< std::string > &  aUserClientActivationList 
)

◆ checkDescendants()

void uhal::tests::checkDescendants ( const uhal::Node aNode,
const NodeProperties aProperties 
)

◆ checkExceptionsThrownByReadWrite()

void uhal::tests::checkExceptionsThrownByReadWrite ( const uhal::Node aNode,
const NodeProperties aProperties 
)

◆ checkIteration()

void uhal::tests::checkIteration ( const uhal::Node aNode,
const NodeProperties aProperties 
)

◆ checkLineage()

void uhal::tests::checkLineage ( const uhal::Node aTopNode,
const uhal::Node aNode 
)

Definition at line 627 of file test_nodes.cpp.

References uhal::Node::getLineage(), uhal::Node::getNode(), and uhal::Node::getPath().

Referenced by checkNodeTree().

◆ checkNodeTree()

void uhal::tests::checkNodeTree ( const uhal::Node aNode,
const std::vector< NodeProperties > &  aExpectedProperties 
)

◆ checkProperties()

void uhal::tests::checkProperties ( const uhal::Node aNode,
const NodeProperties aExpected 
)

◆ dispatch()

c uhal::tests::dispatch ( )

◆ fn()

boost::filesystem::path uhal::tests::fn ( "dummy_address.xml"  )

◆ for() [1/3]

uhal::tests::for ( size_t  i = 0; i!= N; ++i)

Definition at line 97 of file test_rawclient.cpp.

References xx.

◆ for() [2/3]

uhal::tests::for ( )

◆ for() [3/3]

uhal::tests::for ( ValVector< uint32_t >::const_iterator i(mem.begin());i!  = mem.end(); ++i,
++  j 
)

Definition at line 114 of file test_rawclient.cpp.

References correct_block_write_read, and j.

◆ getBlockUnitTestDepths()

std::vector<size_t> uhal::tests::getBlockUnitTestDepths ( const size_t  aMaxSize)

Definition at line 61 of file test_block.cpp.

References N_10MB, N_1kB, N_1MB, N_200MB, and N_4B.

Referenced by UHAL_TESTS_DEFINE_CLIENT_TEST_CASES().

◆ getNode()

hw uhal::tests::getNode ( "REG"  )

◆ getNthChild()

pugi::xml_node uhal::tests::getNthChild ( const pugi::xml_node aNode,
const size_t  aIndex 
)

◆ if()

uhal::tests::if ( hw.uri().find("ipbusudp-1.3://") !  = std::string::npos || hw.uri().find ( "ipbustcp-1.3://" ) != std::string::npos || hw.uri().find ( "chtcp-1.3://" ) != std::string::npos)

Definition at line 163 of file test_rawclient.cpp.

References IPbus1_3.

◆ job_multiple()

void uhal::tests::job_multiple ( const std::string &  connection,
const std::string &  id,
const size_t  timeout 
)

◆ measureFileReadLatency()

double uhal::tests::measureFileReadLatency ( const std::string &  aFilePath,
uint32_t  aBaseAddr,
uint32_t  aDepth,
size_t  aNrIterations,
bool  aVerbose 
)

◆ measureFileWriteLatency()

double uhal::tests::measureFileWriteLatency ( const std::string &  aFilePath,
uint32_t  aBaseAddr,
uint32_t  aDepth,
size_t  aNrIterations,
bool  aVerbose 
)

Definition at line 184 of file tools.cpp.

References uhal::tests::Timer::elapsedSeconds(), and uhal::PCIe::File::write().

◆ measureReadLatency() [1/2]

double uhal::tests::measureReadLatency ( ClientInterface aClient,
uint32_t  aBaseAddr,
uint32_t  aDepth,
size_t  aNrIterations,
bool  aDispatchEachIteration,
bool  aVerbose 
)

Definition at line 67 of file tools.cpp.

Referenced by uhal::tests::PerfTester::bandwidthRxTest(), and report_rx_performance().

◆ measureReadLatency() [2/2]

double uhal::tests::measureReadLatency ( const std::vector< ClientInterface * > &  aClients,
uint32_t  aBaseAddr,
uint32_t  aDepth,
size_t  aNrIterations,
bool  aDispatchEachIteration,
bool  aVerbose 
)

Definition at line 73 of file tools.cpp.

References uhal::tests::Timer::elapsedSeconds(), and uhal::defs::NON_INCREMENTAL.

◆ measureWriteLatency() [1/2]

double uhal::tests::measureWriteLatency ( ClientInterface aClient,
uint32_t  aBaseAddr,
uint32_t  aDepth,
size_t  aNrIterations,
bool  aDispatchEachIteration,
bool  aVerbose 
)

Definition at line 111 of file tools.cpp.

Referenced by uhal::tests::PerfTester::bandwidthTxTest(), and report_tx_performance().

◆ measureWriteLatency() [2/2]

double uhal::tests::measureWriteLatency ( const std::vector< ClientInterface * > &  aClients,
uint32_t  aBaseAddr,
uint32_t  aDepth,
size_t  aNrIterations,
bool  aDispatchEachIteration,
bool  aVerbose 
)

Definition at line 117 of file tools.cpp.

References uhal::tests::Timer::elapsedSeconds(), and uhal::defs::NON_INCREMENTAL.

◆ nodeAddrCompare()

bool uhal::tests::nodeAddrCompare ( const Node aNodeL,
const Node aNodeR 
)

Definition at line 601 of file test_nodes.cpp.

References uhal::Node::getAddress().

Referenced by checkIteration().

◆ parseURI()

URI uhal::tests::parseURI ( const std::string &  aUri)

Definition at line 38 of file test_uri.cpp.

Referenced by BOOST_AUTO_TEST_CASE().

◆ report_rx_performance()

void uhal::tests::report_rx_performance ( ClientInterface aClient,
const uint32_t  aBaseAddr,
const uint32_t  aDepth,
const size_t  aNrIterations,
const bool  aDispatchEachIteration 
)

Definition at line 57 of file test_soak.cpp.

References measureReadLatency().

Referenced by UHAL_TESTS_DEFINE_CLIENT_TEST_CASES().

◆ report_tx_performance()

void uhal::tests::report_tx_performance ( ClientInterface aClient,
const uint32_t  aBaseAddr,
const uint32_t  aDepth,
const size_t  aNrIterations,
const bool  aDispatchEachIteration 
)

Definition at line 68 of file test_soak.cpp.

References measureWriteLatency().

◆ resize() [1/2]

xx uhal::tests::resize ( N_1kB  )

◆ resize() [2/2]

xx uhal::tests::resize ( N_4B  )

◆ setAttribute()

void uhal::tests::setAttribute ( pugi::xml_node  aNode,
const std::string &  aName,
const std::string &  aValue 
)

◆ setTimeoutPeriod()

hw uhal::tests::setTimeoutPeriod ( timeout  )

◆ UHAL_TESTS_DEFINE_CLIENT_TEST_CASES() [1/12]

uhal::tests::UHAL_TESTS_DEFINE_CLIENT_TEST_CASES ( BlockReadWriteTestSuite  ,
block_bigger_than_size_attribute  ,
MinimalFixture  ,
{ HwInterface hw=getHwInterface();std::vector< uint32_t > xx;xx.resize(N_1MB);BOOST_CHECK_THROW(hw.getNode("SMALL_MEM").writeBlock(xx), uhal::exception::BulkTransferRequestedTooLarge);BOOST_CHECK_THROW(ValVector< uint32_t > mem=hw.getNode("SMALL_MEM").readBlock(N_1MB), uhal::exception::BulkTransferRequestedTooLarge);}   
)

◆ UHAL_TESTS_DEFINE_CLIENT_TEST_CASES() [2/12]

uhal::tests::UHAL_TESTS_DEFINE_CLIENT_TEST_CASES ( BlockReadWriteTestSuite  ,
block_offset_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);std::vector< uint32_t > yy;yy.reserve(N);for(size_t i=0;i!=N;++i) { xx.push_back(static_cast< uint32_t >(rand()));yy.push_back(static_cast< uint32_t >(rand()));} hw.getNode("LARGE_MEM").writeBlockOffset(xx, 0);ValVector< uint32_t > mem=hw.getNode("LARGE_MEM").readBlockOffset(N, 0);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);hw.getNode("LARGE_MEM").writeBlockOffset(yy, N);ValVector< uint32_t > mem2=hw.getNode("LARGE_MEM").readBlockOffset(N, N);BOOST_CHECK(!mem2.valid());BOOST_CHECK_EQUAL(mem2.size(), N);if(N > 0) { BOOST_CHECK_THROW(mem2.at(0), uhal::exception::NonValidatedMemory);} BOOST_CHECK_THROW(mem2.value(), uhal::exception::NonValidatedMemory);BOOST_CHECK_NO_THROW(hw.dispatch());BOOST_CHECK(mem.valid());BOOST_CHECK_EQUAL(mem.size(), N);BOOST_CHECK(mem2.valid());BOOST_CHECK_EQUAL(mem2.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);} j=yy.begin();for(ValVector< uint32_t >::const_iterator i(mem2.begin());i!=mem2.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() [3/12]

uhal::tests::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() [4/12]

uhal::tests::UHAL_TESTS_DEFINE_CLIENT_TEST_CASES ( ConfigSpaceTestSuite  ,
read_fullWord  ,
DummyHardwareFixture  ,
{ HwInterface hw=getHwInterface();IPbusCore &client=dynamic_cast< IPbusCore & >(hw.getClient());for(size_t i=0;i< 10;i++) { const uint32_t expectedValue=uint16_t(getpid())<< 16|i;switch(deviceType) { case IPBUS_1_3_UDP :case IPBUS_1_3_TCP :case IPBUS_1_3_CONTROLHUB :BOOST_CHECK_THROW(client.readConfigurationSpace(i), exception::ValidationError);break;default:ValWord< uint32_t > x=client.readConfigurationSpace(i);client.dispatch();BOOST_CHECK_EQUAL(x.value(), expectedValue);} } }   
)

◆ UHAL_TESTS_DEFINE_CLIENT_TEST_CASES() [5/12]

uhal::tests::UHAL_TESTS_DEFINE_CLIENT_TEST_CASES ( EmptyDispatchTestSuite  ,
empty_dispatch  ,
MinimalFixture  ,
{ HwInterface hw=getHwInterface();BOOST_CHECK_NO_THROW(hw.dispatch());}   
)

◆ UHAL_TESTS_DEFINE_CLIENT_TEST_CASES() [6/12]

uhal::tests::UHAL_TESTS_DEFINE_CLIENT_TEST_CASES ( MultithreadedTestSuite  ,
multiple_hwinterfaces  ,
DummyHardwareFixture  ,
{ std::vector< boost::thread * > jobs;for(size_t i=0;i!=N_THREADS;++i) { log(Warning(), ThisLocation(), ":", Integer(i));jobs.push_back(new boost::thread(job_multiple, connectionFileURI, deviceId, timeout));} for(size_t i=0;i!=N_THREADS;++i) { log(Warning(), ThisLocation(), ":", Integer(i));jobs[i]->join();delete jobs[i];} log(Warning(), ThisLocation());}   
) &

◆ UHAL_TESTS_DEFINE_CLIENT_TEST_CASES() [7/12]

uhal::tests::UHAL_TESTS_DEFINE_CLIENT_TEST_CASES ( MultithreadedTestSuite  ,
single_hwinterface  ,
DummyHardwareFixture  ,
{ for(size_t iter=0;iter!=N_ITERATIONS ;++iter) { HwInterface hw=getHwInterface();std::vector< boost::thread * > jobs;for(size_t i=0;i!=N_THREADS;++i) { jobs.push_back(new boost::thread(job_single, hw));} for(size_t i=0;i!=N_THREADS;++i) { jobs[i]->join();delete jobs[i];} } }   
)

Definition at line 148 of file test_multithreaded.cpp.

References hw, N_ITERATIONS, and N_THREADS.

◆ UHAL_TESTS_DEFINE_CLIENT_TEST_CASES() [8/12]

uhal::tests::UHAL_TESTS_DEFINE_CLIENT_TEST_CASES ( NonreachableTestSuite  ,
check_nonreachable_device  ,
MinimalFixture  ,
{ const size_t numTests(quickTest ? 1 :10);for(size_t i=0;i< numTests;i++) { HwInterface hw=getHwInterface();if((hw.uri().find("ipbustcp") !=std::string::npos)||(hw.uri().find("ipbuspcie") !=std::string::npos)) { BOOST_CHECK_THROW({ hw.getNode("REG").read();hw.dispatch();}, uhal::exception::TransportLayerError);} else { BOOST_CHECK_THROW({ hw.getNode("REG").read();hw.dispatch();}, uhal::exception::ClientTimeout);} } }   
) const

◆ UHAL_TESTS_DEFINE_CLIENT_TEST_CASES() [9/12]

uhal::tests::UHAL_TESTS_DEFINE_CLIENT_TEST_CASES ( RawClientTestSuite  ,
mem_rmw_bits  ,
DummyHardwareFixture  ,
{ HwInterface hw=getHwInterface();ClientInterface *c=&hw.getClient();uint32_t addr=hw.getNode("REG_UPPER_MASK").getAddress();uint32_t x1=static_cast< uint32_t >(rand());uint32_t x2=static_cast< uint32_t >(rand());uint32_t x3=static_cast< uint32_t >(rand());c->write(addr, x1);ValWord< uint32_t > reg1=c->rmw_bits(addr, x2, x3);ValWord< uint32_t > reg2=c->read(addr);c->dispatch();BOOST_CHECK_EQUAL(((x1 &x2)|x3), reg2.value());if(hw.uri().find("ipbusudp-1.3://") !=std::string::npos||hw.uri().find("ipbustcp-1.3://") !=std::string::npos||hw.uri().find("chtcp-1.3://") !=std::string::npos) { BOOST_CHECK_EQUAL(reg1.value(),((x1 &x2)|x3));} else { BOOST_CHECK_EQUAL(reg1.value(), x1);} }   
)

◆ UHAL_TESTS_DEFINE_CLIENT_TEST_CASES() [10/12]

uhal::tests::UHAL_TESTS_DEFINE_CLIENT_TEST_CASES ( RawClientTestSuite  ,
single_write_read  ,
DummyHardwareFixture  ,
{ HwInterface hw=getHwInterface();ClientInterface *c=&hw.getClient();uint32_t x=static_cast< uint32_t >(rand());uint32_t addr=hw.getNode("REG").getAddress();c->write(addr, x);ValWord< uint32_t > reg=c->read(addr);BOOST_CHECK(!reg.valid());BOOST_CHECK_THROW(reg.value(), uhal::exception::NonValidatedMemory);c->dispatch();BOOST_CHECK(reg.valid());BOOST_CHECK_EQUAL(reg.value(), x);BOOST_CHECK_THROW(c->write(addr, 0xF0000000, 0xF0), uhal::exception::BitsSetWhichAreForbiddenByBitMask);BOOST_CHECK_THROW(c->write(addr, 0xFF, 0x0F), uhal::exception::BitsSetWhichAreForbiddenByBitMask);uint32_t y=static_cast< uint32_t >(rand()) &0xF;c->write(addr, y, 0xF);ValWord< uint32_t > reg2=c->read(addr);BOOST_CHECK(!reg2.valid());BOOST_CHECK_THROW(reg2.value(), uhal::exception::NonValidatedMemory);c->dispatch();BOOST_CHECK(reg2.valid());BOOST_CHECK_EQUAL(reg2.value(),((x &~0xF)|y));ValWord< uint32_t > reg3=c->read(addr, 0xF);BOOST_CHECK(!reg3.valid());BOOST_CHECK_THROW(reg3.value(), uhal::exception::NonValidatedMemory);c->dispatch();BOOST_CHECK(reg3.valid());BOOST_CHECK_EQUAL(reg3.value(), y);}   
)

◆ UHAL_TESTS_DEFINE_CLIENT_TEST_CASES() [11/12]

uhal::tests::UHAL_TESTS_DEFINE_CLIENT_TEST_CASES ( SingleReadWriteTestSuite  ,
connect_write_read  ,
DummyHardwareFixture  ,
{ HwInterface hw=getHwInterface();uint32_t x1=static_cast< uint32_t >(rand());uint32_t x2=static_cast< uint32_t >(rand());hw.getNode("SUBSYSTEM1.REG").write(x1);hw.getNode("SUBSYSTEM2.REG").write(x2);ValWord< uint32_t > mem1=hw.getNode("SUBSYSTEM1.REG").read();ValWord< uint32_t > mem2=hw.getNode("SUBSYSTEM2.REG").read();BOOST_CHECK(!mem1.valid());BOOST_CHECK(!mem2.valid());BOOST_CHECK_THROW(mem1.value(), uhal::exception::NonValidatedMemory);BOOST_CHECK_THROW(mem2.value(), uhal::exception::NonValidatedMemory);BOOST_CHECK_NO_THROW(hw.dispatch());BOOST_CHECK(mem1.valid());BOOST_CHECK_EQUAL(mem1.value(), x1);BOOST_CHECK_EQUAL(mem2.value(), x2);}   
)

◆ UHAL_TESTS_DEFINE_CLIENT_TEST_CASES() [12/12]

uhal::tests::UHAL_TESTS_DEFINE_CLIENT_TEST_CASES ( SoakTestSuite  ,
bandwidth_rx  ,
DummyHardwareFixture  ,
{ if(quickTest) BOOST_TEST_MESSAGE(" *** Skipping soak tests since '--quick' flag was used ***");else { HwInterface hw=getHwInterface();BOOST_CHECK_NO_THROW(report_rx_performance(hw.getClient(), 0x01, 1, 100, true));BOOST_CHECK_NO_THROW(report_rx_performance(hw.getClient(), 0x01, 262144, 100, true));} }   
)

◆ write()

c uhal::tests::write ( addr  ,
xx  [0] 
)

◆ writeBlock()

c uhal::tests::writeBlock ( addr  ,
xx   
)

◆ x()

uint32_t uhal::tests::x ( 0x00000000  )

Variable Documentation

◆ addr

uint32_t uhal::tests::addr = hw.getNode ( "MEM" ).getAddress()

◆ address_file

uhal::tests::address_file = ( conn_fn.parent_path() /fn ).string()

Definition at line 86 of file test_single.cpp.

◆ ADDRESSMASK

const uint32_t uhal::tests::ADDRESSMASK = 0x00FFFFFF
static

The mask for the address space (size of the address space in one larger than this)

Definition at line 58 of file DummyHardware.hpp.

Referenced by uhal::tests::DummyHardware< IPbus_major, IPbus_minor >::SetEndpoint().

◆ bandwidth_tx

uhal::tests::bandwidth_tx

Definition at line 94 of file test_soak.cpp.

◆ block_access_type_violations

uhal::tests::block_access_type_violations

Definition at line 246 of file test_block.cpp.

◆ block_offset_bigger_than_size_attribute

uhal::tests::block_offset_bigger_than_size_attribute

Definition at line 282 of file test_block.cpp.

◆ BUFFER_SIZE

const uint32_t uhal::tests::BUFFER_SIZE = 100000
static

Size of the receive and reply buffers.

Definition at line 62 of file DummyHardware.hpp.

Referenced by uhal::tests::DummyHardware< IPbus_major, IPbus_minor >::status_packet_header().

◆ c

ClientInterface * uhal::tests::c = &hw.getClient()

◆ client

IPbusCore& uhal::tests::client = dynamic_cast<IPbusCore&>(hw.getClient())

◆ correct_block_write_read

bool uhal::tests::correct_block_write_read = true

Definition at line 111 of file test_rawclient.cpp.

Referenced by for(), and UHAL_TESTS_DEFINE_CLIENT_TEST_CASES().

◆ DummyHardwareFixture

Definition at line 131 of file test_block.cpp.

◆ else

uhal::tests::else
Initial value:
{
IPbus1_3=false

Definition at line 169 of file test_rawclient.cpp.

◆ empty_dispatch_after_read

uhal::tests::empty_dispatch_after_read

Definition at line 55 of file test_empty_dispatch.cpp.

◆ fifo_write_read

uhal::tests::fifo_write_read

Definition at line 131 of file test_block.cpp.

◆ hw

HwInterface uhal::tests::hw = getHwInterface()

◆ IPbus1_3

bool uhal::tests::IPbus1_3

Definition at line 160 of file test_rawclient.cpp.

Referenced by if().

◆ j

std::vector< uint32_t >::const_iterator uhal::tests::j =xx.begin()

◆ mem

ValWord< uint32_t > uhal::tests::mem = c->readBlock ( addr, N )

Definition at line 104 of file test_rawclient.cpp.

Referenced by for(), job_multiple(), and UHAL_TESTS_DEFINE_CLIENT_TEST_CASES().

◆ mem_rmw_sum

uhal::tests::mem_rmw_sum

Definition at line 153 of file test_rawclient.cpp.

◆ mem_write_read

uhal::tests::mem_write_read

Definition at line 90 of file test_rawclient.cpp.

◆ MinimalFixture

Definition at line 282 of file test_block.cpp.

◆ on_the_fly_connect_write_read

uhal::tests::on_the_fly_connect_write_read

Definition at line 79 of file test_single.cpp.

◆ read_masked

uhal::tests::read_masked

Definition at line 75 of file test_config_space.cpp.

◆ reg

ValWord<uint32_t> uhal::tests::reg

◆ REPLY_HISTORY_DEPTH

const uint32_t uhal::tests::REPLY_HISTORY_DEPTH = 5
static

The size of the reply history for IPbus 2.0.

Definition at line 60 of file DummyHardware.hpp.

Referenced by uhal::tests::DummyHardware< IPbus_major, IPbus_minor >::status_packet_header().

◆ total

uint32_t uhal::tests::total = 0

Definition at line 158 of file test_rawclient.cpp.

Referenced by load_stream_data_noseek().

◆ uri

std::string uhal::tests::uri = getHwInterface().uri()

◆ x

uint32_t uhal::tests::x = static_cast<uint32_t> ( rand() )

◆ xx

std::vector< uint32_t > uhal::tests::xx
uhal::HwInterface
A class which bundles a node tree and an IPbus client interface together providing everything you nee...
Definition: HwInterface.hpp:61
uhal::tests::hw
HwInterface hw
Definition: test_rawclient.cpp:93
uhal::tests::IPbus1_3
bool IPbus1_3
Definition: test_rawclient.cpp:160