From 2ad7d78891bf4ab9e6184839f72ace2e3b5feb31 Mon Sep 17 00:00:00 2001
From: Florian Uhlig <f.uhlig@gsi.de>
Date: Tue, 7 Feb 2023 13:32:28 +0100
Subject: [PATCH] Run the pwg common test in nightly or weekly test

In the nightly test suite run for 2 events, in the weekly tests for 50 events.
The test time is calculated according to the number of events.
---
 macro/CMakeLists.txt                       |  4 +---
 macro/PWG/common/production/CMakeLists.txt | 10 ++++++++--
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/macro/CMakeLists.txt b/macro/CMakeLists.txt
index 7dc5a22d58..7896b53ef7 100644
--- a/macro/CMakeLists.txt
+++ b/macro/CMakeLists.txt
@@ -11,15 +11,13 @@ If(NOT ${CBM_TEST_MODEL} MATCHES Experimental)
   add_subdirectory(field)
   add_subdirectory(C2F)
   add_subdirectory(dimuon)
+  add_subdirectory(PWG)
   Message("Additional Nightly tests")
 EndIf()
 
-  add_subdirectory(PWG)
-
 #--- Additional tests for weekly builds
 If(${CBM_TEST_MODEL} MATCHES Weekly)
   add_subdirectory(KF)
-  add_subdirectory(PWG)
   Message("Additional long running Weekly tests")
 EndIf()
 
diff --git a/macro/PWG/common/production/CMakeLists.txt b/macro/PWG/common/production/CMakeLists.txt
index 8fd67b7d7c..1d8e6396e9 100644
--- a/macro/PWG/common/production/CMakeLists.txt
+++ b/macro/PWG/common/production/CMakeLists.txt
@@ -3,7 +3,13 @@
 find_package(Python)
 
 if (Python_FOUND)
-  set(production_macro_events 2)
+  # Define the number of events to run
+  if(LARGE_TEST_STATISTIC OR ${CBM_TEST_MODEL} MATCHES Weekly)
+    Set(production_macro_events 50)
+  else()
+    Set(production_macro_events 2)
+  endif()
+  math(EXPR timeOutTime "300 + (${production_macro_events} * 20)")
 
   GENERATE_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/PWG/common/production/run_json.sh)
 
@@ -18,5 +24,5 @@ if (Python_FOUND)
   Set(testname PWG_common_production_run_json)
 
   Add_Test(${testname} ${CMAKE_CURRENT_BINARY_DIR}/run_json.sh ${CMAKE_CURRENT_BINARY_DIR}/config_ci.json)
-  Set_Tests_Properties(${testname} PROPERTIES TIMEOUT 600)
+  Set_Tests_Properties(${testname} PROPERTIES TIMEOUT ${timeOutTime})
 endif()
-- 
GitLab