From 895c105feb2301d45ebee54b56692fd51e108b15 Mon Sep 17 00:00:00 2001
From: P-A Loizeau <p.-a.loizeau@gsi.de>
Date: Wed, 18 Dec 2024 15:02:40 +0100
Subject: [PATCH] Fix parameters usage for Online Bin tests: nb ts and nb
 threads

---
 algo/test/CMakeLists.txt   | 5 ++++-
 algo/test/realdata_test.sh | 7 +++++--
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/algo/test/CMakeLists.txt b/algo/test/CMakeLists.txt
index ae3ec027db..b9233c8cc1 100644
--- a/algo/test/CMakeLists.txt
+++ b/algo/test/CMakeLists.txt
@@ -39,19 +39,22 @@ if (DEFINED ENV{RAW_DATA_PATH})
   if(${CBM_TEST_MODEL} MATCHES MergeRequest OR ${CBM_TEST_MODEL} MATCHES Continuous )
     Message( STATUS "MR or Continuous model detected, decreasing TS nb for OnlineReco tests to single one." )
     SET( RECO_TS_NB 1)
+    SET( RECO_THREADS_NB 1)
     SET( ONLINE_RECO_TO 100) # MR mode on run4: 45-50s for 2391
   elseif(${CBM_TEST_MODEL} MATCHES Weekly OR ${CBM_TEST_MODEL} MATCHES Profile )
     Message( STATUS "Profiling model detected, increasing timeout and TS nb for OnlineReco tests with coverage." )
     SET( RECO_TS_NB 20)
+    SET( RECO_THREADS_NB 1)  # FIXME: check if more should be allowed for weekly (esp on Virgo), need then exclusivity
     SET( ONLINE_RECO_TO 1600) # Coverage mode for run 2391: ???? on run4, ???? on virgo3
   else()
     SET( RECO_TS_NB 3)
+    SET( RECO_THREADS_NB 1)
     SET( ONLINE_RECO_TO  800) # Nightly mode on run4: ??? for 2391
   endif()
 
   Add_Test(
     NAME OnlineRecoCanProcessTimeslice
-    COMMAND ${TEST_SCRIPT} ${RECO_BIN} ${PARAMS_DIR} ${TSA_FILE} ${RECO_TS_NB}
+    COMMAND ${TEST_SCRIPT} ${RECO_BIN} ${PARAMS_DIR} ${TSA_FILE} ${RECO_TS_NB} ${RECO_THREADS_NB}
   )
 
   set_tests_properties(OnlineRecoCanProcessTimeslice PROPERTIES
diff --git a/algo/test/realdata_test.sh b/algo/test/realdata_test.sh
index 440f293b95..de0408fe06 100755
--- a/algo/test/realdata_test.sh
+++ b/algo/test/realdata_test.sh
@@ -3,11 +3,14 @@
 cbmreco_bin=$1
 parameter_dir=$2
 tsa_file=$3
+nb_ts=${4:-1}
+nb_threads=${5:-1}
 
 reco_args=" \
     -p $parameter_dir \
     -i $tsa_file \
-    -n1 \
+    -n $nb_ts \
+    --omp $nb_threads \
     --steps Unpack DigiTrigger LocalReco Tracking \
 "
 
@@ -15,7 +18,7 @@ script=$(readlink -f "$0")
 function check_arg {
   if [ -z "$1" ]; then
     echo "Error: <$2> not specified."
-    echo "Usage: $script <cbmreco_bin> <parameter_dir> <tsa_file>"
+    echo "Usage: $script <cbmreco_bin> <parameter_dir> <tsa_file> [<nb_ts>(=1) <nb_threads>(=1)]"
     exit 1
   fi
 }
-- 
GitLab