diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 12e9b24..5604cf7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,10 +15,6 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: Download test inputs - run: | - wget http://lreichen.webtest.cern.ch/test.slcio - - name: Start container run: | docker run \ @@ -31,5 +27,6 @@ jobs: run: | docker exec CLDConfig_CI /bin/bash -c 'source ${{ matrix.SETUP }}; cd CLDConfig; - pytest; + cmake .; + ctest --output-on-failure; ' diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..183887a --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,22 @@ +#[[ +Copyright (c) 2014-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. +]] +project(CLDConfig) + +add_subdirectory(test) +enable_testing() diff --git a/test/.gitignore b/test/.gitignore new file mode 100644 index 0000000..db5ab16 --- /dev/null +++ b/test/.gitignore @@ -0,0 +1,21 @@ +### CMake ### +CMakeLists.txt.user +CMakeCache.txt +CMakeFiles +CMakeScripts +Testing +Makefile +cmake_install.cmake +install_manifest.txt +compile_commands.json +CTestTestfile.cmake +_deps + +### CMake Patch ### +# External projects +*-prefix/ + +### other ### +*.root +*.slcio +build/* diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..3bd9e04 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,45 @@ +#[[ +Copyright (c) 2014-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. +]] +include(CTest) + +set(DETECTOR $ENV{K4GEO}/FCCee/CLD/compact/FCCee_o1_v04/FCCee_o1_v04.xml) +set(CLDConfig_DIR ${CMAKE_CURRENT_LIST_DIR}/../CLDConfig) + +add_test(NAME ddsim_lcio + WORKING_DIRECTORY ${CLDConfig_DIR} + COMMAND ddsim -S cld_steer.py -N 3 --inputFile ../test/yyxyev_000.stdhep --outputFile test.slcio --compactFile ${DETECTOR} +) + +# FIXME: need to call k4run from CLDConfig dir where the pandora config lives +add_test(NAME lcio_input + WORKING_DIRECTORY ${CLDConfig_DIR} + COMMAND k4run --inputFiles=test.slcio --outputBasename=rec_test_lcio CLDReconstruction.py --GeoSvc.detectors=${DETECTOR} +) +set_property(TEST lcio_input APPEND PROPERTY DEPENDS ddsim_lcio) + +add_test(NAME ddsim_edm4hep + WORKING_DIRECTORY ${CLDConfig_DIR} + COMMAND ddsim -S cld_steer.py -N 3 --inputFile ../test/yyxyev_000.stdhep --outputFile test.edm4hep.root --compactFile ${DETECTOR} +) + +add_test(NAME edm4hep_input + WORKING_DIRECTORY ${CLDConfig_DIR} + COMMAND k4run --inputFiles=test.edm4hep.root --outputBasename=rec_test_edm4hep CLDReconstruction.py --GeoSvc.detectors=${DETECTOR} +) +set_property(TEST edm4hep_input APPEND PROPERTY DEPENDS ddsim_edm4hep) diff --git a/test/test_CLDConfig.py b/test/test_CLDConfig.py deleted file mode 100644 index 2c404ae..0000000 --- a/test/test_CLDConfig.py +++ /dev/null @@ -1,36 +0,0 @@ -# -# Copyright (c) 2014-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. -# -import os -import subprocess -from decorator import decorator - -@decorator -def _CLDConfig(test_fun): - os.chdir("CLDConfig") - test_fun() - os.chdir("..") - - -@_CLDConfig -def test_lcio_edm4hep(): - command = "k4run --inputFiles=../test.slcio --outputBasename=rec_test CLDReconstruction.py".split() - detectorModel = os.path.join(os.environ["K4GEO"], "FCCee/CLD/compact/FCCee_o1_v04/FCCee_o1_v04.xml") - command.extend(["--GeoSvc.detectors", detectorModel]) - res = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True) - assert res.returncode == 0, res.stdout diff --git a/test/yyxyev_000.stdhep b/test/yyxyev_000.stdhep new file mode 100644 index 0000000..5b9f05b Binary files /dev/null and b/test/yyxyev_000.stdhep differ