Skip to content

Commit

Permalink
Merge branch 'sanitizer-preset' into 'master'
Browse files Browse the repository at this point in the history
[ci] Add preset and fix sanitizer

See merge request ogs/ogs!4978
  • Loading branch information
endJunction committed Apr 17, 2024
2 parents b561871 + d57b3ef commit 1f2a4c5
Show file tree
Hide file tree
Showing 15 changed files with 159 additions and 103 deletions.
7 changes: 5 additions & 2 deletions Applications/ApplicationsLib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ ogs_add_library(ApplicationsLib ${LIB_SOURCES})

target_link_libraries(
ApplicationsLib
PUBLIC BaseLib GeoLib NumLib
$<$<TARGET_EXISTS:VTK::ParallelMPI>:VTK::ParallelMPI>
PUBLIC
BaseLib
GeoLib
NumLib
$<$<AND:$<BOOL:${OGS_USE_PETSC}>,$<TARGET_EXISTS:VTK::ParallelMPI>>:VTK::ParallelMPI>
PRIVATE CMakeInfoLib
MathLib
MeshLib
Expand Down
22 changes: 11 additions & 11 deletions Applications/CLI/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,17 @@ ogs_add_executable(ogs ogs.cpp CommandLineArgumentParser.cpp)

target_link_libraries(
ogs
PRIVATE ApplicationsLib
BaseLib
CMakeInfoLib
GitInfoLib
MeshLib
ProcessLib
$<$<TARGET_EXISTS:MPI::MPI_CXX>:MPI::MPI_CXX>
$<$<TARGET_EXISTS:InSituLib>:InSituLib>
$<$<TARGET_EXISTS:petsc>:petsc>
$<$<TARGET_EXISTS:VTK::ParallelMPI>:VTK::ParallelMPI>
tclap
PRIVATE
ApplicationsLib
BaseLib
CMakeInfoLib
GitInfoLib
MeshLib
ProcessLib
$<$<AND:$<BOOL:${OGS_USE_PETSC}>,$<TARGET_EXISTS:MPI::MPI_CXX>>:MPI::MPI_CXX>
$<$<TARGET_EXISTS:InSituLib>:InSituLib>
$<$<TARGET_EXISTS:petsc>:petsc>
tclap
)

# ---- Tests ----
Expand Down
10 changes: 8 additions & 2 deletions Applications/Utils/ModelPreparation/PartitionMesh/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@ if(OGS_USE_MPI)
binaryToPVTU BinaryToPVTU.cpp NodeWiseMeshPartitioner.cpp
)
target_link_libraries(
binaryToPVTU GitInfoLib ProcessLib MeshLib MeshToolsLib tclap
$<$<TARGET_EXISTS:MPI::MPI_CXX>:MPI::MPI_CXX> VTK::ParallelMPI
binaryToPVTU
GitInfoLib
ProcessLib
MeshLib
MeshToolsLib
tclap
$<$<AND:$<BOOL:${OGS_USE_PETSC}>,$<TARGET_EXISTS:MPI::MPI_CXX>>:MPI::MPI_CXX>
$<$<AND:$<BOOL:${OGS_USE_PETSC}>,$<TARGET_EXISTS:VTK::ParallelMPI>>:VTK::ParallelMPI>
)
install(TARGETS binaryToPVTU RUNTIME DESTINATION bin)
endif()
Expand Down
35 changes: 35 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,27 @@
"OGS_USE_MFRONT": "ON",
"BUILD_SHARED_LIBS": "ON"
}
},
{
"name": "sanitizer",
"inherits": "debug-all",
"cacheVariables": {
"BUILD_SHARED_LIBS": "ON",
"OGS_CXX_FLAGS": "-O3;-fno-var-tracking",
"OGS_EIGEN_DYNAMIC_SHAPE_MATRICES": "OFF",
"ENABLE_ASAN": "ON",
"ENABLE_UBSAN": "ON",
"ENABLE_LSAN": "ON",
"OGS_BUILD_TFEL": "ON",
"OGS_BUILD_VTK": "ON",
"OGS_BUILD_HDF5": "ON"
},
"environment": {
"CC": "clang",
"CXX": "clang++",
"UBSAN_OPTIONS": "print_stacktrace=1",
"LSAN_OPTIONS": "suppressions=${sourceDir}/scripts/test/leak_sanitizer.suppressions"
}
}
],
"buildPresets": [
Expand Down Expand Up @@ -314,6 +335,10 @@
{
"name": "wheel",
"configurePreset": "wheel"
},
{
"name": "sanitizer",
"configurePreset": "sanitizer"
}
],
"testPresets": [
Expand All @@ -326,6 +351,9 @@
"filter": {
"include": {
"label": "default"
},
"exclude": {
"name": "nb-"
}
},
"execution": {
Expand Down Expand Up @@ -403,6 +431,13 @@
"inherits": [
"release"
]
},
{
"name": "sanitizer",
"configurePreset": "sanitizer",
"inherits": [
"release"
]
}
]
}
27 changes: 14 additions & 13 deletions MeshLib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,19 @@ ogs_add_library(MeshLib ${SOURCES})

