μHAL (v2.6.5)
Part of the IPbus software repository
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fixtures.cpp
Go to the documentation of this file.
1 
3 
4 
8 
9 
10 namespace uhal {
11 namespace tests {
12 
13 
14 std::string AbstractFixture::connectionFileURI = "";
15 
16 template <>
18  devicePort(50001),
19  deviceId("dummy.udp")
20 {
21 }
22 
23 template <>
25  devicePort(50002),
26  deviceId("dummy.tcp")
27 {
28 }
29 
30 template <>
32  devicePort(50001),
33  deviceId("dummy.controlhub")
34 {
35 }
36 
37 template <>
39  devicePort(60001),
40  deviceId("dummy.udp2")
41 {
42 }
43 
44 template <>
46  devicePort(60002),
47  deviceId("dummy.tcp2")
48 {
49 }
50 
51 template <>
53  devicePort(60001),
54  deviceId("dummy.controlhub2")
55 {
56 }
57 
59  hardwareToClientFile("/tmp/uhal_pcie_device2client"),
60  clientToHardwareFile("/tmp/uhal_pcie_client2device"),
61  deviceId("dummy.pcie2")
62 {
63 }
64 
65 
67 {
68 }
69 
70 
72 {
74  return manager.getDevice(deviceId);
75 }
76 
77 
79 
80 
81 
82 
83 template <>
85  hwRunner(new UDPDummyHardware<1,3>(devicePort, 0, false))
86 {
87 }
88 
89 template <>
91  hwRunner(new UDPDummyHardware<1,3>(devicePort, 0, false))
92 {
93 }
94 
95 template <>
97  hwRunner(new TCPDummyHardware<1,3>(devicePort, 0, false))
98 {
99 }
100 
101 template <>
103  hwRunner(new UDPDummyHardware<2,0>(devicePort, 0, false))
104 {
105 }
106 
107 template <>
109  hwRunner(new UDPDummyHardware<2,0>(devicePort, 0, false))
110 {
111  // FIXME : Ensure that controlhub cache is reset after dummy hardware reboot, but before unit tests (temporary solution)
112  if ( deviceType == IPBUS_2_0_CONTROLHUB ) {
114  hw.getClient().read(0);
115  try {
116  hw.dispatch();
117  }
118  catch ( ... ) {
119  }
120  }
121 }
122 
123 template <>
125  hwRunner(new TCPDummyHardware<2,0>(devicePort, 0, false))
126 {
127 }
128 
129 template <>
131  hwRunner(new PCIeDummyHardware(clientToHardwareFile, hardwareToClientFile, 0, false))
132 {
133 }
134 
135 } // end ns tests
136 } // end ns uhal
ValWord< uint32_t > read(const uint32_t &aAddr)
Read a single, unmasked, unsigned word.
A class which bundles a node tree and an IPbus client interface together providing everything you nee...
Definition: HwInterface.hpp:59
DummyHardwareRunner hwRunner
Definition: fixtures.hpp:133
void dispatch()
Make the IPbus client issue a dispatch.
HwInterface getDevice(const std::string &aId)
Retrieves protocol, host, and port from the connection file to create an IPbus Client Retrieves the a...
static std::string connectionFileURI
Definition: fixtures.hpp:55
uhal::HwInterface getHwInterface() const
Definition: fixtures.hpp:119
Concrete implementation of emulator of hardware using TCP.
HwInterface hw
ClientInterface & getClient()
Get the underlying IPbus client.
Definition: HwInterface.cpp:79
Concrete implementation of emulator of hardware using UDP.
A class to open and manage XML connection files and wrap up the interfaces to the NodeTreeBuilder and...
static const DeviceType deviceType
Definition: fixtures.hpp:70