Skip to content

Commit

Permalink
Only disable stability tests for inplace_merge, check libc++ version …
Browse files Browse the repository at this point in the history
…in cmake config test
  • Loading branch information
msimberg committed Dec 19, 2017
1 parent 3603ec8 commit 980c3b2
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 2 deletions.
7 changes: 7 additions & 0 deletions CMakeLists.txt
Expand Up @@ -1184,6 +1184,13 @@ endif()
hpx_check_for_mm_prefetch(
DEFINITIONS HPX_HAVE_MM_PREFETCH)

hpx_check_for_stable_inplace_merge(
DEFINITIONS HPX_HAVE_STABLE_INPLACE_MERGE)

if(NOT HPX_WITH_STABLE_INPLACE_MERGE)
hpx_warn("The standard library you are using (libc++ version < 6) does not have a stable inplace_merge implementation.")
endif()

################################################################################
# Check for misc system headers
################################################################################
Expand Down
7 changes: 7 additions & 0 deletions cmake/HPX_AddConfigTest.cmake
Expand Up @@ -656,3 +656,10 @@ macro(hpx_check_for_mm_prefetch)
SOURCE cmake/tests/mm_prefetch.cpp
FILE ${ARGN})
endmacro()

###############################################################################
macro(hpx_check_for_stable_inplace_merge)
add_hpx_config_test(HPX_WITH_STABLE_INPLACE_MERGE
SOURCE cmake/tests/stable_inplace_merge.cpp
FILE ${ARGN})
endmacro()
15 changes: 15 additions & 0 deletions cmake/tests/stable_inplace_merge.cpp
@@ -0,0 +1,15 @@
////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2017 Mikael Simberg
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
////////////////////////////////////////////////////////////////////////////////

#if defined(_LIBCPP_VERSION) && (_LIBCPP_VERSION < 6)
# error "libc++ inplace_merge implementation is broken"
#endif

int main()
{
return 0;
}
2 changes: 0 additions & 2 deletions tests/unit/parallel/algorithms/inplace_merge.cpp
Expand Up @@ -47,11 +47,9 @@ int hpx_main(boost::program_options::variables_map& vm)
std::cout << "using seed: " << seed << std::endl;
std::srand(seed);

#if !defined(_LIBCPP_VERSION) || (_LIBCPP_VERSION >= 6)
inplace_merge_test();
inplace_merge_exception_test();
inplace_merge_bad_alloc_test();
#endif

std::cout << "Test Finish!" << std::endl;

Expand Down
4 changes: 4 additions & 0 deletions tests/unit/parallel/algorithms/inplace_merge_tests.hpp
Expand Up @@ -415,6 +415,7 @@ void test_inplace_merge_etc(ExPolicy policy, IteratorTag,

// Test projection.
{
#if defined(HPX_HAVE_STABLE_INPLACE_MERGE)
typedef test::test_iterator<base_iterator, IteratorTag> iterator;

sol = res = org;
Expand All @@ -436,6 +437,7 @@ void test_inplace_merge_etc(ExPolicy policy, IteratorTag,
sol_first, sol_last);

HPX_TEST(equality);
#endif
}
}

Expand All @@ -444,6 +446,7 @@ template <typename ExPolicy, typename IteratorTag, typename DataType>
void test_inplace_merge_stable(ExPolicy policy, IteratorTag,
DataType, int rand_base)
{
#if defined(HPX_HAVE_STABLE_INPLACE_MERGE)
static_assert(
hpx::parallel::execution::is_execution_policy<ExPolicy>::value,
"hpx::parallel::execution::is_execution_policy<ExPolicy>::value");
Expand Down Expand Up @@ -501,6 +504,7 @@ void test_inplace_merge_stable(ExPolicy policy, IteratorTag,

HPX_TEST(test_is_meaningful);
HPX_TEST(stable);
#endif
}

///////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 980c3b2

Please sign in to comment.