IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 61c96a08 authored by ralfulrich's avatar ralfulrich
Browse files

added central macro for adding and configuring unit tests

parent 4a8fc98b
No related branches found
No related tags found
No related merge requests found
Showing
with 33 additions and 92 deletions
image: ubuntu:bionic
variables:
GIT_SSL_NO_VERIFY: "1"
before_script:
- apt-get update --yes
- apt-get install --yes cmake libboost-dev libeigen3-dev python3 gfortran
build:
stage: build
tags:
- run1
script:
- mkdir build
- cd build
- cmake ..
- cmake --build .
- ctest -V
# code_quality:
# image: docker:stable
# variables:
# DOCKER_DRIVER: overlay2
# allow_failure: true
# services:
# - docker:stable-dind
# script:
# - export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
# - docker run
# --env SOURCE_CODE="$PWD"
# --volume "$PWD":/code
# --volume /var/run/docker.sock:/var/run/docker.sock
# "registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
# artifacts:
# reports:
# codequality: gl-code-quality-report.json
......@@ -22,7 +22,13 @@ build:
paths:
- build/test.log.gz
when: on_failure
reports:
junit:
- */junit*.xml
- */*/junit*.xml
- */*/*/junit*.xml
- */*/*/*/junit*.xml
- */*/*/*/*/junit*.xml
# code_quality:
# image: docker:stable
......
......@@ -78,3 +78,13 @@ macro (CORSIKA_ADD_FILES_ABSOLUTE varname)
set ("${varname}" "${${varname}}" PARENT_SCOPE)
endif()
endmacro(CORSIKA_ADD_FILES_ABSOLUTE)
#
# central macro to activate unit tests in cmake
#
function (CORSIKA_ADD_TEST name)
add_test (NAME ${name} COMMAND ${name} -o junit-${name}.xml -r junit)
endfunction (CORSIKA_ADD_TEST)
......@@ -48,6 +48,4 @@ target_link_libraries (
CORSIKAenvironment
CORSIKAthirdparty # for catch2
)
add_test (NAME testGeometry COMMAND testGeometry)
CORSIKA_ADD_TEST(testGeometry)
......@@ -59,8 +59,4 @@ target_link_libraries (
CORSIKAunits
CORSIKAthirdparty # for catch2
)
add_test (
NAME testCascade
COMMAND testCascade
)
CORSIKA_ADD_TEST(testStackInterface)
......@@ -69,5 +69,4 @@ target_link_libraries (
CORSIKAthirdparty # for catch2
)
add_test (NAME testGeometry COMMAND testGeometry)
CORSIKA_ADD_TEST(testGeometry)
......@@ -47,9 +47,5 @@ target_link_libraries (
CORSIKAlogging
CORSIKAthirdparty # for catch2
)
add_test (
NAME testLogging
COMMAND testLogging
)
CORSIKA_ADD_TEST (testLogging)
......@@ -92,11 +92,4 @@ target_link_libraries (
CORSIKAunits
CORSIKAthirdparty # for catch2
)
add_test (
NAME
testParticles
COMMAND
testParticles
)
CORSIKA_ADD_TEST(testParticles)
......@@ -48,8 +48,4 @@ target_link_libraries (
CORSIKAprocesssequence
CORSIKAthirdparty # for catch2
)
add_test (
NAME testProcessSequence
COMMAND testProcessSequence
)
CORSIKA_ADD_TEST(testProcessSequence)
......@@ -45,6 +45,4 @@ target_link_libraries (
CORSIKArandom
CORSIKAthirdparty # for catch2
)
add_test (NAME testRandom COMMAND testRandom)
CORSIKA_ADD_TEST(testRandom)
......@@ -33,5 +33,5 @@ install (
#code testing
add_executable (testStackInterface testStackInterface.cc)
add_test(NAME testStackInterface COMMAND testStackInterface)
target_link_libraries (testStackInterface CORSIKAstackinterface CORSIKAthirdparty) # for catch2
CORSIKA_ADD_TEST(testStackInterface)
......@@ -22,5 +22,4 @@ install (FILES ${CORSIKAunits_HEADERS} DESTINATION include/${CORSIKAunits_NAMESP
# code testing
add_executable (testUnits testUnits.cc)
target_link_libraries (testUnits CORSIKAunits CORSIKAthirdparty) # for catch2
add_test(NAME testUnits COMMAND testUnits)
CORSIKA_ADD_TEST(testUnits)
......@@ -58,6 +58,5 @@ target_link_libraries (
CORSIKAutilities
CORSIKAthirdparty # for catch2
)
add_test (NAME testCOMBoost COMMAND testCOMBoost)
CORSIKA_ADD_TEST(testCOMBoost)
......@@ -60,6 +60,4 @@ target_link_libraries (
CORSIKAunits
CORSIKAthirdparty # for catch2
)
add_test (NAME testNullModel COMMAND testNullModel)
CORSIKA_ADD_TEST(testNullModel)
......@@ -101,6 +101,4 @@ target_link_libraries (
CORSIKAunits
CORSIKAthirdparty # for catch2
)
add_test (NAME testSibyll COMMAND testSibyll)
CORSIKA_ADD_TEST(testSibyll)
......@@ -60,6 +60,4 @@ target_link_libraries (
CORSIKAunits
CORSIKAthirdparty # for catch2
)
add_test (NAME testStackInspector COMMAND testStackInspector)
CORSIKA_ADD_TEST(testStackInspector)
......@@ -60,6 +60,5 @@ install (
# CORSIKAunits
# CORSIKAthirdparty # for catch2
# )
#add_test (NAME testNullModel COMMAND testNullModel)
# CORSIKA_ADD_TEST(testNullModel)
......@@ -37,5 +37,4 @@ target_link_libraries (
CORSIKAgeometry
CORSIKAthirdparty # for catch2
)
add_test (NAME testTrackingLine COMMAND testTrackingLine)
CORSIKA_ADD_TEST(testTrackingLine)
......@@ -44,8 +44,4 @@ target_link_libraries (
CORSIKAunits
CORSIKAthirdparty # for catch2
)
add_test (
NAME testSuperStupidStack
COMMAND testSuperStupidStack
)
CORSIKA_ADD_TEST(testSuperStupidStack)
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