IAP GITLAB

Skip to content
Snippets Groups Projects
Commit f3d7da9d authored by Maximilian Reininghaus's avatar Maximilian Reininghaus :vulcan:
Browse files

Merge branch '266-remove-examples-from-coverage' into 'master'

Resolve "remove examples from coverage"

Closes #266

See merge request !199
parents 46802865 a91b6d22
No related branches found
No related tags found
1 merge request!199Resolve "remove examples from coverage"
Pipeline #1375 passed
...@@ -11,7 +11,9 @@ variables: ...@@ -11,7 +11,9 @@ variables:
stages: stages:
- config - config
- quality - quality
- build_test - build
- test
- example
- optional - optional
# job/stage to just prepare cmake # job/stage to just prepare cmake
...@@ -23,7 +25,6 @@ config-u-18_04: ...@@ -23,7 +25,6 @@ config-u-18_04:
variables: variables:
CORSIKA_DATA: "${CI_PROJECT_DIR}/corsika-data/" CORSIKA_DATA: "${CI_PROJECT_DIR}/corsika-data/"
script: script:
- git clone https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika-data.git
- mkdir build - mkdir build
- cd build - cd build
- cmake .. -DCMAKE_BUILD_TYPE=Debug -DWITH_PYTHIA=ON - cmake .. -DCMAKE_BUILD_TYPE=Debug -DWITH_PYTHIA=ON
...@@ -31,7 +32,6 @@ config-u-18_04: ...@@ -31,7 +32,6 @@ config-u-18_04:
expire_in: 1 day expire_in: 1 day
paths: paths:
- build - build
- corsika-data
# job/stage to just prepare cmake # job/stage to just prepare cmake
config-clang-8: config-clang-8:
...@@ -42,7 +42,6 @@ config-clang-8: ...@@ -42,7 +42,6 @@ config-clang-8:
variables: variables:
CORSIKA_DATA: "${CI_BUILDS_DIR}/AirShowerPhysics/corsika/corsika-data/" CORSIKA_DATA: "${CI_BUILDS_DIR}/AirShowerPhysics/corsika/corsika-data/"
script: script:
- git clone https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika-data.git
- mkdir build - mkdir build
- cd build - cd build
- cmake .. -DCMAKE_BUILD_TYPE=Debug -DWITH_PYTHIA=ON - cmake .. -DCMAKE_BUILD_TYPE=Debug -DWITH_PYTHIA=ON
...@@ -50,7 +49,6 @@ config-clang-8: ...@@ -50,7 +49,6 @@ config-clang-8:
expire_in: 1 day expire_in: 1 day
paths: paths:
- build - build
- corsika-data
check-copyrights: check-copyrights:
image: corsika/devel:u-18.04 image: corsika/devel:u-18.04
...@@ -71,11 +69,11 @@ check-clang-format: ...@@ -71,11 +69,11 @@ check-clang-format:
- ./do-clang-format.py --all - ./do-clang-format.py --all
# normal pipeline for each commit # normal pipeline for each commit
build-test-u-18_04: build-u-18_04:
image: corsika/devel:u-18.04 image: corsika/devel:u-18.04
dependencies: dependencies:
- config-u-18_04 - config-u-18_04
stage: build_test stage: build
tags: tags:
- corsika - corsika
variables: variables:
...@@ -83,6 +81,43 @@ build-test-u-18_04: ...@@ -83,6 +81,43 @@ build-test-u-18_04:
script: script:
- cd build - cd build
- cmake --build . -- -j4 - cmake --build . -- -j4
artifacts:
expire_in: 1 hour
paths:
- build
# normal pipeline for each commit
build-clang-8:
image: corsika/devel:clang-8
dependencies:
- config-clang-8
stage: build
tags:
- corsika
variables:
CORSIKA_DATA: "${CI_PROJECT_DIR}/corsika-data/"
script:
- cd build
- cmake --build . -- -j4
artifacts:
expire_in: 1 hour
reports:
paths:
- build
# normal pipeline for each commit
test-u-18_04:
image: corsika/devel:u-18.04
dependencies:
- build-u-18_04
stage: test
tags:
- corsika
variables:
CORSIKA_DATA: "${CI_PROJECT_DIR}/corsika-data/"
script:
- git clone https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika-data.git
- cd build
- set -o pipefail - set -o pipefail
- ctest -VV | gzip -v -9 > test.log.gz - ctest -VV | gzip -v -9 > test.log.gz
artifacts: artifacts:
...@@ -95,18 +130,18 @@ build-test-u-18_04: ...@@ -95,18 +130,18 @@ build-test-u-18_04:
- build/test.log.gz - build/test.log.gz
# normal pipeline for each commit # normal pipeline for each commit
build-test-clang-8: test-clang-8:
image: corsika/devel:clang-8 image: corsika/devel:clang-8
dependencies: dependencies:
- config-clang-8 - build-clang-8
stage: build_test stage: test
tags: tags:
- corsika - corsika
variables: variables:
CORSIKA_DATA: "${CI_PROJECT_DIR}/corsika-data/" CORSIKA_DATA: "${CI_PROJECT_DIR}/corsika-data/"
script: script:
- git clone https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika-data.git
- cd build - cd build
- cmake --build . -- -j4
- set -o pipefail - set -o pipefail
- ctest -VV | gzip -v -9 > test.log.gz - ctest -VV | gzip -v -9 > test.log.gz
artifacts: artifacts:
...@@ -117,9 +152,51 @@ build-test-clang-8: ...@@ -117,9 +152,51 @@ build-test-clang-8:
- build/test_outputs/junit*.xml - build/test_outputs/junit*.xml
paths: paths:
- build/test.log.gz - build/test.log.gz
# normal pipeline for each commit
example-u-18_04:
image: corsika/devel:u-18.04
dependencies:
- build-u-18_04
stage: example
tags:
- corsika
variables:
CORSIKA_DATA: "${CI_PROJECT_DIR}/corsika-data/"
script:
- git clone https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika-data.git
- cd build
- set -o pipefail
- make run_examples | gzip -v -9 > examples.log.gz
artifacts:
when: always
expire_in: 1 week
paths:
- build/examples.log.gz
# normal pipeline for each commit
example-clang-8:
image: corsika/devel:clang-8
dependencies:
- build-clang-8
stage: example
tags:
- corsika
variables:
CORSIKA_DATA: "${CI_PROJECT_DIR}/corsika-data/"
script:
- git clone https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika-data.git
- cd build
- set -o pipefail
- make run_examples | gzip -v -9 > examples.log.gz
artifacts:
when: always
expire_in: 1 week
paths:
- build/examples.log.gz
# optional release pipeline for each commit # optional release pipeline for each commit
release-u-18_04: release-full-u-18_04:
image: corsika/devel:u-18.04 image: corsika/devel:u-18.04
dependencies: dependencies:
- config-u-18_04 - config-u-18_04
...@@ -129,11 +206,13 @@ release-u-18_04: ...@@ -129,11 +206,13 @@ release-u-18_04:
variables: variables:
CORSIKA_DATA: "${CI_PROJECT_DIR}/corsika-data/" CORSIKA_DATA: "${CI_PROJECT_DIR}/corsika-data/"
script: script:
- git clone https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika-data.git
- cd build - cd build
- cmake .. -DCMAKE_BUILD_TYPE=Release - cmake .. -DCMAKE_BUILD_TYPE=Release
- cmake --build . -- -j4 - cmake --build . -- -j4
- set -o pipefail - set -o pipefail
- ctest -VV | gzip -v -9 > test.log.gz - ctest -VV | gzip -v -9 > test.log.gz
- make run_examples
artifacts: artifacts:
when: always when: always
expire_in: 1 week expire_in: 1 week
...@@ -145,7 +224,7 @@ release-u-18_04: ...@@ -145,7 +224,7 @@ release-u-18_04:
when: manual when: manual
# optional release pipeline for each commit # optional release pipeline for each commit
release-clang-8: release-full-clang-8:
image: corsika/devel:clang-8 image: corsika/devel:clang-8
dependencies: dependencies:
- config-clang-8 - config-clang-8
...@@ -155,11 +234,13 @@ release-clang-8: ...@@ -155,11 +234,13 @@ release-clang-8:
variables: variables:
CORSIKA_DATA: "${CI_PROJECT_DIR}/corsika-data/" CORSIKA_DATA: "${CI_PROJECT_DIR}/corsika-data/"
script: script:
- git clone https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika-data.git
- cd build - cd build
- cmake .. -DCMAKE_BUILD_TYPE=Release - cmake .. -DCMAKE_BUILD_TYPE=Release
- cmake --build . -- -j4 - cmake --build . -- -j4
- set -o pipefail - set -o pipefail
- ctest -VV | gzip -v -9 > test.log.gz - ctest -VV | gzip -v -9 > test.log.gz
- make run_examples
artifacts: artifacts:
when: always when: always
expire_in: 1 week expire_in: 1 week
......
...@@ -31,7 +31,8 @@ endfunction (CORSIKA_PREPEND_PATH) ...@@ -31,7 +31,8 @@ endfunction (CORSIKA_PREPEND_PATH)
# #
# if needed, create symbolic links from the source files to this build-directory location # if needed, create symbolic links from the source files to this build-directory location
# #
# any path information from input filenames is stripped, IF path was specified it is used for the link destination, if NOT the link is relative to the CMAKE_CURRENT_SOURCE_DIR # any path information from input filenames is stripped, IF path was specified it is used for the link destination,
# if NOT the link is relative to the CMAKE_CURRENT_SOURCE_DIR
# #
function (CORSIKA_COPY_HEADERS_TO_NAMESPACE for_library in_namespace) function (CORSIKA_COPY_HEADERS_TO_NAMESPACE for_library in_namespace)
set (HEADERS_BUILD "") set (HEADERS_BUILD "")
...@@ -126,20 +127,19 @@ endmacro(CORSIKA_ADD_FILES_ABSOLUTE) ...@@ -126,20 +127,19 @@ endmacro(CORSIKA_ADD_FILES_ABSOLUTE)
# TEMPORARY: All sanitizers are currently globally disabled by default, to enable them, # TEMPORARY: All sanitizers are currently globally disabled by default, to enable them,
# set CORSIKA_SANITIZERS_ENABLED to TRUE. # set CORSIKA_SANITIZERS_ENABLED to TRUE.
function (CORSIKA_ADD_TEST) function (CORSIKA_ADD_TEST)
cmake_parse_arguments (PARSE_ARGV 1 _ "" "SANITIZE" "SOURCES") cmake_parse_arguments (PARSE_ARGV 1 C8_ADD_TEST "" "SANITIZE" "SOURCES")
set (name ${ARGV0}) set (name ${ARGV0})
if (NOT __SOURCES) if (NOT C8_ADD_TEST_SOURCES)
set (sources ${name}.cc) set (sources ${name}.cc)
else () else ()
set (sources ${__SOURCES}) set (sources ${C8_ADD_TEST_SOURCES})
endif () endif ()
if (NOT __SANITIZE) if (NOT C8_ADD_TEST_SANITIZE)
set(sanitize "address,undefined") set(sanitize "address,undefined")
else () else ()
set(sanitize ${__SANITIZE}) set(sanitize ${C8_ADD_TEST_SANITIZE})
endif () endif ()
add_executable (${name} ${sources}) add_executable (${name} ${sources})
...@@ -153,3 +153,63 @@ function (CORSIKA_ADD_TEST) ...@@ -153,3 +153,63 @@ function (CORSIKA_ADD_TEST)
endif () endif ()
add_test (NAME ${name} COMMAND ${name} -o ${PROJECT_BINARY_DIR}/test_outputs/junit-${name}.xml -s -r junit) add_test (NAME ${name} COMMAND ${name} -o ${PROJECT_BINARY_DIR}/test_outputs/junit-${name}.xml -s -r junit)
endfunction (CORSIKA_ADD_TEST) endfunction (CORSIKA_ADD_TEST)
#################################################
#
# central macro to register an exmaple in cmake
#
# Examples can be globally executed by 'make run_examples'
#
# 1) Simple use:
# Pass the name of the test.cc file as the first
# argument, without the ".cc" extention.
#
# Example: CORSIKA_ADD_EXAMPLE (testSomething)
#
# This generates target testSomething from file testSomething.cc.
#
# 2) Customize sources:
# If 1) doesn't work, use the SOURCES keyword to explicitly
# specify the sources.
#
# Example: CORSIKA_ADD_EXAMPLE (testSomething
# SOURCES source1.cc source2.cc someheader.h)
#
# In all cases, you can further customize the target with
# target_link_libraries(testSomething ...) and so on.
#
function (CORSIKA_ADD_EXAMPLE)
cmake_parse_arguments (PARSE_ARGV 1 C8_ADD_EXAMPLE "" "" "SOURCES;RUN_OPTIONS")
set (name ${ARGV0})
if (NOT C8_ADD_EXAMPLE_SOURCES)
set (sources ${name}.cc)
else ()
set (sources ${C8_ADD_EXAMPLE_SOURCES})
endif ()
if (NOT C8_ADD_EXAMPLE_RUN_OPTIONS)
set (run_options "")
else ()
set (run_options ${C8_ADD_EXAMPLE_RUN_OPTIONS})
endif ()
add_executable (${name} ${sources})
target_compile_options (${name} PRIVATE -g) # do not skip asserts
target_include_directories (${name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
file (MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/example_outputs/)
if (TARGET run_examples)
else ()
add_custom_target (run_examples)
endif ()
add_dependencies (run_examples ${name})
add_custom_command (TARGET run_examples
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E echo ""
COMMAND ${CMAKE_COMMAND} -E echo "**************************************"
COMMAND ${CMAKE_COMMAND} -E echo "***** running example: ${name} " ${run_options} VERBATIM
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${name} ${run_options} VERBATIM
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/example_outputs)
install (TARGETS ${name} DESTINATION share/examples)
endfunction (CORSIKA_ADD_EXAMPLE)
CORSIKA_ADD_TEST (helix_example)
CORSIKA_ADD_EXAMPLE (helix_example)
target_link_libraries (helix_example CORSIKAgeometry CORSIKAunits) target_link_libraries (helix_example CORSIKAgeometry CORSIKAunits)
install (TARGETS helix_example DESTINATION share/examples)
CORSIKA_ADD_TEST (particle_list_example) CORSIKA_ADD_EXAMPLE (particle_list_example)
target_link_libraries (particle_list_example CORSIKAparticles CORSIKAunits CORSIKAprocesses ProcessSibyll ProcessQGSJetII) target_link_libraries (particle_list_example CORSIKAparticles CORSIKAunits CORSIKAprocesses ProcessSibyll ProcessQGSJetII)
install (TARGETS particle_list_example DESTINATION share/examples)
CORSIKA_ADD_TEST (geometry_example) CORSIKA_ADD_EXAMPLE (geometry_example)
target_link_libraries (geometry_example CORSIKAgeometry CORSIKAunits) target_link_libraries (geometry_example CORSIKAgeometry CORSIKAunits)
install (TARGETS geometry_example DESTINATION share/examples)
CORSIKA_ADD_TEST (logger_example) CORSIKA_ADD_EXAMPLE (logger_example)
target_link_libraries (logger_example CORSIKAunits CORSIKAlogging) target_link_libraries (logger_example CORSIKAunits CORSIKAlogging)
install (TARGETS logger_example DESTINATION share/examples)
CORSIKA_ADD_TEST (stack_example) CORSIKA_ADD_EXAMPLE (stack_example)
target_link_libraries (stack_example SuperStupidStack CORSIKAunits target_link_libraries (stack_example SuperStupidStack CORSIKAunits
CORSIKAlogging) CORSIKAlogging)
# address sanitizer is making this example too slow, so we only do "undefined" # address sanitizer is making this example too slow, so we only do "undefined"
CORSIKA_ADD_TEST (cascade_example SANITIZE "undefined") CORSIKA_ADD_EXAMPLE (boundary_example)
target_link_libraries (cascade_example target_link_libraries (boundary_example
SuperStupidStack SuperStupidStack
CORSIKAunits CORSIKAunits
CORSIKAlogging CORSIKAlogging
CORSIKArandom CORSIKArandom
ProcessSibyll ProcessSibyll
CORSIKAcascade CORSIKAcascade
ProcessEnergyLoss
ProcessStackInspector
ProcessParticleCut
ProcessTrackWriter ProcessTrackWriter
ProcessParticleCut
ProcessTrackingLine ProcessTrackingLine
CORSIKAprocesses CORSIKAprocesses
CORSIKAcascade
CORSIKAparticles CORSIKAparticles
CORSIKAgeometry CORSIKAgeometry
CORSIKAenvironment CORSIKAenvironment
CORSIKAprocesssequence CORSIKAprocesssequence
) )
install (TARGETS cascade_example DESTINATION share/examples)
CORSIKA_ADD_TEST (boundary_example) CORSIKA_ADD_EXAMPLE (cascade_example)
target_link_libraries (boundary_example target_link_libraries (cascade_example
SuperStupidStack SuperStupidStack
CORSIKAunits CORSIKAunits
CORSIKAlogging CORSIKAlogging
CORSIKArandom CORSIKArandom
ProcessSibyll ProcessSibyll
CORSIKAcascade CORSIKAcascade
ProcessEnergyLoss
ProcessTrackWriter ProcessTrackWriter
ProcessParticleCut ProcessStackInspector
ProcessTrackingLine ProcessTrackingLine
ProcessParticleCut
ProcessHadronicElasticModel
ProcessStackInspector
CORSIKAprocesses CORSIKAprocesses
CORSIKAcascade
CORSIKAparticles CORSIKAparticles
CORSIKAgeometry CORSIKAgeometry
CORSIKAenvironment CORSIKAenvironment
CORSIKAprocesssequence CORSIKAprocesssequence
) )
install (TARGETS boundary_example DESTINATION share/examples)
if (Pythia8_FOUND) if (Pythia8_FOUND)
CORSIKA_ADD_TEST (cascade_proton_example) CORSIKA_ADD_EXAMPLE (cascade_proton_example)
target_link_libraries (cascade_proton_example target_link_libraries (cascade_proton_example
SuperStupidStack SuperStupidStack
CORSIKAunits CORSIKAunits
...@@ -84,9 +81,8 @@ if (Pythia8_FOUND) ...@@ -84,9 +81,8 @@ if (Pythia8_FOUND)
CORSIKAenvironment CORSIKAenvironment
CORSIKAprocesssequence CORSIKAprocesssequence
) )
install (TARGETS cascade_proton_example DESTINATION share/examples)
add_executable(vertical_EAS vertical_EAS.cc) CORSIKA_ADD_EXAMPLE (vertical_EAS RUN_OPTIONS 4 2 10000.)
target_link_libraries (vertical_EAS target_link_libraries (vertical_EAS
SuperStupidStack SuperStupidStack
CORSIKAunits CORSIKAunits
...@@ -99,10 +95,11 @@ if (Pythia8_FOUND) ...@@ -99,10 +95,11 @@ if (Pythia8_FOUND)
CORSIKAcascade CORSIKAcascade
ProcessEnergyLoss ProcessEnergyLoss
ProcessObservationPlane ProcessObservationPlane
ProcessInteractionCounter
ProcessTrackWriter
ProcessTrackingLine ProcessTrackingLine
ProcessParticleCut ProcessParticleCut
ProcessStackInspector ProcessStackInspector
ProcessInteractionCounter
CORSIKAprocesses CORSIKAprocesses
CORSIKAcascade CORSIKAcascade
CORSIKAparticles CORSIKAparticles
...@@ -110,11 +107,9 @@ if (Pythia8_FOUND) ...@@ -110,11 +107,9 @@ if (Pythia8_FOUND)
CORSIKAenvironment CORSIKAenvironment
CORSIKAprocesssequence CORSIKAprocesssequence
) )
install (TARGETS vertical_EAS DESTINATION share/examples)
endif() endif()
CORSIKA_ADD_TEST(stopping_power) CORSIKA_ADD_EXAMPLE (stopping_power stopping_power)
target_link_libraries (stopping_power target_link_libraries (stopping_power
SuperStupidStack SuperStupidStack
CORSIKAunits CORSIKAunits
...@@ -124,10 +119,9 @@ target_link_libraries (stopping_power ...@@ -124,10 +119,9 @@ target_link_libraries (stopping_power
CORSIKAenvironment CORSIKAenvironment
) )
CORSIKA_ADD_TEST (staticsequence_example) CORSIKA_ADD_EXAMPLE (staticsequence_example)
target_link_libraries (staticsequence_example target_link_libraries (staticsequence_example
CORSIKAprocesssequence CORSIKAprocesssequence
CORSIKAunits CORSIKAunits
CORSIKAgeometry CORSIKAgeometry
CORSIKAlogging) CORSIKAlogging)
install (TARGETS staticsequence_example DESTINATION share/examples)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment