diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 438378738a1c1517142e49420611ca209f92449d..818e8e2421da86bdf36065cd0021137cf22b8689 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,3 @@ -image: corsika/devel:u-18.04 - variables: GIT_SSL_NO_VERIFY: "1" ## Runtime options for sanitizers @@ -9,60 +7,201 @@ variables: LSAN_OPTIONS: "log_threads=1" ASAN_OPTIONS: "detect_leaks=0:detect_stack_use_after_return=1" -build: # normal pipeline for each commit, except for commits to the master - stage: build +# normal multi-step pipeline for each commit +stages: + - config + - build + - test + - release + - optional + +# job/stage to just prepare cmake +config-u-18_04: + image: corsika/devel:u-18.04 + stage: config + tags: + - corsika + script: + - mkdir build + - cd build + - cmake .. -DCMAKE_BUILD_TYPE=Debug -DWITH_PYTHIA=ON + artifacts: + expire_in: 1 day + paths: + - build + except: + - master + +# job/stage to just prepare cmake +config-clang-8: + image: corsika/devel:clang-8 + stage: config tags: - corsika script: - mkdir build - cd build - - cmake .. -DCMAKE_BUILD_TYPE=Debug + - cmake .. -DCMAKE_BUILD_TYPE=Debug -DWITH_PYTHIA=ON + artifacts: + expire_in: 1 day + paths: + - build + except: + - master + +# normal pipeline for each commit +build-u-18_04: + image: corsika/devel:u-18.04 + dependencies: + - config-u-18_04 + stage: build + tags: + - corsika + script: + - cd build - cmake --build . -- -j4 - - ctest -j4 -V >& test.log || gzip -v -9 -S .gz test.log artifacts: - expire_in: 1 year + expire_in: 1 day + paths: + - build + +# normal pipeline for each commit +build-clang-8: + image: corsika/devel:clang-8 + dependencies: + - config-clang-8 + stage: build + tags: + - corsika + script: + - cd build + - cmake --build . -- -j4 + artifacts: + expire_in: 1 day + paths: + - build + +test-u-18_04: + image: corsika/devel:u-18.04 + dependencies: + - build-u-18_04 + stage: test + tags: + - corsika + script: + - set -o pipefail + - cd build + - ctest -VV | gzip -v -9 > test.log.gz + artifacts: + expire_in: 3 months + reports: + junit: + - build/test_outputs/junit*.xml paths: - build/test.log.gz + +test-clang-8: + image: corsika/devel:clang-8 + dependencies: + - build-clang-8 + stage: test + tags: + - corsika + script: + - set -o pipefail + - cd build + - ctest -VV | gzip -v -9 > test.log.gz + artifacts: + expire_in: 3 months reports: junit: - build/test_outputs/junit*.xml - except: - - master + paths: + - build/test.log.gz -coverage: # special pipeline for master with coverage report - stage: build +# normal pipeline for each commit +release-u-18_04: + image: corsika/devel:u-18.04 + dependencies: + - config-u-18_04 + stage: optional tags: - corsika script: - - mkdir -p build - cd build - - cmake .. -DCMAKE_BUILD_TYPE=Coverage + - cmake .. -DCMAKE_BUILD_TYPE=Release - cmake --build . -- -j4 - ctest -j4 - - cmake --build . --target coverage && tar czf coverage-report.tar.gz coverage-report + when: manual + +# normal pipeline for each commit +release-clang-8: + image: corsika/devel:clang-8 + dependencies: + - config-clang-8 + stage: optional + tags: + - corsika + script: + - cd build + - cmake .. -DCMAKE_BUILD_TYPE=Release + - cmake --build . -- -j4 + - ctest -j4 + when: manual + +coverage: # special manual job to run after normal pipeline finished + image: corsika/devel:u-18.04 + dependencies: + - config-u-18_04 + stage: optional + tags: + - corsika + script: + - cd build + - cmake .. -DCMAKE_BUILD_TYPE=Coverage + - cmake --build . -- -j4 + - ctest -j4 -V > test.log + - cmake --build . --target coverage + - tar czf coverage-report.tar.gz coverage-report + coverage: '/functions.*\s+(\d+\%)\s/' artifacts: expire_in: 1 year paths: - build/coverage-report.tar.gz - only: - - master + when: manual + allow_failure: true -pages: - stage: build +documentation: + image: corsika/devel:u-18.04 + dependencies: + - build-u-18_04 + stage: optional tags: - corsika script: - - mkdir build - cd build - - cmake .. - - cmake --build . --target doxygen + - cmake --build . --target doxygen -- -j4 - mkdir .public - cp -r Documentation/Doxygen/html .public/ - mv .public ../public artifacts: + expire_in: 3 months paths: - public - only: - - tags - - triggers - - schedules + when: manual + allow_failure: true + +sanity: + image: corsika/devel:u-18.04 + dependencies: + - config-u-18_04 + stage: optional + tags: + - corsika + script: + - cd build + - cmake .. -DWITH_CORSIKA_SANITIZERS_ENABLED=ON + - cmake --build . -- -j4 + when: manual + allow_failure: true + diff --git a/CMakeLists.txt b/CMakeLists.txt index ade8b59113b141e54e31fc9cfcfc206070a075d4..cf20efb466d9acf9436a98264ae2d9834db9d024 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,12 +18,14 @@ project ( # as long as there still are modules using it: enable_language (Fortran) +# TEMPORARY: this should be removed, the sanitizers should be always enabled +option (WITH_CORSIKA_SANITIZERS_ENABLED "temporary way to globally disable sanitizers until the currently failing tests are fixed" OFF) +option (WITH_PYTHIA "flag to switch on/off pythia support" OFF) +option (WITH_COAST "flag to switch on/off COAST (reverse) interface" OFF) + # ignore many irrelevant Up-to-date messages during install set (CMAKE_INSTALL_MESSAGE LAZY) -# TEMPORARY: this should be removed, the sanitizers should be always enabled -option(CORSIKA_SANITIZERS_ENABLED "temporary way to globally disable sanitizers until the currently failing tests are fixed" OFF) - # directory for local cmake modules set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules) include (CorsikaUtilities) # a few cmake function @@ -105,7 +107,7 @@ if (CMAKE_BUILD_TYPE STREQUAL Coverage) COMMAND ${LCOV_BIN_DIR}/genhtml coverage.info -o coverage-report DEPENDS coverage.info ) - add_custom_target(coverage DEPENDS coverage-report) + add_custom_target (coverage DEPENDS coverage-report) endif () # add call to ./do-copyright.py to run as unit-test-case @@ -114,12 +116,13 @@ add_test (NAME copyright_notices COMMAND ./do-copyright.py WORKING_DIRECTORY ${C # add call to do-clang-format.sh checking to run as unit-test-case add_test (NAME clang_format COMMAND ./do-clang-format.sh check WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) -find_package (Pythia8) # optional +if (WITH_PYTHIA) + find_package (Pythia8) # optional +endif (WITH_PYTHIA) find_package (Eigen3 REQUIRED) # order of subdirectories add_subdirectory (ThirdParty) -#add_subdirectory (Utilities) add_subdirectory (Framework) add_subdirectory (Environment) add_subdirectory (Stack) @@ -130,4 +133,4 @@ add_subdirectory (Main) add_subdirectory (Tools) if (WITH_COAST) add_subdirectory (COAST) -endif() +endif () diff --git a/CMakeModules/CorsikaUtilities.cmake b/CMakeModules/CorsikaUtilities.cmake index ad853b8d1c5c48c94761c7edbcaccbf25427ca45..abe8e4a761cb30e0bbae0900258ab4817b22683d 100644 --- a/CMakeModules/CorsikaUtilities.cmake +++ b/CMakeModules/CorsikaUtilities.cmake @@ -151,5 +151,5 @@ function (CORSIKA_ADD_TEST) target_compile_options(${name} PRIVATE -O1 -fno-omit-frame-pointer -fsanitize=${sanitize} -fno-sanitize-recover=all) set_target_properties(${name} PROPERTIES LINK_FLAGS "-fsanitize=${sanitize}") endif() - add_test (NAME ${name} COMMAND ${name} -o ${PROJECT_BINARY_DIR}/test_outputs/junit-${name}.xml -r junit) + add_test (NAME ${name} COMMAND ${name} -o ${PROJECT_BINARY_DIR}/test_outputs/junit-${name}.xml -s -r junit) endfunction (CORSIKA_ADD_TEST) diff --git a/Environment/BaseExponential.h b/Environment/BaseExponential.h index 15585b6af48cdb33f4484d35da228ece4c8831f0..462c73c26a0713233e7b3c37b30d25cb3f57bcb4 100644 --- a/Environment/BaseExponential.h +++ b/Environment/BaseExponential.h @@ -1,5 +1,6 @@ + /* - * (c) Copyright 2019 CORSIKA Project, corsika-project@lists.kit.edu + * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. * diff --git a/Environment/SlidingPlanarExponential.h b/Environment/SlidingPlanarExponential.h index 3cffa3afb7b4cb0ce803b4f0ed4edfd1a2392445..71f8e27d917e3e34fc5d8c2fc663d5142d07aa59 100644 --- a/Environment/SlidingPlanarExponential.h +++ b/Environment/SlidingPlanarExponential.h @@ -1,5 +1,6 @@ + /* - * (c) Copyright 2019 CORSIKA Project, corsika-project@lists.kit.edu + * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. * diff --git a/Framework/ProcessSequence/ProcessSequence.h b/Framework/ProcessSequence/ProcessSequence.h index bb8bb061f56b361efe2036a192a9c5d8ee110b3a..8116966d188200ccaca38e292c7e5dd7c0e47fab 100644 --- a/Framework/ProcessSequence/ProcessSequence.h +++ b/Framework/ProcessSequence/ProcessSequence.h @@ -60,12 +60,12 @@ namespace corsika::process { template <typename T> struct is_switch_process : std::false_type {}; - template <typename A, typename B> - struct is_switch_process<switch_process::SwitchProcess<A, B>> : std::true_type {}; - template <typename T> bool constexpr is_switch_process_v = is_switch_process<T>::value; + template <typename A, typename B> + struct is_process_sequence<switch_process::SwitchProcess<A, B>> : std::true_type {}; + /** T1 and T2 are both references if possible (lvalue), otherwise (rvalue) they are just classes. This allows us to handle both, diff --git a/Framework/Utilities/sgn.h b/Framework/Utilities/sgn.h index 43d9a9fad728785ec851424b2113f5e7dac60af1..b0084ee04827345548384b00cd73ea4c76209086 100644 --- a/Framework/Utilities/sgn.h +++ b/Framework/Utilities/sgn.h @@ -1,3 +1,14 @@ + +/* + * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu + * + * See file AUTHORS for a list of contributors. + * + * This software is distributed under the terms of the GNU General Public + * Licence version 3 (GPL Version 3). See file LICENSE for a full version of + * the license. + */ + #ifndef _utilities_sgn_h #define _utilities_sgn_h diff --git a/Processes/CMakeLists.txt b/Processes/CMakeLists.txt index a9e52d9e8172f42b7265a17ec23924b018e7dd5d..e3057e2db42052314aea04b8e8c02f2aea963709 100644 --- a/Processes/CMakeLists.txt +++ b/Processes/CMakeLists.txt @@ -12,7 +12,6 @@ add_subdirectory (UrQMD) add_subdirectory (SwitchProcess) add_subdirectory (ParticleCut) -#add_custom_target(CORSIKAprocesses) add_library (CORSIKAprocesses INTERFACE) add_dependencies(CORSIKAprocesses ProcessNullModel) add_dependencies(CORSIKAprocesses ProcessSibyll) diff --git a/Processes/Pythia/testPythia.cc b/Processes/Pythia/testPythia.cc index caeb193281e3410caded70e667754622c53c8e65..6e35b89df8cb59a5614555768f03bcd2a3cc27cb 100644 --- a/Processes/Pythia/testPythia.cc +++ b/Processes/Pythia/testPythia.cc @@ -98,7 +98,6 @@ TEST_CASE("pythia process") { // setup environment, geometry environment::Environment<environment::IMediumModel> env; - auto& universe = *(env.GetUniverse()); geometry::CoordinateSystem const& cs = env.GetCoordinateSystem(); @@ -115,7 +114,6 @@ TEST_CASE("pythia process") { std::vector<float>{1.})); auto const* nodePtr = theMedium.get(); // save the medium for later use before moving it - universe.AddChild(std::move(theMedium)); SECTION("pythia decay") { @@ -141,7 +139,7 @@ TEST_CASE("pythia process") { process::pythia::Decay model(particleList); model.Init(); - /*[[maybe_unused]] const process::EProcessReturn ret =*/model.DoDecay(projectile); + model.DoDecay(projectile); [[maybe_unused]] const TimeType time = model.GetLifetime(particle); } diff --git a/Processes/SwitchProcess/SwitchProcess.h b/Processes/SwitchProcess/SwitchProcess.h index 4a251b360f7b4855619d2165512475adba3e8c38..b217af0a5bf27559f084792b78ddcd3d5ffe5c56 100644 --- a/Processes/SwitchProcess/SwitchProcess.h +++ b/Processes/SwitchProcess/SwitchProcess.h @@ -1,5 +1,5 @@ /* - * (c) Copyright 2019 CORSIKA Project, corsika-project@lists.kit.edu + * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. * diff --git a/Processes/SwitchProcess/testSwitchProcess.cc b/Processes/SwitchProcess/testSwitchProcess.cc index be3ced44fe2c9f3ffdf66d5a1d3ab70c0ba25189..b66b90bb5eff2766650e5adb264e6edd11103ead 100644 --- a/Processes/SwitchProcess/testSwitchProcess.cc +++ b/Processes/SwitchProcess/testSwitchProcess.cc @@ -1,5 +1,5 @@ /* - * (c) Copyright 2019 CORSIKA Project, corsika-project@lists.kit.edu + * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. * diff --git a/Processes/UrQMD/UrQMD.cc b/Processes/UrQMD/UrQMD.cc index fba5dc1833be9f813d14b6dfd9cb3c872192594c..1258c26329809906ca0e7dcff22b11c289580118 100644 --- a/Processes/UrQMD/UrQMD.cc +++ b/Processes/UrQMD/UrQMD.cc @@ -1,5 +1,5 @@ /* - * (c) Copyright 2019 CORSIKA Project, corsika-project@lists.kit.edu + * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. * diff --git a/Processes/UrQMD/UrQMD.h b/Processes/UrQMD/UrQMD.h index bdbca146ea015ce66174b7c2b2b99f619636c466..ea2526b9161099f3150771e8b69d676716fec170 100644 --- a/Processes/UrQMD/UrQMD.h +++ b/Processes/UrQMD/UrQMD.h @@ -1,5 +1,5 @@ /* - * (c) Copyright 2019 CORSIKA Project, corsika-project@lists.kit.edu + * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. * diff --git a/Processes/UrQMD/testUrQMD.cc b/Processes/UrQMD/testUrQMD.cc index 81b4215475cf2d927ed6a7e86cb20462798c5c3b..13c17f6d2d14e72b2a48470397484c7b47faf9ee 100644 --- a/Processes/UrQMD/testUrQMD.cc +++ b/Processes/UrQMD/testUrQMD.cc @@ -1,5 +1,6 @@ + /* - * (c) Copyright 2019 CORSIKA Project, corsika-project@lists.kit.edu + * (c) Copyright 2018 CORSIKA Project, corsika-project@lists.kit.edu * * See file AUTHORS for a list of contributors. *