target_link_libraries(
MeshLib
PUBLIC BaseLib
GeoLib
GitInfoLib
${HDF5_LIBRARIES}
MathLib
VTK::IOXML
VTK::IOLegacy
range-v3
$<$<TARGET_EXISTS:VTK::IOParallelXML>:VTK::IOParallelXML>
$<$<TARGET_EXISTS:VTK::ParallelMPI>:VTK::ParallelMPI>
$<$<TARGET_EXISTS:MPI::MPI_CXX>:MPI::MPI_CXX>
$<$<TARGET_EXISTS:petsc>:petsc>
PUBLIC
BaseLib
GeoLib
GitInfoLib
${HDF5_LIBRARIES}
MathLib
VTK::IOXML
VTK::IOLegacy
range-v3
$<$<AND:$<BOOL:${OGS_USE_PETSC}>,$<TARGET_EXISTS:VTK::IOParallelXML>>:VTK::IOParallelXML>
$<$<AND:$<BOOL:${OGS_USE_PETSC}>,$<TARGET_EXISTS:VTK::ParallelMPI>>:VTK::ParallelMPI>
$<$<AND:$<BOOL:${OGS_USE_PETSC}>,$<TARGET_EXISTS:MPI::MPI_CXX>>:MPI::MPI_CXX>
$<$<TARGET_EXISTS:petsc>:petsc>
PRIVATE nlohmann_json::nlohmann_json
)

Expand All @@ -54,7 +55,7 @@ target_include_directories(MeshLib PUBLIC ${HDF5_INCLUDE_DIRS})
target_compile_definitions(
MeshLib
PUBLIC
$<$<AND:$<BOOL:$ENV{VTK_USE_64BIT_IDS}>,$<NOT:$<BOOL:VTK_ADDED>>>:VTK_USE_64BIT_IDS>
$<$<AND:$<BOOL:$ENV{VTK_USE_64BIT_IDS}>,$<NOT:$<BOOL:${VTK_ADDED}>>>:VTK_USE_64BIT_IDS>
)

