diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 455db6f39..aaf7587bc 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -59,41 +59,6 @@ set(stdexec_test_sources stdexec/detail/test_utility.cpp stdexec/queries/test_get_forward_progress_guarantee.cpp stdexec/queries/test_forwarding_queries.cpp - exec/test_bwos_lifo_queue.cpp - exec/test_any_sender.cpp - exec/test_task.cpp - exec/test_timed_thread_scheduler.cpp - exec/test_variant_sender.cpp - exec/test_type_async_scope.cpp - exec/test_create.cpp - exec/test_env.cpp - exec/test_finally.cpp - exec/test_into_tuple.cpp - exec/test_on.cpp - exec/test_on2.cpp - exec/test_on3.cpp - exec/test_repeat_effect_until.cpp - exec/test_repeat_n.cpp - exec/async_scope/test_dtor.cpp - exec/async_scope/test_spawn.cpp - exec/async_scope/test_spawn_future.cpp - exec/async_scope/test_start_now.cpp - exec/async_scope/test_empty.cpp - exec/async_scope/test_stop.cpp - exec/test_when_any.cpp - exec/test_at_coroutine_exit.cpp - exec/test_materialize.cpp - $<$:exec/test_io_uring_context.cpp> - exec/test_trampoline_scheduler.cpp - exec/test_sequence_senders.cpp - exec/sequence/test_any_sequence_of.cpp - exec/sequence/test_empty_sequence.cpp - exec/sequence/test_ignore_all_values.cpp - exec/sequence/test_iterate.cpp - exec/sequence/test_transform_each.cpp - $<$:tbbexec/test_tbb_thread_pool.cpp> - exec/test_system_context.cpp - $<$:exec/test_libdispatch.cpp> ) add_library(common_test_settings INTERFACE) @@ -101,21 +66,20 @@ set_target_properties(common_test_settings PROPERTIES CXX_STANDARD 20 CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF - MSVC_DEBUG_INFORMATION_FORMAT Embedded) + MSVC_DEBUG_INFORMATION_FORMAT Embedded + ) +target_include_directories(common_test_settings INTERFACE "${CMAKE_CURRENT_LIST_DIR}") add_executable(test.stdexec ${stdexec_test_sources}) -target_include_directories(test.stdexec PRIVATE ${CMAKE_CURRENT_LIST_DIR}) target_link_libraries(test.stdexec PUBLIC STDEXEC::stdexec - $ stdexec_executable_flags Catch2::Catch2 PRIVATE common_test_settings) add_executable(test.scratch test_main.cpp test_scratch.cpp) -target_include_directories(test.scratch PRIVATE ${CMAKE_CURRENT_LIST_DIR}) target_link_libraries(test.scratch PUBLIC STDEXEC::stdexec @@ -125,35 +89,23 @@ target_link_libraries(test.scratch PRIVATE common_test_settings) - add_executable(test.system_context_replaceability test_main.cpp test_system_context_replaceability.cpp) - target_include_directories(test.system_context_replaceability PRIVATE ${CMAKE_CURRENT_LIST_DIR}) - target_link_libraries(test.system_context_replaceability - PUBLIC - STDEXEC::stdexec - STDEXEC::system_context - stdexec_executable_flags - Catch2::Catch2 - PRIVATE - common_test_settings) - # Discover the Catch2 test built by the application include(${Catch2_SOURCE_DIR}/contrib/Catch.cmake) +# For testing that builds fail as expected +include(${icm_SOURCE_DIR}/icm_build_failure_testing.cmake) + catch_discover_tests(test.stdexec) catch_discover_tests(test.scratch) -if(NOT STDEXEC_ENABLE_CUDA) - catch_discover_tests(test.system_context_replaceability) -endif() + +add_subdirectory(exec) if(STDEXEC_ENABLE_CUDA) add_subdirectory(nvexec) endif() -# build failure tests: - -include(${icm_SOURCE_DIR}/icm_build_failure_testing.cmake) - -# Test which parses a source file for an expected error message +# build failure tests: tests which parse a source file for an expected error +# message icm_add_build_failure_test( NAME test_let_fail1 TARGET test_let_fail1 @@ -170,22 +122,6 @@ icm_add_build_failure_test( FOLDER test ) -icm_add_build_failure_test( - NAME test_repeat_effect_until_fail - TARGET test_repeat_effect_until_fail - SOURCES PARSE exec/test_repeat_effect_until_fail.cpp - LIBRARIES stdexec - FOLDER test -) - -icm_add_build_failure_test( - NAME test_repeat_n_fail - TARGET test_repeat_n_fail - SOURCES PARSE exec/test_repeat_n_fail.cpp - LIBRARIES stdexec - FOLDER test -) - # # Adding multiple tests with a glob # icm_glob_build_failure_tests( # PATTERN *_fail*.cpp diff --git a/test/exec/CMakeLists.txt b/test/exec/CMakeLists.txt new file mode 100644 index 000000000..d457664b8 --- /dev/null +++ b/test/exec/CMakeLists.txt @@ -0,0 +1,97 @@ +#============================================================================= +# Copyright 2023 NVIDIA Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#============================================================================= + +set(exec_test_sources + ../test_main.cpp + test_bwos_lifo_queue.cpp + test_any_sender.cpp + test_task.cpp + test_timed_thread_scheduler.cpp + test_variant_sender.cpp + test_type_async_scope.cpp + test_create.cpp + test_env.cpp + test_finally.cpp + test_into_tuple.cpp + test_on.cpp + test_on2.cpp + test_on3.cpp + test_repeat_effect_until.cpp + test_repeat_n.cpp + async_scope/test_dtor.cpp + async_scope/test_spawn.cpp + async_scope/test_spawn_future.cpp + async_scope/test_start_now.cpp + async_scope/test_empty.cpp + async_scope/test_stop.cpp + test_when_any.cpp + test_at_coroutine_exit.cpp + test_materialize.cpp + $<$:test_io_uring_context.cpp> + test_trampoline_scheduler.cpp + test_sequence_senders.cpp + sequence/test_any_sequence_of.cpp + sequence/test_empty_sequence.cpp + sequence/test_ignore_all_values.cpp + sequence/test_iterate.cpp + sequence/test_transform_each.cpp + $<$:../tbbexec/test_tbb_thread_pool.cpp> + test_system_context.cpp + $<$:test_libdispatch.cpp> + ) + +add_executable(test.exec ${exec_test_sources}) +target_link_libraries(test.exec + PUBLIC + STDEXEC::stdexec + $ + stdexec_executable_flags + Catch2::Catch2 + PRIVATE + common_test_settings) + +add_executable(test.system_context_replaceability ../test_main.cpp test_system_context_replaceability.cpp) +target_link_libraries(test.system_context_replaceability + PUBLIC + STDEXEC::stdexec + STDEXEC::system_context + stdexec_executable_flags + Catch2::Catch2 + PRIVATE + common_test_settings) + +# Discover the Catch2 test built by the application +catch_discover_tests(test.exec) +if(NOT STDEXEC_ENABLE_CUDA) + catch_discover_tests(test.system_context_replaceability) +endif() + +# Test which parses a source file for an expected error message +icm_add_build_failure_test( + NAME test_repeat_effect_until_fail + TARGET test_repeat_effect_until_fail + SOURCES PARSE test_repeat_effect_until_fail.cpp + LIBRARIES stdexec + FOLDER test +) + +icm_add_build_failure_test( + NAME test_repeat_n_fail + TARGET test_repeat_n_fail + SOURCES PARSE test_repeat_n_fail.cpp + LIBRARIES stdexec + FOLDER test +) diff --git a/test/test_system_context_replaceability.cpp b/test/exec/test_system_context_replaceability.cpp similarity index 100% rename from test/test_system_context_replaceability.cpp rename to test/exec/test_system_context_replaceability.cpp