μHAL (v2.8.17)
Part of the IPbus software repository
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
fixtures.hpp
Go to the documentation of this file.
1/*
2---------------------------------------------------------------------------
3
4 This file is part of uHAL.
5
6 uHAL is a hardware access library and programming framework
7 originally developed for upgrades of the Level-1 trigger of the CMS
8 experiment at CERN.
9
10 uHAL is free software: you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation, either version 3 of the License, or
13 (at your option) any later version.
14
15 uHAL is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with uHAL. If not, see <http://www.gnu.org/licenses/>.
22
23 Andrew Rose, Imperial College, London
24 email: awr01 <AT> imperial.ac.uk
25
26 Tom Williams, Rutherford Appleton Laboratory, Oxfordshire
27 email: tom.williams <AT> cern.ch
28
29---------------------------------------------------------------------------
30*/
31
32#ifndef _uhal_tests_fixtures_hpp_
33#define _uhal_tests_fixtures_hpp_
34
35
36#include <stdint.h>
37#include <string>
38
40#include "uhal/HwInterface.hpp"
42#include "uhal/tests/tools.hpp"
43
44
45namespace uhal {
46namespace tests {
47
49protected:
51 virtual ~AbstractFixture() {}
52
53 static std::string getAddressFileURI();
54
55public:
56 static std::string connectionFileURI;
57 // HW client timeout in milliseconds
58 static size_t timeout;
59 static bool quickTest;
60};
61
62
63
64template <DeviceType type> struct MinimalFixture;
65
66
67template <DeviceType type>
70 virtual ~MinimalFixture();
71
73
74 static const DeviceType deviceType;
75
76protected:
77 uint16_t devicePort;
78 std::string deviceId;
79};
80
81
82template <>
86
88
89 static const DeviceType deviceType;
92 std::string deviceId;
93};
94
95template <DeviceType type>
97
98template <>
100
101template <>
103
104template <>
106
107template <>
109
110template <>
112
113template <>
115
116
117template <DeviceType type>
119{
120}
121
122template <DeviceType type>
124{
125 ConnectionManager manager(connectionFileURI);
126 HwInterface hw(manager.getDevice(deviceId));
127 hw.setTimeoutPeriod(timeout);
128 return hw;
129}
130
131
132
133
134template <DeviceType type>
138
140};
141
142
143template <>
145
146template <>
148
149template <>
151
152template <>
154
155template <>
157
158template <>
160
161template <>
163
164
165} // end ns tests
166} // end ns uhal
167
168
169#endif
Definition: pytypes.h:1167
A class to open and manage XML connection files and wrap up the interfaces to the NodeTreeBuilder and...
HwInterface getDevice(const std::string &aId)
Retrieves protocol, host, and port from the connection file to create an IPbus Client Retrieves the a...
A class which bundles a node tree and an IPbus client interface together providing everything you nee...
Definition: HwInterface.hpp:56
void setTimeoutPeriod(const uint32_t &aTimeoutPeriod)
A method to modify the timeout period for any pending or future transactions.
None tests(nox.Session session)
Definition: noxfile.py:19
HwInterface hw
static std::string connectionFileURI
Definition: fixtures.hpp:56
static std::string getAddressFileURI()
Definition: fixtures.cpp:18
DummyHardwareRunner hwRunner
Definition: fixtures.hpp:139
static const DeviceType deviceType
Definition: fixtures.hpp:74
uhal::HwInterface getHwInterface() const
Definition: fixtures.hpp:123