mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-11-10 11:13:52 +01:00
dev/fix receiver num 2 interfaces fwrite (#1567)
Build on RHEL8 docker image / build (push) Successful in 5m41s
Build on RHEL9 docker image / build (push) Successful in 5m57s
Build and Deploy on local RHEL9 / build (push) Successful in 2m0s
Build and Deploy on local RHEL8 / build (push) Successful in 5m10s
Run Simulator Tests on local RHEL9 / build (push) Successful in 20m41s
Run Simulator Tests on local RHEL8 / build (push) Successful in 24m2s
Build on RHEL8 docker image / build (push) Successful in 5m41s
Build on RHEL9 docker image / build (push) Successful in 5m57s
Build and Deploy on local RHEL9 / build (push) Successful in 2m0s
Build and Deploy on local RHEL8 / build (push) Successful in 5m10s
Run Simulator Tests on local RHEL9 / build (push) Successful in 20m41s
Run Simulator Tests on local RHEL8 / build (push) Successful in 24m2s
* when changing num interfaces, also setting up file writer if file write was enabled. added tests inside numinterface (from 2 to 1) to take an acquisition and check if the file exists * separate the tests that need files for github
This commit is contained in:
1 parent
ea0fa0d992
commit
fa10e465cb
2 files changed
+53
-2
No files matched your search
@@ -2620,7 +2620,7 @@ TEST_CASE("numinterfaces", "[.detectorintegration]") {
|
||||
"inconsistent numinterfaces to test");
|
||||
Result<UdpDestination> prev_udp_dest;
|
||||
IpAddr prev_src_ip2{};
|
||||
if (prev_val == 2 && det_type != defs::EIGER) {
|
||||
if (prev_val == 2) {
|
||||
prev_udp_dest = det.getDestinationUDPList(0);
|
||||
prev_src_ip2 = det.getSourceUDPIP2()[0];
|
||||
}
|
||||
@@ -2639,7 +2639,7 @@ TEST_CASE("numinterfaces", "[.detectorintegration]") {
|
||||
caller.call("numinterfaces", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "numinterfaces 1\n");
|
||||
}
|
||||
if (prev_val == 2 && det_type != defs::EIGER) {
|
||||
if (prev_val == 2) {
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setDestinationUDPList({prev_udp_dest[i]}, {i});
|
||||
}
|
||||
@@ -2663,6 +2663,50 @@ TEST_CASE("numinterfaces", "[.detectorintegration]") {
|
||||
REQUIRE_THROWS(caller.call("numinterfaces", {"0"}, -1, PUT));
|
||||
}
|
||||
|
||||
TEST_CASE("numinterfaces_with_fwrite",
|
||||
"[.detectorintegration][.disable_check_data_file]") {
|
||||
Detector det;
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::JUNGFRAU || det_type == defs::MOENCH) {
|
||||
|
||||
// previous state
|
||||
auto prev_val = det.getNumberofUDPInterfaces().tsquash(
|
||||
"inconsistent numinterfaces to test");
|
||||
Result<UdpDestination> prev_udp_dest;
|
||||
IpAddr prev_src_ip2{};
|
||||
if (prev_val == 2) {
|
||||
prev_udp_dest = det.getDestinationUDPList(0);
|
||||
prev_src_ip2 = det.getSourceUDPIP2()[0];
|
||||
}
|
||||
auto prev_fwrite =
|
||||
det.getFileWrite().tsquash("inconsistent file write state");
|
||||
|
||||
// testing file write before and after num interface change
|
||||
det.setNumberofUDPInterfaces(2);
|
||||
det.setFileWrite(true);
|
||||
det.setNumberofUDPInterfaces(1);
|
||||
REQUIRE(det.getFileWrite().tsquash("inconsistent file write state") ==
|
||||
true);
|
||||
// check if file write actually works
|
||||
auto acq_state = acq::default_acquisition_state();
|
||||
auto file_state = acq::default_file_state();
|
||||
file_state.file_format = defs::BINARY;
|
||||
acq::run(det, acq_state, file_state);
|
||||
std::string fname = acq::get_master_file_name(file_state);
|
||||
REQUIRE(std::filesystem::exists(fname));
|
||||
|
||||
// restore previous state
|
||||
det.setFileWrite(prev_fwrite);
|
||||
if (prev_val == 2) {
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setDestinationUDPList({prev_udp_dest[i]}, {i});
|
||||
}
|
||||
det.setSourceUDPIP2({prev_src_ip2});
|
||||
}
|
||||
det.setNumberofUDPInterfaces(prev_val);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("udp_srcip", "[.detectorintegration]") {
|
||||
Detector det;
|
||||
Caller caller(&det);
|
||||
|
||||
@@ -1164,6 +1164,13 @@ void Implementation::setNumberofUDPInterfaces(const int n) {
|
||||
|
||||
// test socket buffer size with current set up
|
||||
setUDPSocketBufferSize(0);
|
||||
|
||||
// set up file write if enabled
|
||||
if (fileWriteEnable) {
|
||||
for (const auto &it : dataProcessor)
|
||||
it->SetupFileWriter(fileWriteEnable, fileFormatType,
|
||||
&hdf5LibMutex);
|
||||
}
|
||||
}
|
||||
|
||||
LOG(logINFO) << "Number of Interfaces: " << generalData->numUDPInterfaces;
|
||||
|
||||
Reference in new issue
Block a user