From bb4f64a01018f3a9bdffdfedcf99e2c162212716 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Tue, 10 Nov 2026 08:39:03 +0100 Subject: [PATCH] Test: a cancel during the live stills pre-pass hold ends the collection On the simulated device, a 900-image live stills collection with a cell is cancelled while its frames are held for the pre-pass; the collection has to stop. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01HVeDQsU5a8AJUdJPgWevAK --- tests/JFJochReceiverProcessingTest.cpp | 33 ++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tests/JFJochReceiverProcessingTest.cpp b/tests/JFJochReceiverProcessingTest.cpp index e9ed9b7e3..952da8ba8 100644 --- a/tests/JFJochReceiverProcessingTest.cpp +++ b/tests/JFJochReceiverProcessingTest.cpp @@ -253,6 +253,39 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_GPUStills_writer_down", "[JFJochReceiver]") REQUIRE_NOTHROW(writer_future.get()); } +TEST_CASE("JFJochIntegrationTest_GPUStills_cancel_during_prepass", "[JFJochReceiver]") { + // A cancel while the frames are held for the pre-pass ends the collection. + Logger logger(Catch::getResultCapture().getCurrentTestName()); + + DiffractionExperiment experiment(DetJF4M()); + experiment.ImagesPerTrigger(900).NumTriggers(1).UseInternalPacketGenerator(true) + .FilePrefix("gpu_stills_cancel").JungfrauConvPhotonCnt(false) + .DetectorDistance_mm(75).BeamY_pxl(1136).BeamX_pxl(1090).IncidentEnergy_keV(12.4) + .SetUnitCell(UnitCell{.a = 36.9, .b = 78.95, .c = 78.95, .alpha =90, .beta = 90, .gamma = 90}); + + PixelMask pixel_mask(experiment); + + AcquisitionDeviceGroup aq_devices; + aq_devices.Add(std::make_unique(0, 64)); + + NonePusher pusher; + JFJochReceiverService service(aq_devices, logger, pusher); + service.NumThreads(4); + service.Indexing(experiment.GetIndexingSettings()); + service.RugnuxLive(true, nullptr, 4, 60); + + service.Start(experiment, pixel_mask, nullptr); + std::this_thread::sleep_for(std::chrono::seconds(10)); + const auto t0 = std::chrono::steady_clock::now(); + service.Cancel(false); + try { + service.Stop(); + } catch (const JFJochException &) {} + const double stop_s = std::chrono::duration(std::chrono::steady_clock::now() - t0).count(); + logger.Info("Stopped {:.1f} s after the cancel", stop_s); + CHECK(stop_s < 120.0); +} + TEST_CASE("JFJochIntegrationTest_ZMQ_crystal_spot_and_index_refinement", "[JFJochReceiver]") { Logger logger(Catch::getResultCapture().getCurrentTestName());