Files
slsDetectorPackage/slsDetectorSoftware/tests/acquire/Acquire.cpp
T
maliakal_d 2e4cd258a8
Build on RHEL9 docker image / build (push) Successful in 4m1s
Build on RHEL8 docker image / build (push) Successful in 5m1s
Build and Deploy on local RHEL9 / build (push) Successful in 2m1s
Build and Deploy on local RHEL8 / build (push) Successful in 5m7s
Run Simulator Tests on local RHEL9 / build (push) Successful in 18m37s
Run Simulator Tests on local RHEL8 / build (push) Successful in 22m10s
Dev/refactor caller tests master attributes (#1462)
* refactoring

* wip

* refactored, yet to take out checkers

* checker added

* wip acquire ctb state

* wip acquire ctb state

* wip, acq test

* acquire moved out

* fix

* wip, To fix masterattribtues

* wip, masterfilecheks

* wip, at ctbexpectedstate

* wip, fixing acquire

* wip, acquire done

* wip

* compiles

* refactoring

* minor

* minor

* reduced unnecessary includes

* fix in tests

* removed ctb state check

* ctb fix with ctb state

* fixed ctb guard tests

* minor debug

* work for xilinx ctb

---------

Co-authored-by: Erik Fröjdh <erik.frojdh@gmail.com>
2026-06-10 17:30:30 +02:00

47 lines
1.3 KiB
C++

// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "Acquire.h"
#include "FileState.h"
#include "catch.hpp"
#include <chrono>
#include <thread>
namespace sls::test::acquire {
void wait_until_idle(const Detector &det) {
bool idle = false;
while (!idle) {
auto statusList = det.getDetectorStatus();
if (statusList.any(defs::ERROR)) {
throw RuntimeError("error status during acquisition");
}
if (statusList.contains_only(defs::IDLE, defs::STOPPED)) {
idle = true;
}
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
}
void run_acquisition(Detector &det) {
det.startReceiver();
det.startDetector();
wait_until_idle(det);
det.stopReceiver();
}
void run(Detector &det, const AcquisitionState &acq_state,
const FileState &file_state) {
INFO(ToString(det.getDetectorType().squash(defs::GENERIC))
<< " acquiring with num_frames = " << acq_state.num_frames);
FileStateGuard file_guard(det, file_state);
AcquisitionStateGuard acq_guard(det, acq_state);
run_acquisition(det);
auto frames_caught = det.getFramesCaught()[0][0];
REQUIRE(frames_caught == acq_state.num_frames);
}
} // namespace sls::test::acquire