mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-02-18 10:58:41 +01:00
Dev/fix actual tests (#1285)
- fix acquire fail in tests (adcreg test) - roi tests fail after overlapping invalid test and acquire after - print udp dest mac in server properly - fixed udp dst list get (server was not sending entry proper size to match proper struct size in client) - updated server binaries and updated hard links in serverBin - added documentation regarding gui: zmqport and zmqip in terms of gui, rx_zmqstream - removed print - probably ended there for debuggung --------- Co-authored-by: Alice <alice.mazzoleni@psi.ch>
This commit is contained in:
@@ -201,6 +201,15 @@ Enabling the GUI automatically streams images from the receiver via ZMQ sockets.
|
|||||||
* Default: Receiver’s hostname (rx_hostname)
|
* Default: Receiver’s hostname (rx_hostname)
|
||||||
|
|
||||||
|
|
||||||
|
.. note ::
|
||||||
|
|
||||||
|
``zmqport`` and ``zmqip`` need to be set up in shared memory before starting up the Gui. If the Gui is already running, change it in the Advanced Tab directly in the Gui.
|
||||||
|
|
||||||
|
``rx_zmqstream`` is set to 1 when the GUI is started, but has to be manually set back to 0 to disable zmq streaming in the receiver for better performance when not using the Gui.
|
||||||
|
|
||||||
|
The GUI hwm (high water mark, which is like a measurement of the number of enqueued zmq packets) values are set to a low number (from library default of possibly 1000 to 2) to reduce the zmq buffer to display only some of the images. Resetting it back to -1 or 1000 should only matter if one plans to not use the Gui and still zmq stream without wanting to drop zmq images (eg. for external processing chain).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -36,6 +36,10 @@ set_target_properties(jungfrauDetectorServer_virtual PROPERTIES
|
|||||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# to compile fore 32 bit on a 64 bit machine
|
||||||
|
#target_compile_options(jungfrauDetectorServer_virtual PRIVATE -m32)
|
||||||
|
#target_link_options(jungfrauDetectorServer_virtual PRIVATE -m32)
|
||||||
|
|
||||||
install(TARGETS jungfrauDetectorServer_virtual
|
install(TARGETS jungfrauDetectorServer_virtual
|
||||||
EXPORT "${TARGETS_EXPORT_NAME}"
|
EXPORT "${TARGETS_EXPORT_NAME}"
|
||||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -5342,7 +5342,8 @@ int set_dest_udp_mac(int file_des) {
|
|||||||
|
|
||||||
if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0)
|
if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0)
|
||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
LOG(logINFO, ("Setting udp destination mac: 0x%lx\n", arg));
|
LOG(logINFO,
|
||||||
|
("Setting udp destination mac: 0x%llx\n", (long long unsigned)arg));
|
||||||
|
|
||||||
// only set
|
// only set
|
||||||
if (Server_VerifyLock() == OK) {
|
if (Server_VerifyLock() == OK) {
|
||||||
@@ -5363,7 +5364,8 @@ int get_dest_udp_mac(int file_des) {
|
|||||||
LOG(logDEBUG1, ("Getting udp destination mac\n"));
|
LOG(logDEBUG1, ("Getting udp destination mac\n"));
|
||||||
// get only
|
// get only
|
||||||
retval = udpDetails[0].dstmac;
|
retval = udpDetails[0].dstmac;
|
||||||
LOG(logDEBUG1, ("udp destination mac retval: 0x%lx\n", retval));
|
LOG(logDEBUG1,
|
||||||
|
("udp destination mac retval: 0x%llx\n", (long long unsigned)retval));
|
||||||
return Server_SendResult(file_des, INT64, &retval, sizeof(retval));
|
return Server_SendResult(file_des, INT64, &retval, sizeof(retval));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9190,7 +9192,7 @@ int get_dest_udp_list(int file_des) {
|
|||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
uint32_t arg = 0;
|
uint32_t arg = 0;
|
||||||
uint16_t retvals16[2] = {};
|
uint16_t retvals16[2] = {};
|
||||||
uint32_t retvals32[3] = {};
|
uint32_t retvals32[2] = {};
|
||||||
uint64_t retvals64[2] = {};
|
uint64_t retvals64[2] = {};
|
||||||
|
|
||||||
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
||||||
|
|||||||
Binary file not shown.
@@ -171,7 +171,7 @@ void create_files_for_acquire(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// acquire and get num frames caught
|
// acquire and get num frames caught
|
||||||
test_acquire_with_receiver(caller, det);
|
REQUIRE_NOTHROW(test_acquire_with_receiver(caller, det));
|
||||||
auto frames_caught = det.getFramesCaught().tsquash(
|
auto frames_caught = det.getFramesCaught().tsquash(
|
||||||
"Inconsistent number of frames caught")[0];
|
"Inconsistent number of frames caught")[0];
|
||||||
REQUIRE(frames_caught == num_frames);
|
REQUIRE(frames_caught == num_frames);
|
||||||
|
|||||||
@@ -29,6 +29,17 @@ struct testFileInfo {
|
|||||||
return file_path + "/" + file_prefix + "_virtual_" +
|
return file_path + "/" + file_prefix + "_virtual_" +
|
||||||
std::to_string(file_acq_index) + ".h5";
|
std::to_string(file_acq_index) + ".h5";
|
||||||
}
|
}
|
||||||
|
inline void print() const {
|
||||||
|
LOG(logINFO) << "File Info: "
|
||||||
|
<< "\n\tFile Path: " << file_path
|
||||||
|
<< "\n\tFile Prefix: " << file_prefix
|
||||||
|
<< "\n\tFile Acquisition Index: " << file_acq_index
|
||||||
|
<< "\n\tFile Write: " << file_write
|
||||||
|
<< "\n\tFile Overwrite: " << file_overwrite
|
||||||
|
<< "\n\tFile Format: " << ToString(file_format)
|
||||||
|
<< "\n\tMaster Filename: " << getMasterFileNamePrefix()
|
||||||
|
<< "\n\tVirtual Filename: " << getVirtualFileName();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct testCtbAcquireInfo {
|
struct testCtbAcquireInfo {
|
||||||
|
|||||||
@@ -479,6 +479,8 @@ TEST_CASE("rx_roi", "[.cmdcall]") {
|
|||||||
defs::xy detsize = det.getDetectorSize();
|
defs::xy detsize = det.getDetectorSize();
|
||||||
auto portSize = det.getPortSize()[0];
|
auto portSize = det.getPortSize()[0];
|
||||||
int delta = 50;
|
int delta = 50;
|
||||||
|
int numinterfaces = det.getNumberofUDPInterfaces().tsquash(
|
||||||
|
"inconsistent number of interfaces");
|
||||||
|
|
||||||
// 1d
|
// 1d
|
||||||
if (det_type == defs::GOTTHARD2 || det_type == defs::MYTHEN3) {
|
if (det_type == defs::GOTTHARD2 || det_type == defs::MYTHEN3) {
|
||||||
@@ -554,6 +556,12 @@ TEST_CASE("rx_roi", "[.cmdcall]") {
|
|||||||
"]]\n");
|
"]]\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// valid roi before acquiring
|
||||||
|
else {
|
||||||
|
std::ostringstream oss;
|
||||||
|
caller.call("rx_roi", {"10", "15"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "rx_roi [[10, 15]]\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 2d eiger, jungfrau, moench
|
// 2d eiger, jungfrau, moench
|
||||||
else {
|
else {
|
||||||
@@ -613,9 +621,6 @@ TEST_CASE("rx_roi", "[.cmdcall]") {
|
|||||||
REQUIRE_THROWS(caller.call(
|
REQUIRE_THROWS(caller.call(
|
||||||
"rx_roi", {"[0, 10, 0, 10] [0, 10, 9, 11]"}, -1, PUT));
|
"rx_roi", {"[0, 10, 0, 10] [0, 10, 9, 11]"}, -1, PUT));
|
||||||
|
|
||||||
int numinterfaces = det.getNumberofUDPInterfaces().tsquash(
|
|
||||||
"inconsistent number of interfaces");
|
|
||||||
|
|
||||||
// multiple ports horizontally
|
// multiple ports horizontally
|
||||||
if (det_type == defs::EIGER ||
|
if (det_type == defs::EIGER ||
|
||||||
(det.size() == 2 && det.getModuleGeometry().x > 1)) {
|
(det.size() == 2 && det.getModuleGeometry().x > 1)) {
|
||||||
@@ -667,6 +672,19 @@ TEST_CASE("rx_roi", "[.cmdcall]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// valid roi before acquiring
|
||||||
|
else {
|
||||||
|
std::ostringstream oss;
|
||||||
|
caller.call("rx_roi",
|
||||||
|
{"1", std::to_string(detsize.x - 5), "1",
|
||||||
|
std::to_string(detsize.y - 5)},
|
||||||
|
-1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == std::string("rx_roi [[1, ") +
|
||||||
|
std::to_string(detsize.x - 5) +
|
||||||
|
std::string(", 1, ") +
|
||||||
|
std::to_string(detsize.y - 5) +
|
||||||
|
std::string("]]\n"));
|
||||||
|
}
|
||||||
|
|
||||||
// multiple ports vertically
|
// multiple ports vertically
|
||||||
if (((det_type == defs::JUNGFRAU || det_type == defs::MOENCH) &&
|
if (((det_type == defs::JUNGFRAU || det_type == defs::MOENCH) &&
|
||||||
@@ -738,7 +756,7 @@ TEST_CASE("rx_roi", "[.cmdcall]") {
|
|||||||
// check master file creation
|
// check master file creation
|
||||||
// TODO: check roi in master file
|
// TODO: check roi in master file
|
||||||
{
|
{
|
||||||
create_files_for_acquire(det, caller);
|
REQUIRE_NOTHROW(create_files_for_acquire(det, caller));
|
||||||
testFileInfo file_info;
|
testFileInfo file_info;
|
||||||
std::string master_file_prefix =
|
std::string master_file_prefix =
|
||||||
file_info.getMasterFileNamePrefix();
|
file_info.getMasterFileNamePrefix();
|
||||||
@@ -748,8 +766,10 @@ TEST_CASE("rx_roi", "[.cmdcall]") {
|
|||||||
#ifdef HDF5C
|
#ifdef HDF5C
|
||||||
fname = master_file_prefix + ".h5";
|
fname = master_file_prefix + ".h5";
|
||||||
REQUIRE(std::filesystem::exists(fname) == true);
|
REQUIRE(std::filesystem::exists(fname) == true);
|
||||||
fname = file_info.getVirtualFileName();
|
if (det.size() > 1 || numinterfaces > 1) {
|
||||||
REQUIRE(std::filesystem::exists(fname) == true);
|
fname = file_info.getVirtualFileName();
|
||||||
|
REQUIRE(std::filesystem::exists(fname) == true);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2565,6 +2565,12 @@ TEST_CASE("numinterfaces", "[.cmdcall]") {
|
|||||||
if (det_type == defs::JUNGFRAU || det_type == defs::MOENCH) {
|
if (det_type == defs::JUNGFRAU || det_type == defs::MOENCH) {
|
||||||
auto prev_val = det.getNumberofUDPInterfaces().tsquash(
|
auto prev_val = det.getNumberofUDPInterfaces().tsquash(
|
||||||
"inconsistent numinterfaces to test");
|
"inconsistent numinterfaces to test");
|
||||||
|
UdpDestination prev_udp_dest{};
|
||||||
|
IpAddr prev_src_ip2{};
|
||||||
|
if (prev_val == 2 && det_type != defs::EIGER) {
|
||||||
|
prev_udp_dest = det.getDestinationUDPList(0)[0];
|
||||||
|
prev_src_ip2 = det.getSourceUDPIP2()[0];
|
||||||
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
caller.call("numinterfaces", {"2"}, -1, PUT, oss);
|
caller.call("numinterfaces", {"2"}, -1, PUT, oss);
|
||||||
@@ -2580,6 +2586,10 @@ TEST_CASE("numinterfaces", "[.cmdcall]") {
|
|||||||
caller.call("numinterfaces", {}, -1, GET, oss);
|
caller.call("numinterfaces", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "numinterfaces 1\n");
|
REQUIRE(oss.str() == "numinterfaces 1\n");
|
||||||
}
|
}
|
||||||
|
if (prev_val == 2 && det_type != defs::EIGER) {
|
||||||
|
det.setDestinationUDPList({prev_udp_dest}, 0);
|
||||||
|
det.setSourceUDPIP2({prev_src_ip2}, {0});
|
||||||
|
}
|
||||||
det.setNumberofUDPInterfaces(prev_val);
|
det.setNumberofUDPInterfaces(prev_val);
|
||||||
} else if (det_type == defs::EIGER) {
|
} else if (det_type == defs::EIGER) {
|
||||||
REQUIRE_THROWS(caller.call("numinterfaces", {"1"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("numinterfaces", {"1"}, -1, PUT));
|
||||||
@@ -3272,9 +3282,12 @@ TEST_CASE("adcreg", "[.cmdcall]") {
|
|||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::JUNGFRAU || det_type == defs::MOENCH ||
|
if (det_type == defs::JUNGFRAU || det_type == defs::MOENCH ||
|
||||||
det_type == defs::CHIPTESTBOARD) {
|
det_type == defs::CHIPTESTBOARD) {
|
||||||
std::ostringstream oss;
|
if (det.isVirtualDetectorServer().tsquash(
|
||||||
caller.call("adcreg", {"0x8", "0x3"}, -1, PUT, oss);
|
"Inconsistent virtual detector server to test adcreg")) {
|
||||||
REQUIRE(oss.str() == "adcreg [0x8, 0x3]\n");
|
std::ostringstream oss;
|
||||||
|
caller.call("adcreg", {"0x8", "0x3"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "adcreg [0x8, 0x3]\n");
|
||||||
|
}
|
||||||
// This is a put only command
|
// This is a put only command
|
||||||
REQUIRE_THROWS(caller.call("adcreg", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("adcreg", {}, -1, GET));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
namespace sls {
|
namespace sls {
|
||||||
|
|
||||||
TEST_CASE("Default construction") {
|
TEST_CASE("Default construction") {
|
||||||
std::cout << "size of int:" << sizeof(int) << std::endl;
|
|
||||||
static_assert(sizeof(CtbConfig) ==
|
static_assert(sizeof(CtbConfig) ==
|
||||||
(2 * sizeof(int) + (18 + 32 + 64 + 5 + 8) * 20),
|
(2 * sizeof(int) + (18 + 32 + 64 + 5 + 8) * 20),
|
||||||
"Size of CtbConfig does not match ");
|
"Size of CtbConfig does not match ");
|
||||||
|
|||||||
@@ -66,12 +66,12 @@ struct UdpDestination {
|
|||||||
uint32_t entry{};
|
uint32_t entry{};
|
||||||
uint16_t port{};
|
uint16_t port{};
|
||||||
uint16_t port2{};
|
uint16_t port2{};
|
||||||
IpAddr ip;
|
IpAddr ip{};
|
||||||
IpAddr ip2;
|
IpAddr ip2{};
|
||||||
MacAddr mac;
|
MacAddr mac{};
|
||||||
MacAddr mac2;
|
MacAddr mac2{};
|
||||||
std::string str() const;
|
|
||||||
|
|
||||||
|
std::string str() const;
|
||||||
constexpr bool operator==(const UdpDestination &other) const {
|
constexpr bool operator==(const UdpDestination &other) const {
|
||||||
return ((entry == other.entry) && (port == other.port) &&
|
return ((entry == other.entry) && (port == other.port) &&
|
||||||
(port2 == other.port2) && (ip == other.ip) &&
|
(port2 == other.port2) && (ip == other.ip) &&
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
/** API versions */
|
/** API versions */
|
||||||
#define APILIB "0.0.0 0x250805"
|
#define APILIB "0.0.0 0x250805"
|
||||||
#define APIRECEIVER "0.0.0 0x250807"
|
#define APIRECEIVER "0.0.0 0x250807"
|
||||||
#define APICTB "0.0.0 0x250725"
|
#define APICTB "0.0.0 0x250829"
|
||||||
#define APIGOTTHARD2 "0.0.0 0x250725"
|
#define APIGOTTHARD2 "0.0.0 0x250829"
|
||||||
#define APIMOENCH "0.0.0 0x250725"
|
#define APIMOENCH "0.0.0 0x250829"
|
||||||
#define APIEIGER "0.0.0 0x250725"
|
#define APIEIGER "0.0.0 0x250829"
|
||||||
#define APIXILINXCTB "0.0.0 0x250725"
|
#define APIXILINXCTB "0.0.0 0x250829"
|
||||||
#define APIJUNGFRAU "0.0.0 0x250725"
|
#define APIJUNGFRAU "0.0.0 0x250829"
|
||||||
#define APIMYTHEN3 "0.0.0 0x250725"
|
#define APIMYTHEN3 "0.0.0 0x250829"
|
||||||
|
|||||||
Reference in New Issue
Block a user