wip, at ctbexpectedstate
Run Simulator Tests on local RHEL9 / build (push) Failing after 56s
Build on RHEL9 docker image / build (push) Failing after 1m53s
Build on RHEL8 docker image / build (push) Failing after 2m5s
Run Simulator Tests on local RHEL8 / build (push) Failing after 2m29s

This commit is contained in:
2026-05-28 01:22:24 +02:00
parent 09245a2664
commit eff61ec624
3 changed files with 105 additions and 138 deletions
@@ -277,17 +277,15 @@ acq::Gotthard2ExpectedState build_gotthard2_specific_state(const Detector& det)
return e;
}
acq::CTBExpectedState build_ctb_specific_state(const Detector& det) {
acq::CTBExpectedState build_ctb_specific_state(const Detector& det, const acq::CTBState& ctb_state) {
acq::CTBExpectedState e;
e.exptime = get_exptime(det);
e.period = get_period(det);
auto detType = get_detector_type(det);
bool isAltera = (detType == defs::CHIPTESTBOARD);
e.ctb_acq_state = acq::get_ctb_state(det, isAltera);
e.ctb_acq_state = ctb_state;
return e;
}
acq::DetectorSpecificState build_detector_specific_state(const Detector& det) {
acq::DetectorSpecificState build_detector_specific_state(const Detector& det, const acq::CTBState& ctb_state) {
switch (det.getDetectorType().tsquash("bad type")) {
case defs::JUNGFRAU:
return build_jungfrau_specific_state(det);
@@ -301,7 +299,7 @@ acq::DetectorSpecificState build_detector_specific_state(const Detector& det) {
return build_gotthard2_specific_state(det);
case defs::CHIPTESTBOARD:
case defs::XILINX_CHIPTESTBOARD:
return build_ctb_specific_state(det);
return build_ctb_specific_state(det, ctb_state);
}
throw sls::RuntimeError("Unsupported detector type");
}
@@ -311,11 +309,12 @@ acq::DetectorSpecificState build_detector_specific_state(const Detector& det) {
namespace sls::test::acquire {
ExpectedState build_expected_state(const Detector& det) {
ExpectedState build_expected_state(const Detector& det, const AcquisitionState &acq_state, const FileState &file_state, const CTBState &ctb_state) {
ExpectedState e;
e.common_state = build_common_state(det);
e.file_state = get_file_state(det);
e.detector_specific_state = build_detector_specific_state(det);
e.file_state = file_state;
e.acquisition_state = acq_state;
e.detector_specific_state = build_detector_specific_state(det, ctb_state);
return e;
}
@@ -5,6 +5,7 @@
#include "CTBState.h"
#include "FileState.h"
#include "Acquire.h"
#include <variant>
@@ -54,7 +55,7 @@ struct EigerExpectedState {
ns sub_period{};
bool quad{};
int read_n_rows{};
std::vector<int> rate_corrections{};
std::vector<int64_t> rate_corrections{};
defs::speedLevel readout_speed{};
};
@@ -95,6 +96,7 @@ using DetectorSpecificState = std::variant<
struct ExpectedState {
FileState file_state{};
AcquisitionState acquisition_state{};
CommonExpectedState common_state{};
DetectorSpecificState detector_specific_state{};
};
@@ -104,6 +106,6 @@ const T& get_detector_specific_state(const ExpectedState& expected_state) {
return std::get<T>(expected_state.detector_specific_state);
}
ExpectedState build_expected_state(const Detector& det);
ExpectedState build_expected_state(const Detector& det, const AcquisitionState &acq_state = default_acquisition_state(), const FileState &file_state = default_file_state(), const CTBState &ctb_state = default_ctb_state());
} // namespace sls::test::acquire
@@ -115,130 +115,72 @@ void check_readout_speed(CheckerT &checker, const acq::ExpectedState& expected)
checker.template check<std::string>(MasterAttributes::N_READOUT_SPEED.data(), ToString(expected.detector_specific_state.readout_speed));
}
template <typename CheckerT>
void check_dynamic_range(CheckerT &checker, const acq::ExpectedState& expected) {
checker.template check<int>(MasterAttributes::N_DYNAMIC_RANGE.data(), expected.detector_specific_state.dynamic_range);
}
template <typename CheckerT>
void check_ten_giga(CheckerT &checker, const acq::ExpectedState& expected) {
checker.template check<int>(MasterAttributes::N_TEN_GIGA.data(), static_cast<int>(expected.detector_specific_state.ten_giga));
}
template <typename CheckerT>
void check_threshold_energy(CheckerT &checker, const acq::ExpectedState& expected) {
checker.template check<int>(MasterAttributes::N_THRESHOLD_ENERGY.data(), expected.detector_specific_state.threshold_energy);
}
template <typename CheckerT>
void check_sub_exptime(CheckerT &checker, const acq::ExpectedState& expected) {
checker.template check<std::string>(MasterAttributes::N_SUB_EXPOSURE_TIME.data(), ToString(expected.detector_specific_state.sub_exptime));
}
template <typename CheckerT>
void check_sub_period(CheckerT &checker, const acq::ExpectedState& expected) {
checker.template check<std::string>(MasterAttributes::N_SUB_ACQUISITION_PERIOD.data(), ToString(expected.detector_specific_state.sub_period));
}
template <typename CheckerT>
void check_quad(CheckerT &checker, const acq::ExpectedState& expected) {
checker.template check<int>(MasterAttributes::N_QUAD.data(), static_cast<int>(expected.detector_specific_state.quad));
}
template <typename CheckerT>
void check_rate_corrections(CheckerT &checker, const acq::ExpectedState& expected) {
checker.template check<std::vector<int64_t>>(MasterAttributes::N_RATE_CORRECTIONS.data(), expected.detector_specific_state.rate_corrections);
}
template <typename CheckerT>
void check_counter_mask(CheckerT &checker, const acq::ExpectedState& expected) {
checker.template check<int>(MasterAttributes::N_COUNTER_MASK.data(), expected.detector_specific_state.counter_mask);
}
template <typename CheckerT>
void check_exptime_array(CheckerT &checker, const acq::ExpectedState& expected) {
checker.template check<std::array<sls::ns, 3UL>>(MasterAttributes::N_EXPOSURE_TIMES.data(), expected.detector_specific_state.exp_times);
}
template <typename CheckerT>
void check_gate_delay_array(CheckerT &checker, const acq::ExpectedState& expected) {
checker.template check<std::array<sls::ns, 3UL>>(MasterAttributes::N_GATE_DELAYS.data(), expected.detector_specific_state.gate_delays);
}
template <typename CheckerT>
void check_gates(CheckerT &checker, const acq::ExpectedState& expected) {
checker.template check<int>(MasterAttributes::N_GATES.data(), expected.detector_specific_state.num_gates);
}
template <typename CheckerT>
void check_threshold_energies(CheckerT &checker, const acq::ExpectedState& expected) {
checker.template check<std::array<int, 3UL>>(MasterAttributes::N_THRESHOLD_ENERGIES.data(), expected.detector_specific_state.thresholdAllEnergyeV);
}
template <typename CheckerT>
void check_burst_mode(CheckerT &checker, const acq::ExpectedState& expected) {
checker.template check<std::string>(MasterAttributes::N_BURST_MODE.data(), ToString(expected.detector_specific_state.burst_mode));
}
/*
template <typename CheckerT>
void test_master_file_dynamic_range(const Detector &det, CheckerT &checker) {
auto dr = det.getDynamicRange().tsquash("Inconsistent dynamic range");
REQUIRE_NOTHROW(checker.template check<int>(
MasterAttributes::N_DYNAMIC_RANGE.data(), dr));
}
template <typename CheckerT>
void test_master_file_ten_giga(const Detector &det, CheckerT &checker) {
auto ten_giga =
static_cast<int>(det.getTenGiga().tsquash("Inconsistent ten giga"));
REQUIRE_NOTHROW(checker.template check<int>(
MasterAttributes::N_TEN_GIGA.data(), ten_giga));
}
template <typename CheckerT>
void test_master_file_threshold_energy(const Detector &det, CheckerT &checker) {
auto threshold =
det.getThresholdEnergy().tsquash("Inconsistent threshold energy");
REQUIRE_NOTHROW(checker.template check<int>(
MasterAttributes::N_THRESHOLD_ENERGY.data(), threshold));
}
template <typename CheckerT>
void test_master_file_sub_exptime(const Detector &det, CheckerT &checker) {
auto sub_exptime =
det.getSubExptime().tsquash("Inconsistent sub exposure time");
REQUIRE_NOTHROW(checker.template check<std::string>(
MasterAttributes::N_SUB_EXPOSURE_TIME.data(), ToString(sub_exptime)));
}
template <typename CheckerT>
void test_master_file_sub_period(const Detector &det, CheckerT &checker) {
auto exptime = det.getSubExptime().tsquash("Inconsistent sub exptime");
auto deadtime = det.getSubDeadTime().tsquash("Inconsistent sub deadtime");
auto sub_period = exptime + deadtime;
REQUIRE_NOTHROW(checker.template check<std::string>(
MasterAttributes::N_SUB_ACQUISITION_PERIOD.data(),
ToString(sub_period)));
}
template <typename CheckerT>
void test_master_file_quad(const Detector &det, CheckerT &checker) {
auto quad = static_cast<int>(det.getQuad().tsquash("Inconsistent quad"));
REQUIRE_NOTHROW(
checker.template check<int>(MasterAttributes::N_QUAD.data(), quad));
}
template <typename CheckerT>
void test_master_file_rate_corrections(const Detector &det, CheckerT &checker) {
std::vector<int64_t> dead_times;
for (auto item : det.getRateCorrection())
dead_times.push_back(item.count());
REQUIRE_NOTHROW(checker.template check<std::vector<int64_t>>(
MasterAttributes::N_RATE_CORRECTIONS.data(), dead_times));
}
template <typename CheckerT>
void test_master_file_counter_mask(const Detector &det, CheckerT &checker) {
auto counter_mask = static_cast<int>(
det.getCounterMask().tsquash("Inconsistent counter mask"));
REQUIRE_NOTHROW(checker.template check<int>(
MasterAttributes::N_COUNTER_MASK.data(), counter_mask));
}
template <typename CheckerT>
void test_master_file_exptimes(const Detector &det, CheckerT &checker) {
auto exptimes =
det.getExptimeForAllGates().tsquash("Inconsistent exposure times");
REQUIRE_NOTHROW(checker.template check<std::array<sls::ns, 3UL>>(
MasterAttributes::N_EXPOSURE_TIMES.data(), exptimes));
}
template <typename CheckerT>
void test_master_file_gate_delays(const Detector &det, CheckerT &checker) {
auto gate_delays =
det.getGateDelayForAllGates().tsquash("Inconsistent GateDelay");
REQUIRE_NOTHROW(checker.template check<std::array<sls::ns, 3UL>>(
MasterAttributes::N_GATE_DELAYS.data(), gate_delays));
}
template <typename CheckerT>
void test_master_file_gates(const Detector &det, CheckerT &checker) {
auto gates = det.getNumberOfGates().tsquash("Inconsistent number of gates");
REQUIRE_NOTHROW(
checker.template check<int>(MasterAttributes::N_GATES.data(), gates));
}
template <typename CheckerT>
void test_master_file_threadhold_energies(const Detector &det,
CheckerT &checker) {
auto threshold_energies =
det.getAllThresholdEnergy().tsquash("Inconsistent threshold energies");
REQUIRE_NOTHROW(checker.template check<std::array<int, 3UL>>(
MasterAttributes::N_THRESHOLD_ENERGIES.data(), threshold_energies));
}
template <typename CheckerT>
void test_master_file_burst_mode(const Detector &det, CheckerT &checker) {
auto burst_mode = det.getBurstMode().tsquash("Inconsistent burst mode");
REQUIRE_NOTHROW(checker.template check<std::string>(
MasterAttributes::N_BURST_MODE.data(), ToString(burst_mode)));
}
template <typename CheckerT>
void test_master_file_adc_mask(const Detector &det, CheckerT &checker) {
acq::CTBState test_ctb_config = acq::default_ctb_state();
@@ -854,19 +796,43 @@ void check_moench_metadata(CheckerT &checker, const acq::ExpectedState& expected
template <typename CheckerT>
void check_eiger_metadata(CheckerT &checker, const acq::ExpectedState& expected) {
check_rois(checker, expected);
check_dynamic_range(checker, expected);
check_ten_giga(checker, expected);
check_exptime(checker, expected);
check_period(checker, expected);
check_threshold_energy(checker, expected);
check_sub_exptime(checker, expected);
check_sub_period(checker, expected);
check_quad(checker, expected);
check_read_n_rows(checker, expected);
check_rate_corrections(checker, expected);
check_readout_speed(checker, expected);
}
template <typename CheckerT>
void check_mythen3_metadata(CheckerT &checker, const acq::ExpectedState& expected);
void check_mythen3_metadata(CheckerT &checker, const acq::ExpectedState& expected) {
check_rois(checker, expected);
check_dynamic_range(checker, expected);
check_ten_giga(checker, expected);
check_period(checker, expected);
check_counter_mask(checker, expected);
check_exptime_array(checker, expected);
check_gate_delay_array(checker, expected);
check_gates(checker, expected);
check_threshold_energies(checker, expected);
check_readout_speed(checker, expected);
}
template <typename CheckerT>
void check_gotthard2_metadata(CheckerT &checker, const acq::ExpectedState& expected);
void check_gotthard2_metadata(CheckerT &checker, const acq::ExpectedState& expected) {
check_rois(checker, expected);
check_exptime(checker, expected);
check_period(checker, expected);
check_burst_mode(checker, expected);
check_readout_speed(checker, expected);
}
template <typename CheckerT>
void check_ctb_metadata(CheckerT &checker, const acq::ExpectedState& expected);
template <typename CheckerT>
void check_det_type(CheckerT &checker, const acq::ExpectedState& expected);
}