Skip to content

Commit

Permalink
Disable death tests in release
Browse files Browse the repository at this point in the history
The preconditions are actually not triggered in release mode
  • Loading branch information
crtrott committed May 3, 2024
1 parent ffe7c27 commit 10a8060
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/test_alternate_precondition_violation_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
#include <mdspan/mdspan.hpp>
#include <gtest/gtest.h>

#if !MDSPAN_IMPL_SKIP_PRECONDITION_VIOLATION_HANDLER
TEST(mdspan_macros, alternate_precondition_violation_handler)
{
ASSERT_THROW(MDSPAN_IMPL_PRECONDITION(false), std::logic_error);
}
#endif

TEST(mdspan_macros, alternate_precondition_check_constexpr_invocable)
{
Expand Down
2 changes: 2 additions & 0 deletions tests/test_layout_ctors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ TEST(TestLayoutLeftListInitialization, test_layout_left_extent_initialization) {
ASSERT_TRUE(m.is_exhaustive());
}

#if !MDSPAN_IMPL_SKIP_PRECONDITION_VIOLATION_HANDLER
TEST(TestConvertingConstructionFromLayoutStride, precondition_failure) {
using E = Kokkos::extents<size_t, 2, 2>;

Expand All @@ -210,6 +211,7 @@ TEST(TestConvertingConstructionFromLayoutStride, precondition_failure) {
ASSERT_DEATH(Kokkos::layout_left::mapping<E>{stride}, "invalid strides");
ASSERT_DEATH(Kokkos::layout_right::mapping<E>{stride}, "invalid strides");
}
#endif

// FIXME: CUDA NVCC including 12.0 does not like CTAD on nested classes
#if defined(_MDSPAN_USE_CLASS_TEMPLATE_ARGUMENT_DEDUCTION) && !defined(__NVCC__)
Expand Down
2 changes: 2 additions & 0 deletions tests/test_macros.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
#include <mdspan/mdspan.hpp>
#include <gtest/gtest.h>

#if !MDSPAN_IMPL_SKIP_PRECONDITION_VIOLATION_HANDLER
TEST(mdspan_macros, precondition_violation)
{
constexpr auto msg = "hello, world!";

ASSERT_DEATH(MDSPAN_IMPL_PRECONDITION(false and "hello, world!"), msg);
}
#endif

TEST(mdspan_macros, precondition_check_constexpr_invocable)
{
Expand Down

0 comments on commit 10a8060

Please sign in to comment.