target_precompile_headers(
Expand Down
30 changes: 19 additions & 11 deletions MeshToolsLib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,24 @@ append_source_files(SOURCES MeshQuality)
ogs_add_library(MeshToolsLib ${SOURCES})

target_link_libraries(
MeshToolsLib PUBLIC GeoLib
MeshLib
range-v3
VTK::IOXML
VTK::IOLegacy
$<$<TARGET_EXISTS:VTK::IOParallelXML>:VTK::IOParallelXML>
$<$<TARGET_EXISTS:VTK::ParallelMPI>:VTK::ParallelMPI>
PRIVATE BaseLib MathLib NumLib GitInfoLib
MeshToolsLib
PUBLIC
GeoLib
MeshLib
range-v3
VTK::IOXML
VTK::IOLegacy
$<$<AND:$<BOOL:${OGS_USE_PETSC}>,$<TARGET_EXISTS:VTK::IOParallelXML>>:VTK::IOParallelXML>
$<$<AND:$<BOOL:${OGS_USE_PETSC}>,$<TARGET_EXISTS:VTK::ParallelMPI>>:VTK::ParallelMPI>
PRIVATE BaseLib MathLib NumLib GitInfoLib
)

target_precompile_headers(MeshToolsLib PRIVATE [["BaseLib/Error.h"]]
[["BaseLib/ConfigTree.h"]] [["BaseLib/Logging.h"]] [["MeshLib/Mesh.h"]]
[["MeshLib/Elements/Element.h"]])
target_precompile_headers(
MeshToolsLib
PRIVATE
[["BaseLib/Error.h"]]
[["BaseLib/ConfigTree.h"]]
[["BaseLib/Logging.h"]]
[["MeshLib/Mesh.h"]]
[["MeshLib/Elements/Element.h"]]
)
59 changes: 29 additions & 30 deletions Tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,40 +85,39 @@ endif()

ogs_add_executable(testrunner ${TEST_SOURCES})

target_sources(testrunner
PRIVATE
ProcessLib/Graph/TestGet.cpp
ProcessLib/Graph/TestApply.cpp
target_sources(
testrunner PRIVATE ProcessLib/Graph/TestGet.cpp
ProcessLib/Graph/TestApply.cpp
)

target_link_libraries(
testrunner
PRIVATE $<$<NOT:$<BOOL:${OGS_BUILD_WHEEL}>>:ApplicationsLib>
ApplicationsFileIO
autocheck
gmock
gtest
MeshToolsLib
MeshGeoToolsLib
MaterialLib
MathLib
MeshLib
MeshToolsLib
NumLib
ParameterLib
$<$<NOT:$<BOOL:${OGS_BUILD_WHEEL}>>:ProcessLib>
$<$<NOT:$<BOOL:${OGS_BUILD_WHEEL}>>:Processes>
TestInfoLib
VTK::FiltersGeneral
VTK::FiltersSources
Boost::boost # TODO move OGSMFrontThermodynamicForcesView to
# MathLib?
$<$<TARGET_EXISTS:LIE>:LIE>
$<$<TARGET_EXISTS:TH2M>:TH2M>
$<$<TARGET_EXISTS:MPI::MPI_CXX>:MPI::MPI_CXX>
$<$<TARGET_EXISTS:SwmmInterface>:SwmmInterface>
$<$<TARGET_EXISTS:InSituLib>:InSituLib>
$<$<TARGET_EXISTS:petsc>:petsc>
PRIVATE
$<$<NOT:$<BOOL:${OGS_BUILD_WHEEL}>>:ApplicationsLib>
ApplicationsFileIO
autocheck
gmock
gtest
MeshToolsLib
MeshGeoToolsLib
MaterialLib
MathLib
MeshLib
MeshToolsLib
NumLib
ParameterLib
$<$<NOT:$<BOOL:${OGS_BUILD_WHEEL}>>:ProcessLib>
$<$<NOT:$<BOOL:${OGS_BUILD_WHEEL}>>:Processes>
TestInfoLib
VTK::FiltersGeneral
VTK::FiltersSources
Boost::boost # TODO move OGSMFrontThermodynamicForcesView to MathLib?
$<$<TARGET_EXISTS:LIE>:LIE>
$<$<TARGET_EXISTS:TH2M>:TH2M>
$<$<AND:$<BOOL:${OGS_USE_PETSC}>,$<TARGET_EXISTS:MPI::MPI_CXX>>:MPI::MPI_CXX>
$<$<TARGET_EXISTS:SwmmInterface>:SwmmInterface>
$<$<TARGET_EXISTS:InSituLib>:InSituLib>
$<$<TARGET_EXISTS:petsc>:petsc>
PUBLIC $<$<BOOL:${OGS_USE_MFRONT}>:OgsMFrontBehaviourForUnitTests>
)

Expand Down
2 changes: 1 addition & 1 deletion scripts/ci/jobs/build-docs.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
build docs:
stage: build
needs: [meta]
tags: [shell, envinf23]
tags: [shell, envinf]
timeout: 30 minutes
variables:
DOX_WARNINGS_THRESHOLD: 18
Expand Down
2 changes: 1 addition & 1 deletion scripts/ci/jobs/build-linux-arch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ build linux arch:
extends:
- .template-build-linux
- .test-artifacts
tags: [shell, envinf23]
tags: [shell, envinf]
needs: [meta]
timeout: 3h
variables:
Expand Down
24 changes: 6 additions & 18 deletions scripts/ci/jobs/build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ linux ctest large:
extends:
- .template-build-linux
- .test-artifacts
tags: [shell, envinf23]
tags: [shell, envinf]
needs: [meta]
rules:
- when: manual
Expand All @@ -26,6 +26,7 @@ build linux (no unity):
needs: [meta]
timeout: 3h
variables:
BUILD_PACKAGE: "false"
BUILD_TESTS: "false"
BUILD_CTEST: "false"
CHECK_WARNINGS: "true"
Expand All @@ -46,27 +47,14 @@ build linux debug with sanitizers:
extends:
- .template-build-linux
- .test-artifacts
tags: [envinf23, shell]
tags: [envinf, shell]
needs: [meta]
variables:
BUILD_PACKAGE: "false"
CMAKE_PRESET: debug
CMAKE_PRESET: sanitizer
CMAKE_ARGS: >-
-DCMAKE_C_COMPILER=/usr/bin/clang
-DCMAKE_CXX_COMPILER=/usr/bin/clang++
-DBUILD_SHARED_LIBS=ON
-DOGS_CXX_FLAGS=-O3;-fno-var-tracking
-DOGS_EIGEN_DYNAMIC_SHAPE_MATRICES=OFF
-DENABLE_ASAN=ON
-DENABLE_UBSAN=ON
-DENABLE_LSAN=ON
-DOGS_CTEST_MAX_RUNTIME=5
-DOGS_USE_PIP=ON
-DOGS_USE_MFRONT=ON
-DOGS_BUILD_TFEL=ON
UBSAN_OPTIONS: "print_stacktrace=1"
LSAN_OPTIONS: "suppressions=$CI_PROJECT_DIR/scripts/test/leak_sanitizer.suppressions"
CTEST_TIMEOUT: 120
-DOGS_CTEST_MAX_RUNTIME=60
-DOGS_BUILD_PROCESSES=SteadyStateDiffusion
build linux ubuntu perf:
extends:
Expand Down
2 changes: 1 addition & 1 deletion scripts/ci/jobs/code-coverage.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
code coverage:
stage: check
tags: [shell, envinf23]
tags: [shell, envinf]
needs: [meta]
variables:
CMAKE_PRESET: coverage
Expand Down
1 change: 0 additions & 1 deletion scripts/ci/jobs/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ ruff:
# Disabled, see !3053
.code_quality:
stage: check
tags: [envinf1]
needs: []
rules:
variables:
Expand Down
7 changes: 1 addition & 6 deletions scripts/ci/jobs/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@ create cpm cache:
- if: $CI_COMMIT_TITLE == "[versions] Updated cpm cache info."
when: never
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes:
- scripts/cmake/CMakeSetup.cmake
- scripts/cmake/Dependencies.cmake
- scripts/ci/jobs/package.yml
- scripts/cmake/ExternalDependencies.cmake
- web/data/versions.json
when: manual
variables:
BUILD_DIR: "$CI_PROJECT_DIR/../build/cpm"
allow_failure:
Expand Down
2 changes: 1 addition & 1 deletion scripts/cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ if((OGS_BUILD_TESTING OR OGS_BUILD_UTILS) AND NOT GUIX_BUILD)
NAME xdmf
VERSION 3.0.0
GIT_REPOSITORY https://gitlab.opengeosys.org/ogs/xdmflib.git
GIT_TAG 92a851f1acb87ad5367eb62f9b97785bedb700bb
GIT_TAG 374ee63abf605ab4c6639989bebc5096881f4f57
OPTIONS "XDMF_LIBNAME OgsXdmf" "CMAKE_MACOSX_RPATH ON"
"HDF5_C_INCLUDE_DIR ${HDF5_INCLUDE_DIRS}"
EXCLUDE_FROM_ALL YES SYSTEM TRUE
Expand Down
Loading

0 comments on commit 1f2a4c5

Please sign in to comment.