Skip to content

Commit b3d66e3

Browse files
committed
Custom number of events in generator test
1 parent cf337d1 commit b3d66e3

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

test/run_generator_tests.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,16 @@ get_test_script_path_for_ini()
7676
echo ${path_to_test_script}
7777
}
7878

79+
get_nevents_from_ini()
80+
{
81+
# function to force the number of events to be simulated from the ini file (default = 100)
82+
# Syntax: #NEV> 10 (space between #NEV> and the number is mandatory)
83+
# To be used only if external generator takes too long to run causing timeouts in CI
84+
local ini_path=${1}
85+
local nev=$(grep "#NEV>" ${ini_path} | tail -n 1 | awk '{print $2}' | tr -d ' ')
86+
[[ "${nev}" == "" ]] && nev=100
87+
echo ${nev}
88+
}
7989

8090
exec_test()
8191
{
@@ -89,12 +99,14 @@ exec_test()
8999
local RET=0
90100
# this is how our test script is expected to be called
91101
local test_script=$(get_test_script_path_for_ini ${ini_path})
102+
# get the number of events to be simulated from the ini file
103+
local nev=$(get_nevents_from_ini ${ini_path})
92104
# prepare the header of the log files
93105
echo "### Testing ${ini_path} with generator ${generator} ###" > ${LOG_FILE_KINE}
94106
echo "### Testing ${ini_path} with generator ${generator} ###" > ${LOG_FILE_GENERIC_KINE}
95107
echo "### Testing ${ini_path} with generator ${generator} ###" > ${LOG_FILE_SIM}
96108
# run the simulation, fail if not successful
97-
o2-sim -g ${generator_lower} ${trigger} --noGeant -n 100 -j 4 --configFile ${ini_path} --configKeyValues "GeneratorPythia8.includePartonEvent=true" >> ${LOG_FILE_SIM} 2>&1
109+
o2-sim -g ${generator_lower} ${trigger} --noGeant -n ${nev} -j 4 --configFile ${ini_path} --configKeyValues "GeneratorPythia8.includePartonEvent=true" >> ${LOG_FILE_SIM} 2>&1
98110
RET=${?}
99111
[[ "${RET}" != "0" ]] && { remove_artifacts ; return ${RET} ; }
100112

0 commit comments

Comments
 (0)