Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
Zehvogel committed Nov 30, 2023
1 parent e823a3a commit 76ec6e7
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 0 deletions.
3 changes: 3 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ if (BASH_PROGRAM)
# multiple processors
add_test( global_converter_maps ${BASH_PROGRAM} ${CMAKE_CURRENT_SOURCE_DIR}/scripts/global_converter_maps.sh )

add_test( event_header ${BASH_PROGRAM} ${CMAKE_CURRENT_SOURCE_DIR}/scripts/event_header.sh )

set_tests_properties (
simple_processors
simple_processors2
Expand All @@ -100,6 +102,7 @@ if (BASH_PROGRAM)
clicRec_edm4hep_input
clic_geo_test
global_converter_maps
event_header
PROPERTIES
ENVIRONMENT "TEST_DIR=${CMAKE_CURRENT_SOURCE_DIR};LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib:${CMAKE_INSTALL_PREFIX}/lib64:$ENV{LD_LIBRARY_PATH};PYTHONPATH=${CMAKE_INSTALL_PREFIX}/python:$ENV{PYTHONPATH};EXAMPLE_DIR=${PROJECT_SOURCE_DIR}/k4MarlinWrapper/examples;MARLIN_DLL=$ENV{MARLIN_DLL}:${CMAKE_CURRENT_BINARY_DIR}/libMarlinTestProcessors.so"
)
Expand Down
45 changes: 45 additions & 0 deletions test/gaudi_opts/createEventHeader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#
# Copyright (c) 2019-2023 Key4hep-Project.
#
# This file is part of Key4hep.
# See https://key4hep.github.io/key4hep-doc/ for further info.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
from Gaudi.Configuration import WARNING

from Configurables import (
EventHeaderCreator,
k4DataSvc,
MarlinProcessorWrapper,
ApplicationMgr,
)

eventHeaderCreator = EventHeaderCreator("eventHeaderCreator", eventNumberOffset=42)

podioevent = k4DataSvc("EventDataSvc")

out = MarlinProcessorWrapper("out")
out.ProcessorType = "LCIOOutputProcessor"
out.Parameters = {"LCIOOutputFile": ["test.slcio"], "LCIOWriteMode": ["WRITE_NEW"]}

ApplicationMgr(
TopAlg=[
eventHeaderCreator,
out,
],
EvtSel="NONE",
EvtMax=2,
ExtSvc=[podioevent],
OutputLevel=WARNING,
)
24 changes: 24 additions & 0 deletions test/scripts/event_header.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env sh
##
## Copyright (c) 2019-2023 Key4hep-Project.
##
## This file is part of Key4hep.
## See https://key4hep.github.io/key4hep-doc/ for further info.
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##

set -eu

k4run $TEST_DIR/gaudi_opts/createEventHeader.py
anajob test.slcio | grep "EVENT: 42"

0 comments on commit 76ec6e7

Please sign in to comment.