Skip to content

Commit 899ce7c

Browse files
committed
Reenable sim test; Add additional checks
also refactored environment handling for sim tests
1 parent 66561d9 commit 899ce7c

2 files changed

Lines changed: 82 additions & 31 deletions

File tree

run/CMakeLists.txt

Lines changed: 54 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ o2_data_file(COPY o2simtopology.json DESTINATION config)
108108
set(SIMTESTDIR ${CMAKE_BINARY_DIR}/o2sim_tests)
109109
file(MAKE_DIRECTORY ${SIMTESTDIR})
110110

111+
# define environment needed for simulation tests (during build phase)
112+
# needed because the build environment is different to runtime environment
113+
set(SIMENV "ALICE_O2SIM_DUMPLOG=ON;O2_ROOT=${CMAKE_BINARY_DIR}/stage;VMCWORKDIR=${CMAKE_BINARY_DIR}/stage/share;ROOT_INCLUDE_PATH=$ENV{ROOT_INCLUDE_PATH}:$ENV{HEPMC3_ROOT}/include;ROOT_DYN_PATH=$ENV{ROOTSYS}/lib")
114+
message(STATUS "SIMENV = ${SIMENV}")
115+
111116
o2_name_target(sim NAME o2simExecutable IS_EXE)
112117
o2_name_target(sim-serial NAME o2simSerialExecutable IS_EXE)
113118

@@ -125,16 +130,13 @@ o2_add_test_wrapper(NAME o2sim_G4
125130
TGeant4
126131
-o
127132
o2simG4
133+
ENVIRONMENT "${SIMENV}"
128134
LABELS "g4;sim;long")
129135

130136
set_tests_properties(o2sim_G4
131137
PROPERTIES PASS_REGULAR_EXPRESSION
132138
"SIMULATION RETURNED SUCCESFULLY" FIXTURES_SETUP
133139
G4)
134-
set_property(TEST o2sim_G4 APPEND PROPERTY ENVIRONMENT
135-
ALICE_O2SIM_DUMPLOG=ON
136-
O2_ROOT=${CMAKE_BINARY_DIR}/stage
137-
VMCWORKDIR=${CMAKE_BINARY_DIR}/stage/share)
138140
set_property(TEST o2sim_G4 APPEND PROPERTY ENVIRONMENT ${G4ENV})
139141

140142
# # note that the MT is currently only supported in the non FairMQ version
@@ -152,13 +154,11 @@ o2_add_test_wrapper(NAME o2sim_G4_mt
152154
on
153155
-o
154156
o2simG4MT
157+
ENVIRONMENT "${SIMENV}"
155158
LABELS "g4;sim;long")
156159
set_tests_properties(o2sim_G4_mt
157160
PROPERTIES PASS_REGULAR_EXPRESSION
158161
"Macro finished succesfully")
159-
set_property(TEST o2sim_G4_mt APPEND PROPERTY ENVIRONMENT
160-
O2_ROOT=${CMAKE_BINARY_DIR}/stage
161-
VMCWORKDIR=${CMAKE_BINARY_DIR}/stage/share)
162162
set_property(TEST o2sim_G4_mt APPEND PROPERTY ENVIRONMENT ${G4ENV})
163163

164164

@@ -188,7 +188,8 @@ o2_add_test_wrapper(NAME o2sim_G3
188188
-o
189189
o2simG3
190190
LABELS g3 sim long
191-
ENVIRONMENT "O2_ROOT=${CMAKE_BINARY_DIR}/stage;VMCWORKDIR=${CMAKE_BINARY_DIR}/stage/share")
191+
ENVIRONMENT "${SIMENV}"
192+
)
192193

193194
# set properties for G3 ... we use fixtures to force execution after G4 (since
194195
# they require multiple CPUs)
@@ -199,7 +200,6 @@ set_tests_properties(o2sim_G3
199200
G4
200201
FIXTURES_SETUP
201202
G3)
202-
set_property(TEST o2sim_G3 APPEND PROPERTY ENVIRONMENT "ALICE_O2SIM_DUMPLOG=ON")
203203

