From 6c604e234076abe93513aa4eac3a38f9f9905f38 Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Sat, 3 May 2025 00:11:55 +0200 Subject: [PATCH] small fixes, but bug introduced here 'https://github.com/slsdetectorgroup/slsDetectorPackage/pull/968/commits/40895b01488662184710f8362c30b20a7828da7b' --- slsReceiverSoftware/src/FrameSynchronizerApp.cpp | 9 +++++---- tests/scripts/test_frame_synchronizer.py | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/slsReceiverSoftware/src/FrameSynchronizerApp.cpp b/slsReceiverSoftware/src/FrameSynchronizerApp.cpp index 3d793e46f..96275e1a7 100644 --- a/slsReceiverSoftware/src/FrameSynchronizerApp.cpp +++ b/slsReceiverSoftware/src/FrameSynchronizerApp.cpp @@ -130,7 +130,7 @@ std::set get_valid_fnums(const PortFrameMap &port_frame_map) { // collect all unique frame numbers from all ports std::set unique_fnums; - for (auto it = port_frame_map.begin(); it != port_frame_map.begin(); ++it) { + for (auto it = port_frame_map.begin(); it != port_frame_map.end(); ++it) { const FrameMap &frame_map = it->second; for (auto frame = frame_map.begin(); frame != frame_map.end(); ++frame) { @@ -151,9 +151,10 @@ std::set get_valid_fnums(const PortFrameMap &port_frame_map) { LOG(sls::logDEBUG) << "Fnum " << fnum << " is missing in port " << port; // invalid: fnum greater than all in that port - auto last_frame = std::prev(frame_map.end()); - auto last_fnum = last_frame->first; - if (fnum > last_fnum) { + auto last_frame = + frame_map.upper_bound(fnum); // std::prev(frame_map.end()); + // auto last_fnum = last_frame->first; + if (last_frame == frame_map.end()) { //(fnum > last_fnum) { LOG(sls::logDEBUG) << "And no larger fnum found. Fnum " << fnum << " is invalid.\n"; is_valid = false; diff --git a/tests/scripts/test_frame_synchronizer.py b/tests/scripts/test_frame_synchronizer.py index 2d88b6fcb..f901672cf 100644 --- a/tests/scripts/test_frame_synchronizer.py +++ b/tests/scripts/test_frame_synchronizer.py @@ -234,6 +234,7 @@ with open(fname, 'w') as fp: traceback.print_exc(file=fp_error) # This will log the full traceback testError = True + cleanup(fp) break # redirect to terminal @@ -248,5 +249,5 @@ with open(fname, 'w') as fp: sys.stdout = original_stdout sys.stderr = original_stderr Log(Fore.RED, f'Exception caught with general testing. Cleaning up...') - cleanSharedmemory(sys.stdout) + cleanup(fp) \ No newline at end of file