diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 37dadbe..fcacc00 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -423,3 +423,73 @@ jobs: - name: Test run: ..\..\..\b2 --hash cxxstd=${{ matrix.standard }} toolset=msvc-14.2 define=CI_SUPPRESS_KNOWN_ISSUES cxxflags=-clr asynch-exceptions=on working-directory: ../boost-root/libs/type_traits/test + ubuntu-cuda: + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + matrix: + standard: [ 11, 14, 17 ] + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: '0' + - uses: Jimver/cuda-toolkit@v0.2.4 + - uses: mstachniuk/ci-skip@v1 + with: + commit-filter: '[skip ci];[ci skip];[CI SKIP];[SKIP CI];***CI SKIP***;***SKIP CI***;[windows];[Windows];[WINDOWS];[apple];[Apple];[APPLE]' + commit-filter-separator: ';' + fail-fast: true + - name: Add repository + continue-on-error: true + id: addrepo + run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test" + - name: Retry Add Repo + continue-on-error: true + id: retry1 + if: steps.addrepo.outcome=='failure' + run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test" + - name: Retry Add Repo 2 + continue-on-error: true + id: retry2 + if: steps.retry1.outcome=='failure' + run: sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test" + - name: Install packages + run: sudo apt install clang-10 + - name: Checkout main boost + run: git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root + - name: Update tools/boostdep + run: git submodule update --init tools/boostdep + working-directory: ../boost-root + - name: Copy files + run: cp -r $GITHUB_WORKSPACE/* libs/type_traits + working-directory: ../boost-root + - name: Install deps + run: python tools/boostdep/depinst/depinst.py type_traits + working-directory: ../boost-root + - name: Bootstrap + run: ./bootstrap.sh + working-directory: ../boost-root + - name: Generate headers + run: ./b2 headers + working-directory: ../boost-root + - name: nvcc version + run: nvcc --version + working-directory: ../boost-root/libs/config/test + - name: Testing nvcc + run: for file in $(cat cuda_tests.txt); do echo "testing $file.cpp" && nvcc -std=c++${{ matrix.standard }} -I../../.. -c -DTEST_VIA_STATIC_ASSERT $file.cpp || break -1; done + working-directory: ../boost-root/libs/type_traits/test + - name: Testing nvcc+clang + run: for file in $(cat cuda_tests.txt); do echo "testing $file.cpp" && nvcc --compiler-bindir=clang++ -std=c++${{ matrix.standard }} -I../../.. -c -DTEST_VIA_STATIC_ASSERT $file.cpp || break -1; done + working-directory: ../boost-root/libs/type_traits/test + - name: Create .cu files + run: for file in $(cat cuda_tests.txt); do cp $file.cpp $file.cu; done + working-directory: ../boost-root/libs/type_traits/test + - name: Testing nvcc on .cu files + run: for file in $(cat cuda_tests.txt); do echo "testing $file.cu" && nvcc -std=c++${{ matrix.standard }} -I../../.. -c -DTEST_VIA_STATIC_ASSERT $file.cu || break -1; done + working-directory: ../boost-root/libs/type_traits/test + - name: Testing nvcc+clang on .cu files + run: for file in $(cat cuda_tests.txt); do echo "testing $file.cu" && nvcc --compiler-bindir=clang++ -std=c++${{ matrix.standard }} -I../../.. -c -DTEST_VIA_STATIC_ASSERT $file.cu || break -1; done + working-directory: ../boost-root/libs/type_traits/test + - name: Testing clang on .cu files + run: for file in $(cat cuda_tests.txt); do echo "testing $file.cu" && clang++ -nocudalib --no-cuda-version-check --cuda-gpu-arch=sm_75 -std=c++${{ matrix.standard }} -I../../.. -c -DTEST_VIA_STATIC_ASSERT $file.cu || break -1; done + working-directory: ../boost-root/libs/type_traits/test diff --git a/test/check_integral_constant.hpp b/test/check_integral_constant.hpp index a21b6c5..5dd70da 100644 --- a/test/check_integral_constant.hpp +++ b/test/check_integral_constant.hpp @@ -9,6 +9,13 @@ #include "test.hpp" +#ifdef TEST_VIA_STATIC_ASSERT + +#define BOOST_CHECK_INTEGRAL_CONSTANT(expression, expected_value) static_assert(expression == expected_value, BOOST_STRINGIZE(expression) " == " BOOST_STRINGIZE(expected_value)) +#define BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(expression, expected_value, other_value) + +#else + namespace boost{ namespace detail{ @@ -70,6 +77,7 @@ namespace boost{ }//detail }//boost +#endif #endif diff --git a/test/check_type.hpp b/test/check_type.hpp index cc539b0..8cbd385 100644 --- a/test/check_type.hpp +++ b/test/check_type.hpp @@ -22,6 +22,15 @@ expected_value: the type we expect to find. #pragma option -w-8008 -w-8066 -w-8019 #endif +#ifdef TEST_VIA_STATIC_ASSERT + +#define BOOST_CHECK_TYPE(type_expression, expected_type) static_assert(::boost::is_same< type_expression, expected_type >::value, BOOST_STRINGIZE(type_expression) " == " BOOST_STRINGIZE(expected_type)) + +#define BOOST_CHECK_TYPE3(type_expression, type_expression_suffix, expected_type) static_assert(::boost::is_same< type_expression, type_expression_suffix, expected_type >::value, BOOST_STRINGIZE(type_expression) "," BOOST_STRINGIZE(type_expression_suffix) " == " BOOST_STRINGIZE(expected_type)) + +#define BOOST_CHECK_TYPE4(type_expression, suffix1, suffix2, expected_type) static_assert(::boost::is_same< type_expression, suffix1, suffix2, expected_type >::value, BOOST_STRINGIZE(type_expression) "," BOOST_STRINGIZE(suffix1) "," BOOST_STRINGIZE(suffix2) " == " BOOST_STRINGIZE(expected_type)) + +#else #define BOOST_CHECK_TYPE(type_expression, expected_type)\ do{\ @@ -64,4 +73,4 @@ do{\ #endif - +#endif diff --git a/test/cuda_tests.txt b/test/cuda_tests.txt new file mode 100644 index 0000000..9a75bd5 --- /dev/null +++ b/test/cuda_tests.txt @@ -0,0 +1,188 @@ +add_const_test +add_cv_test +add_lvalue_reference_test +add_pointer_test +add_reference_test +add_rvalue_reference_test +add_volatile_test +aligned_storage_a2_test +aligned_storage_empy_test +aligned_storage_test +common_type_2_test +common_type_3_test +common_type_4_test +common_type_5_test +common_type_6_test +common_type_sfinae2_test +common_type_sfinae_test +common_type_test +conditional_test +conjunction_test +copy_cv_ref_test +copy_cv_test +copy_reference_test +cxx14_aliases_test +decay_test +detected_or_test +detected_test +disjunction_test +enable_if_test +extent_test +floating_point_promotion_test +function_traits_test +has_binary_classes0_test +has_binary_classes1_test +has_binary_classes2_test +has_binary_classes3_test +has_binary_classes4_test +has_binary_classes5_test +has_binary_classes6_test +has_binary_classes7_test +has_binary_classes8_test +has_binary_classes9_test +has_bit_and_assign_test +has_bit_and_test +has_bit_or_assign_test +has_bit_or_test +has_bit_xor_assign_test +has_bit_xor_test +has_complement_test +has_dereference_test +has_divides_assign_test +has_divides_test +has_equal_to_test +has_greater_equal_test +has_greater_test +has_left_shift_assign_test +has_left_shift_test +has_less_equal_test +has_less_test +has_logical_and_test +has_logical_not_test +has_logical_or_test +has_minus_assign_test +has_minus_test +has_modulus_assign_test +has_modulus_test +has_multiplies_assign_test +has_multiplies_test +has_negate_test +has_not_equal_to_test +has_nothrow_assign_test +has_nothrow_constr_test +has_nothrow_copy_test +has_nothrow_destructor_test +has_operator_new_test +has_plus_assign_test +has_plus_test +has_post_decrement_test +has_post_increment_test +has_postfix_classes0_test +has_postfix_classes1_test +has_postfix_classes2_test +has_postfix_classes3_test +has_pre_decrement_test +has_pre_increment_test +has_prefix_classes0_test +has_prefix_classes1_test +has_prefix_classes2_test +has_prefix_classes3_test +has_right_shift_assign_test +has_right_shift_test +has_trivial_assign_test +has_trivial_constr_test +has_trivial_copy_test +has_trivial_destructor_test +has_trivial_move_assign_test +has_trivial_move_constructor_test +has_unary_minus_test +has_unary_plus_test +has_virtual_destructor_test +is_abstract_test +is_arithmetic_test +is_array_test +is_assignable_test +is_base_and_derived_test +is_base_of_test +is_bounded_array_test +is_class_test +is_complete_test +is_complex_test +is_compound_test +is_const_test +is_constructible_test +is_convertible_test +is_copy_assignable_test +is_copy_constructible_test +is_default_constr_test +is_destructible_test +is_detected_convertible +is_detected_exact_test +is_detected_test +is_empty_test +is_enum_test +is_final_test +is_float_test +is_floating_point_test +is_function_test +is_fundamental_test +is_integral_test +is_list_constructible_test +is_lvalue_reference_test +is_member_func_test +is_member_obj_test +is_member_pointer_test +is_noncopyable_test +is_nothrow_move_assignable_test +is_nothrow_move_constructible_test +is_nothrow_swappable_test +is_object_test +is_pod_test +is_pointer_test +is_polymorphic_test +is_reference_test +is_rvalue_reference_test +is_same_test +is_scalar_test +is_scoped_enum_test +is_signed_test +is_stateless_test +is_trivially_copyable_test +is_unbounded_array_test +is_union_test +is_unscoped_enum_test +is_unsigned_test +is_virtual_base_of_test +is_void_test +is_volatile_test +make_signed_test +make_unsigned_test +make_void_test +mpl_interop_test1 +mpl_interop_test2 +mpl_interop_test3 +negation_test +promote_basic_test +promote_enum_msvc_bug_test +promote_enum_test +promote_mpl_test +rank_test +remove_all_extents_test +remove_bounds_test +remove_const_test +remove_cv_ref_test +remove_cv_test +remove_extent_test +remove_pointer_test +remove_reference_test +remove_volatile_test +tricky_abstract_type_test +tricky_add_pointer_test +tricky_function_type_test +tricky_incomplete_type_test +tricky_is_enum_test +tricky_partial_spec_test +tricky_rvalue_test +type_identity_test +type_traits_test +type_with_alignment_test diff --git a/test/has_unary_plus_test.cpp b/test/has_unary_plus_test.cpp index e24d833..10f383b 100644 --- a/test/has_unary_plus_test.cpp +++ b/test/has_unary_plus_test.cpp @@ -224,9 +224,9 @@ void specific() { auto f = []() {}; auto f2 = [](double)->int { return 2; }; #if BOOST_WORKAROUND(BOOST_MSVC, <= 1900) - bool result = false; + BOOST_CONSTEXPR bool result = false; #else - bool result = true; + BOOST_CONSTEXPR bool result = true; #endif BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), result); BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), result); diff --git a/test/tricky_partial_spec_test.cpp b/test/tricky_partial_spec_test.cpp index e6becc0..80de148 100644 --- a/test/tricky_partial_spec_test.cpp +++ b/test/tricky_partial_spec_test.cpp @@ -54,11 +54,14 @@ TT_TEST_BEGIN(tricky_partial_specialization_test) // corner cases which don't compile without partial specialization // support: // +#ifndef TEST_VIA_STATIC_ASSERT BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of::value, ALIGNOF(void*)); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of::value, ALIGNOF(void*)); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::alignment_of::value, ALIGNOF(void*)); +#endif + BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), false); BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), false); BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), false);