204204
o2_add_test(CheckStackG3
205205
SOURCES checkStack.cxx
@@ -215,25 +215,48 @@ set_tests_properties(o2sim_checksimkinematics_G3
215215
PROPERTIES FIXTURES_REQUIRED G3)
216216

217217

218-
#o2_add_test_wrapper(NAME o2sim_hepmc
219-
# WORKING_DIRECTORY ${SIMTESTDIR}
220-
# DONT_FAIL_ON_TIMEOUT
221-
# MAX_ATTEMPTS 2
222-
# TIMEOUT 400
223-
# COMMAND $<TARGET_FILE:${o2simExecutable}>
224-
# COMMAND_LINE_ARGS -n
225-
# 2
226-
# -j
227-
# 2
228-
# -g
229-
# hepmc
230-
# --configKeyValues
231-
# "HepMC.fileName=${CMAKE_SOURCE_DIR}/Generators/share/data/pythia.hepmc;HepMC.version=2"
232-
# -o
233-
# o2simhepmc
234-
# LABELS long sim hepmc3
235-
# ENVIRONMENT "O2_ROOT=${CMAKE_BINARY_DIR}/stage;VMCWORKDIR=${CMAKE_BINARY_DIR}/stage/share")
236-
#
237-
#set_tests_properties(o2sim_hepmc
238-
# PROPERTIES PASS_REGULAR_EXPRESSION
239-
# "SIMULATION RETURNED SUCCESFULLY")
218+
o2_add_test_wrapper(NAME o2sim_hepmc
219+
WORKING_DIRECTORY ${SIMTESTDIR}
220+
DONT_FAIL_ON_TIMEOUT
221+
MAX_ATTEMPTS 2
222+
TIMEOUT 400
223+
COMMAND $<TARGET_FILE:${o2simExecutable}>
224+
COMMAND_LINE_ARGS -n
225+
2
226+
-j
227+
2
228+
-g
229+
hepmc
230+
--configKeyValues
231+
"HepMC.fileName=${CMAKE_SOURCE_DIR}/Generators/share/data/pythia.hepmc;HepMC.version=2"
232+
-o
233+
o2simhepmc
234+
LABELS long sim hepmc3
235+
ENVIRONMENT "${SIMENV}")
236+
237+
set_tests_properties(o2sim_hepmc
238+
PROPERTIES PASS_REGULAR_EXPRESSION
239+
"SIMULATION RETURNED SUCCESFULLY")
240+
241+
# somewhat analyse the logfiles as another means to detect problems
242+
o2_add_test_wrapper(NAME o2sim_G3_checklogs
243+
WORKING_DIRECTORY ${SIMTESTDIR}
244+
DONT_FAIL_ON_TIMEOUT
245+
COMMAND ${CMAKE_SOURCE_DIR}/run/simlogcheck.sh
246+
COMMAND_LINE_ARGS o2simG3_serverlog o2simG3_mergerlog o2simG3_workerlog0
247+
LABELS long sim hepmc3)
248+
249+
set_tests_properties(o2sim_G3_checklogs
250+
PROPERTIES FIXTURES_REQUIRED G3)
251+
252+
# somewhat analyse the logfiles as another means to detect problems
253+
o2_add_test_wrapper(NAME o2sim_G4_checklogs
254+
WORKING_DIRECTORY ${SIMTESTDIR}
255+
DONT_FAIL_ON_TIMEOUT
256+
COMMAND ${CMAKE_SOURCE_DIR}/run/simlogcheck.sh
257+
COMMAND_LINE_ARGS o2simG4_serverlog o2simG4_mergerlog o2simG4_workerlog0
258+
LABELS long sim
259+
)
260+
261+
set_tests_properties(o2sim_G3_checklogs
262+
PROPERTIES FIXTURES_REQUIRED G4)

run/simlogcheck.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash -l
2+
set -x
3+
4+
# a script checking logfiles for signs of error
5+
# can be used to detect most common errors automatically
6+
# returns/exits with 0 if no problem
7+
8+
error=0
9+
10+
for file in "$@"; do
11+
echo "looking into ${file}"
12+
13+
# We don't want to see "Error" or "ERROR" messages
14+
value=$(grep "Error" ${file})
15+
if [ -n "${value}" ]; then
16+
echo "check for Error failed"
17+
let error=error+1
18+
fi
19+
20+
value=$(grep "ERROR" ${file})
21+
if [ -n "${value}" ]; then
22+
echo "check for ERROR failed"
23+
let error=error+1
24+
fi
25+
26+
done
27+
28+
exit ${error}

0 commit comments

Comments
 (0)