added tests to check file size and frames caught with an acquire (virtual) for every detector

This commit is contained in:
2025-04-30 15:00:00 +02:00
parent adf0124ea3
commit f09879a46c
10 changed files with 667 additions and 173 deletions

View File

@ -17,6 +17,63 @@ namespace sls {
using test::GET;
using test::PUT;
TEST_CASE("gotthard2_acquire_check_file_size", "[.cmdcall]") {
Detector det;
Caller caller(&det);
auto det_type =
det.getDetectorType().tsquash("Inconsistent detector types to test");
if (det_type == defs::GOTTHARD2) {
// save previous state
testFileInfo prev_file_info = get_file_state(det);
testCommonDetAcquireInfo prev_det_config_info =
get_common_acquire_config_state(det);
// save previous specific det type config
auto burst_mode =
det.getBurstMode().tsquash("inconsistent burst mode to test");
auto number_of_bursts = det.getNumberOfBursts().tsquash(
"inconsistent number of bursts to test");
auto burst_period =
det.getBurstPeriod().tsquash("inconsistent burst period to test");
// defaults
int num_frames_to_acquire = 2;
testFileInfo test_file_info;
set_file_state(det, test_file_info);
testCommonDetAcquireInfo det_config;
det_config.num_frames_to_acquire = num_frames_to_acquire;
set_common_acquire_config_state(det, det_config);
// set default specific det type config
det.setBurstMode(defs::CONTINUOUS_EXTERNAL);
det.setNumberOfBursts(1);
det.setBurstPeriod(std::chrono::milliseconds{0});
// acquire
test_acquire_with_receiver(caller, std::chrono::seconds{2});
// check frames caught
test_frames_caught(det, num_frames_to_acquire);
// check file size (assuming local pc)
// num_channels * num_chips * bytes_per_pixel * num_frames
size_t expected_image_size = 128 * 10 * 2;
test_acquire_binary_file_size(test_file_info, num_frames_to_acquire,
expected_image_size);
// restore previous state
set_file_state(det, prev_file_info);
set_common_acquire_config_state(det, prev_det_config_info);
// restore previous specific det type config
det.setBurstMode(burst_mode);
det.setNumberOfBursts(number_of_bursts);
det.setBurstPeriod(burst_period);
}
}
// time specific measurements for gotthard2
TEST_CASE("timegotthard2", "[.cmdcall]") {
Detector det;