diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1cda00fce54beca02ff95af8ae262a26c3142533..5c7bc78b1c2d5c68b3811cd9b7ed1751eb2eedcc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -33,7 +33,24 @@ stages: - mkdir $CI_PROJECT_DIR/build - cd $CI_PROJECT_DIR/build - if dpkg --compare-versions `ompi_info | head -2 | tail -1 | sed 's/[^0-9.]*\([0-9.]*\).*/\1/'` ge 1.10; then export MPIEXEC_PREFLAGS="--allow-run-as-root" ; fi - - cmake .. -DWALBERLA_BUFFER_DEBUG=$WALBERLA_BUFFER_DEBUG -DWALBERLA_BUILD_TESTS=ON -DWALBERLA_BUILD_BENCHMARKS=ON -DWALBERLA_BUILD_TUTORIALS=ON -DWALBERLA_BUILD_TOOLS=ON -DWALBERLA_BUILD_WITH_MPI=$WALBERLA_BUILD_WITH_MPI -DWALBERLA_BUILD_WITH_CUDA=$WALBERLA_BUILD_WITH_CUDA -DWALBERLA_BUILD_WITH_PYTHON=$WALBERLA_BUILD_WITH_PYTHON -DWALBERLA_BUILD_WITH_OPENMP=$WALBERLA_BUILD_WITH_OPENMP -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -DMPIEXEC_PREFLAGS=$MPIEXEC_PREFLAGS -DWALBERLA_DOUBLE_ACCURACY=$WALBERLA_DOUBLE_ACCURACY -DWARNING_ERROR=ON -DWALBERLA_BUILD_WITH_METIS=$WALBERLA_BUILD_WITH_METIS -DWALBERLA_BUILD_WITH_PARMETIS=$WALBERLA_BUILD_WITH_PARMETIS -DWALBERLA_ENABLE_GUI=$WALBERLA_ENABLE_GUI -DWALBERLA_BUILD_WITH_CODEGEN=$WALBERLA_BUILD_WITH_CODEGEN + - cmake .. + -DWALBERLA_BUFFER_DEBUG=$WALBERLA_BUFFER_DEBUG + -DWALBERLA_BUILD_TESTS=ON + -DWALBERLA_BUILD_BENCHMARKS=ON + -DWALBERLA_BUILD_TUTORIALS=ON + -DWALBERLA_BUILD_TOOLS=ON + -DWALBERLA_BUILD_WITH_MPI=$WALBERLA_BUILD_WITH_MPI + -DWALBERLA_BUILD_WITH_CUDA=$WALBERLA_BUILD_WITH_CUDA + -DWALBERLA_BUILD_WITH_PYTHON=$WALBERLA_BUILD_WITH_PYTHON + -DWALBERLA_BUILD_WITH_OPENMP=$WALBERLA_BUILD_WITH_OPENMP + -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -DMPIEXEC_PREFLAGS=$MPIEXEC_PREFLAGS + -DWALBERLA_DOUBLE_ACCURACY=$WALBERLA_DOUBLE_ACCURACY + -DWARNING_ERROR=ON + -DWALBERLA_BUILD_WITH_METIS=$WALBERLA_BUILD_WITH_METIS + -DWALBERLA_BUILD_WITH_PARMETIS=$WALBERLA_BUILD_WITH_PARMETIS + -DWALBERLA_ENABLE_GUI=$WALBERLA_ENABLE_GUI + -DWALBERLA_BUILD_WITH_CODEGEN=$WALBERLA_BUILD_WITH_CODEGEN + -DWALBERLA_STL_BOUNDS_CHECKS=$WALBERLA_STL_BOUNDS_CHECKS - cmake . -LAH - make -j $NUM_BUILD_CORES -l $NUM_CORES - ctest -LE $CTEST_EXCLUDE_LABELS -C $CMAKE_BUILD_TYPE --output-on-failure -j $NUM_CORES @@ -1878,9 +1895,9 @@ gcc_8_hybrid_dbg_noboost: ## ## ############################################################################### -gcc_9_stl_debug: +gcc_10_stl_debug: extends: .build_template - image: i10git.cs.fau.de:5005/walberla/buildenvs/gcc:9 + image: i10git.cs.fau.de:5005/walberla/buildenvs/gcc-debug-stl:10 before_script: - rm -rf /opt/boost /usr/include/boost variables: @@ -1896,11 +1913,13 @@ gcc_9_stl_debug: WALBERLA_BUILD_WITH_METIS: "OFF" WALBERLA_BUILD_WITH_PARMETIS: "OFF" WALBERLA_BUILD_WITH_PYTHON: "OFF" - only: - variables: - - $ENABLE_NIGHTLY_BUILDS + WALBERLA_STL_BOUNDS_CHECKS: "ON" tags: - docker + stage: merge_request + when: manual + needs: [ ] + allow_failure: false diff --git a/CMakeLists.txt b/CMakeLists.txt index 1abce07601403f398cf5c697ff2b85bcf22d5f21..f14628bdb94f664ae824a9234e38d4b09a4be444 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -373,6 +373,7 @@ endif ( ) if( WALBERLA_CXX_COMPILER_IS_GNU OR WALBERLA_CXX_COMPILER_IS_INTEL OR WALBERLA_CXX_COMPILER_IS_CLANG ) if ( WALBERLA_STL_BOUNDS_CHECKS ) add_definitions ( "-D_GLIBCXX_DEBUG" ) + add_definitions ( "-D_LIBCPP_DEBUG=1" ) endif() endif() diff --git a/src/waLBerlaDefinitions.in.h b/src/waLBerlaDefinitions.in.h index 496f223b731285a7fe942d29598fe84324c15e3f..21d1dd6d3ff0bb989e7fe75f367ddf6b3a4eea3a 100644 --- a/src/waLBerlaDefinitions.in.h +++ b/src/waLBerlaDefinitions.in.h @@ -41,6 +41,8 @@ #cmakedefine WALBERLA_THREAD_SAFE_LOGGING +#cmakedefine WALBERLA_STL_BOUNDS_CHECKS + // Compiler #cmakedefine WALBERLA_CXX_COMPILER_IS_GNU #cmakedefine WALBERLA_CXX_COMPILER_IS_INTEL diff --git a/tests/core/CMakeLists.txt b/tests/core/CMakeLists.txt index 72b8e4537f2c9b7fa1e4c0dfc4bf89db6db682cb..caf28285c22e8c11dc3f71ffed380426cd76c319 100644 --- a/tests/core/CMakeLists.txt +++ b/tests/core/CMakeLists.txt @@ -188,6 +188,10 @@ waLBerla_execute_test( NAME ConcatIterator ) waLBerla_compile_test( FILES DataTypesTest.cpp ) waLBerla_execute_test( NAME DataTypesTest ) +waLBerla_compile_test( FILES DebugSTLTest.cpp ) +waLBerla_execute_test( NAME DebugSTLTest ) +set_tests_properties(DebugSTLTest PROPERTIES WILL_FAIL TRUE) + waLBerla_compile_test( FILES FunctionTraitsTest.cpp ) waLBerla_execute_test( NAME FunctionTraitsTest ) diff --git a/tests/core/DebugSTLTest.cpp b/tests/core/DebugSTLTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..173be59a14acbdd99e2bbf828888155db54a51f9 --- /dev/null +++ b/tests/core/DebugSTLTest.cpp @@ -0,0 +1,37 @@ +//====================================================================================================================== +// +// This file is part of waLBerla. waLBerla is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// waLBerla is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file GridGeneratorTest.cpp +//! \author Dominik Thoennes <dominik.thoennes@fau.de> +// +//====================================================================================================================== + +#include <cstdlib> +#include <vector> + +#include "waLBerlaDefinitions.h" + +// this test is expected to fail +int main(int /*argc*/, char** /*argv*/) +{ + int ret = EXIT_FAILURE; +#ifdef WALBERLA_STL_BOUNDS_CHECKS + std::vector< int > a(100); + // this throws an exception if the debug STL is used + // otherwise main will return 0 and the test fails since it is expected to fail + if (a[200] != 1337) { ret = EXIT_SUCCESS; } +#endif + return ret; +} \ No newline at end of file