From 72bf1fa2571d451748c953dea02b5a88d346d5aa Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Sun, 29 Jun 2025 17:09:30 +0200 Subject: [PATCH] check master file creation as well in rx_roi tests --- .../tests/Caller/test-Caller-rx.cpp | 41 +++++++++++++++++++ tests/scripts/test_roi.py | 10 +++-- 2 files changed, 47 insertions(+), 4 deletions(-) diff --git a/slsDetectorSoftware/tests/Caller/test-Caller-rx.cpp b/slsDetectorSoftware/tests/Caller/test-Caller-rx.cpp index 2b7fbec98..f89428553 100644 --- a/slsDetectorSoftware/tests/Caller/test-Caller-rx.cpp +++ b/slsDetectorSoftware/tests/Caller/test-Caller-rx.cpp @@ -8,6 +8,7 @@ #include "test-Caller-global.h" #include +#include #include "sls/versionAPI.h" #include "tests/globals.h" @@ -686,6 +687,46 @@ TEST_CASE("rx_roi", "[.cmdcall]") { } } + // check master file creation + // TODO: check roi in master file + { + auto prev_write = det.getFileWrite().tsquash( + "inconsistent file write values in test"); + auto prev_path = det.getFilePath().tsquash( + "inconsistent file path values in test"); + auto prev_format = det.getFileFormat().tsquash( + "inconsistent file format values in test"); + auto prev_index = det.getAcquisitionIndex().tsquash( + "inconsistent file index values in test"); + auto prev_fname = det.getFileNamePrefix().tsquash( + "inconsistent file name prefix values in test"); + + det.setFileWrite(true); + det.setFilePath("/tmp"); + det.setFileNamePrefix("test"); + + det.setAcquisitionIndex(0); + det.setFileFormat(defs::BINARY); + REQUIRE_NOTHROW(caller.call("acquire", {}, -1, PUT)); + std::string file_path = "/tmp/test_master_0.json"; + REQUIRE(std::filesystem::exists(file_path) == true); + + det.setAcquisitionIndex(0); + det.setFileFormat(defs::HDF5); + REQUIRE_NOTHROW(caller.call("acquire", {}, -1, PUT)); + file_path = "/tmp/test_master_0.h5"; + REQUIRE(std::filesystem::exists(file_path) == true); + file_path = "/tmp/test_virtual_0.h5"; + REQUIRE(std::filesystem::exists(file_path) == true); + + det.setFileWrite(prev_write); + if (!prev_path.empty()) + det.setFilePath(prev_path); + det.setFileFormat(prev_format); + det.setAcquisitionIndex(prev_index); + det.setFileNamePrefix(prev_fname); + } + for (int i = 0; i != det.size(); ++i) { det.setRxROI(prev_val); } diff --git a/tests/scripts/test_roi.py b/tests/scripts/test_roi.py index 07565b591..2f56f31b1 100644 --- a/tests/scripts/test_roi.py +++ b/tests/scripts/test_roi.py @@ -56,12 +56,14 @@ def loadConfigForRoi(name, fp, num_mods = 1, num_interfaces = 1): d.udp_srcip = 'auto' if name == 'jungfrau' or name == 'moench': d.udp_dstip2 = 'auto' + d.powerchip = 1 + + d.frames = 5 except Exception as e: raise RuntimeException(f'Could not load config for {name}. Error: {str(e)}') from e - - - + + return d def startTestsForAll(fp): servers = [ @@ -85,7 +87,7 @@ def startTestsForAll(fp): cleanup(fp) startDetectorVirtualServer(server, nmods, fp) startReceiver(nmods, fp) - loadConfigForRoi(name=server, fp=fp, num_mods=nmods, num_interfaces=ninterfaces) + d = loadConfigForRoi(name=server, fp=fp, num_mods=nmods, num_interfaces=ninterfaces) fname = ROI_TEST_FNAME + server + '.txt' cmd = ['tests', 'rx_roi', '--abort', '-s']