mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-02-10 09:38:40 +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:
@@ -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);
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 ");
|
||||
|
||||
Reference in New Issue
Block a user