Dev/fix actual tests (#1285)
Some checks failed
Build on RHEL9 / build (push) Failing after 3m50s
Build on RHEL8 / build (push) Failing after 5m8s

- 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:
2025-09-04 10:44:32 +02:00
committed by GitHub
parent 5b069d85a8
commit 6e3acbdf79
17 changed files with 84 additions and 26 deletions

View File

@@ -201,6 +201,15 @@ Enabling the GUI automatically streams images from the receiver via ZMQ sockets.
* Default: Receivers 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).

View File

@@ -36,6 +36,10 @@ set_target_properties(jungfrauDetectorServer_virtual PROPERTIES
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
EXPORT "${TARGETS_EXPORT_NAME}"
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}

View File

@@ -5342,7 +5342,8 @@ int set_dest_udp_mac(int file_des) {
if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0)
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
if (Server_VerifyLock() == OK) {
@@ -5363,7 +5364,8 @@ int get_dest_udp_mac(int file_des) {
LOG(logDEBUG1, ("Getting udp destination mac\n"));
// get only
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));
}
@@ -9190,7 +9192,7 @@ int get_dest_udp_list(int file_des) {
memset(mess, 0, sizeof(mess));
uint32_t arg = 0;
uint16_t retvals16[2] = {};
uint32_t retvals32[3] = {};
uint32_t retvals32[2] = {};
uint64_t retvals64[2] = {};
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)

View File

@@ -171,7 +171,7 @@ void create_files_for_acquire(
}
// 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(
"Inconsistent number of frames caught")[0];
REQUIRE(frames_caught == num_frames);

View File

@@ -29,6 +29,17 @@ struct testFileInfo {
return file_path + "/" + file_prefix + "_virtual_" +
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 {

View File

@@ -479,6 +479,8 @@ TEST_CASE("rx_roi", "[.cmdcall]") {
defs::xy detsize = det.getDetectorSize();
auto portSize = det.getPortSize()[0];
int delta = 50;
int numinterfaces = det.getNumberofUDPInterfaces().tsquash(
"inconsistent number of interfaces");
// 1d
if (det_type == defs::GOTTHARD2 || det_type == defs::MYTHEN3) {
@@ -554,6 +556,12 @@ TEST_CASE("rx_roi", "[.cmdcall]") {
"]]\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
else {
@@ -613,9 +621,6 @@ TEST_CASE("rx_roi", "[.cmdcall]") {
REQUIRE_THROWS(caller.call(
"rx_roi", {"[0, 10, 0, 10] [0, 10, 9, 11]"}, -1, PUT));
int numinterfaces = det.getNumberofUDPInterfaces().tsquash(
"inconsistent number of interfaces");
// multiple ports horizontally
if (det_type == defs::EIGER ||
(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
if (((det_type == defs::JUNGFRAU || det_type == defs::MOENCH) &&
@@ -738,7 +756,7 @@ TEST_CASE("rx_roi", "[.cmdcall]") {
// check master file creation
// TODO: check roi in master file
{
create_files_for_acquire(det, caller);
REQUIRE_NOTHROW(create_files_for_acquire(det, caller));
testFileInfo file_info;
std::string master_file_prefix =
file_info.getMasterFileNamePrefix();
@@ -748,8 +766,10 @@ TEST_CASE("rx_roi", "[.cmdcall]") {
#ifdef HDF5C
fname = master_file_prefix + ".h5";
REQUIRE(std::filesystem::exists(fname) == true);
fname = file_info.getVirtualFileName();
REQUIRE(std::filesystem::exists(fname) == true);
if (det.size() > 1 || numinterfaces > 1) {
fname = file_info.getVirtualFileName();
REQUIRE(std::filesystem::exists(fname) == true);
}
#endif
}

View File

@@ -2565,6 +2565,12 @@ TEST_CASE("numinterfaces", "[.cmdcall]") {
if (det_type == defs::JUNGFRAU || det_type == defs::MOENCH) {
auto prev_val = det.getNumberofUDPInterfaces().tsquash(
"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;
caller.call("numinterfaces", {"2"}, -1, PUT, oss);
@@ -2580,6 +2586,10 @@ TEST_CASE("numinterfaces", "[.cmdcall]") {
caller.call("numinterfaces", {}, -1, GET, oss);
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);
} else if (det_type == defs::EIGER) {
REQUIRE_THROWS(caller.call("numinterfaces", {"1"}, -1, PUT));
@@ -3272,9 +3282,12 @@ TEST_CASE("adcreg", "[.cmdcall]") {
auto det_type = det.getDetectorType().squash();
if (det_type == defs::JUNGFRAU || det_type == defs::MOENCH ||
det_type == defs::CHIPTESTBOARD) {
std::ostringstream oss;
caller.call("adcreg", {"0x8", "0x3"}, -1, PUT, oss);
REQUIRE(oss.str() == "adcreg [0x8, 0x3]\n");
if (det.isVirtualDetectorServer().tsquash(
"Inconsistent virtual detector server to test adcreg")) {
std::ostringstream oss;
caller.call("adcreg", {"0x8", "0x3"}, -1, PUT, oss);
REQUIRE(oss.str() == "adcreg [0x8, 0x3]\n");
}
// This is a put only command
REQUIRE_THROWS(caller.call("adcreg", {}, -1, GET));
} else {

View File

@@ -10,7 +10,6 @@
namespace sls {
TEST_CASE("Default construction") {
std::cout << "size of int:" << sizeof(int) << std::endl;
static_assert(sizeof(CtbConfig) ==
(2 * sizeof(int) + (18 + 32 + 64 + 5 + 8) * 20),
"Size of CtbConfig does not match ");

View File

@@ -66,12 +66,12 @@ struct UdpDestination {
uint32_t entry{};
uint16_t port{};
uint16_t port2{};
IpAddr ip;
IpAddr ip2;
MacAddr mac;
MacAddr mac2;
std::string str() const;
IpAddr ip{};
IpAddr ip2{};
MacAddr mac{};
MacAddr mac2{};
std::string str() const;
constexpr bool operator==(const UdpDestination &other) const {
return ((entry == other.entry) && (port == other.port) &&
(port2 == other.port2) && (ip == other.ip) &&

View File

@@ -3,10 +3,10 @@
/** API versions */
#define APILIB "0.0.0 0x250805"
#define APIRECEIVER "0.0.0 0x250807"
#define APICTB "0.0.0 0x250725"
#define APIGOTTHARD2 "0.0.0 0x250725"
#define APIMOENCH "0.0.0 0x250725"
#define APIEIGER "0.0.0 0x250725"
#define APIXILINXCTB "0.0.0 0x250725"
#define APIJUNGFRAU "0.0.0 0x250725"
#define APIMYTHEN3 "0.0.0 0x250725"
#define APICTB "0.0.0 0x250829"
#define APIGOTTHARD2 "0.0.0 0x250829"
#define APIMOENCH "0.0.0 0x250829"
#define APIEIGER "0.0.0 0x250829"
#define APIXILINXCTB "0.0.0 0x250829"
#define APIJUNGFRAU "0.0.0 0x250829"
#define APIMYTHEN3 "0.0.0 0x250829"