Permalink
Browse files

Merge pull request #3451 from msimberg/test-examples

Add examples as unit tests
  • Loading branch information...
msimberg committed Sep 14, 2018
2 parents b4bc3b7 + 9820039 commit 6df436bf5b260716aad5663c943c2f7f5d76857e
View
@@ -148,6 +148,23 @@ jobs:
paths:
- ./build
tests.examples:
<<: *defaults
steps:
- attach_workspace:
at: /hpx
- run:
name: Running Unit Tests
when: always
command: |
ctest -T test --no-compress-output --output-on-failure -R tests.examples
- run:
<<: *convert_xml
- store_test_results:
path: tests.examples
- store_artifacts:
path: tests.examples
tests.unit.actions:
<<: *defaults
steps:
@@ -883,6 +900,9 @@ workflows:
requires:
- configure
<<: *gh_pages_filter
- tests.examples:
requires:
- examples
- tests.unit.actions:
<<: *core_dependency
- tests.unit.agas:
@@ -958,6 +978,7 @@ workflows:
- inspect
- clang_tidy
- core
- tests.examples
- tests.unit.actions
- tests.unit.agas
- tests.unit.build
View
@@ -266,6 +266,7 @@ hpx_option(HPX_WITH_TESTS_REGRESSIONS BOOL "Build HPX regression tests (default:
hpx_option(HPX_WITH_TESTS_UNIT BOOL "Build HPX unit tests (default: ON)" ON ADVANCED CATEGORY "Build Targets")
hpx_option(HPX_WITH_TESTS_HEADERS BOOL "Build HPX header tests (default: OFF)" OFF ADVANCED CATEGORY "Build Targets")
hpx_option(HPX_WITH_TESTS_EXTERNAL_BUILD BOOL "Build external cmake build tests (default: ON)" ON ADVANCED CATEGORY "Build Targets")
hpx_option(HPX_WITH_TESTS_EXAMPLES BOOL "Add HPX examples as tests (default: ON)" ON ADVANCED CATEGORY "Build Targets")
hpx_option(HPX_WITH_TOOLS BOOL "Build HPX tools (default: OFF)" OFF ADVANCED CATEGORY "Build Targets")
hpx_option(HPX_WITH_RUNTIME BOOL "Build HPX runtime (default: ON)" ON ADVANCED CATEGORY "Build Targets")
@@ -1798,12 +1799,6 @@ endif()
add_hpx_pseudo_target(core)
add_subdirectory(src)
if(HPX_WITH_EXAMPLES)
add_hpx_pseudo_target(examples)
include_directories(examples)
add_subdirectory(examples)
endif()
###############################################################################
# Tests
###############################################################################
@@ -1823,6 +1818,12 @@ if(HPX_WITH_TESTS)
add_subdirectory(tests)
endif()
if(HPX_WITH_EXAMPLES)
add_hpx_pseudo_target(examples)
include_directories(examples)
add_subdirectory(examples)
endif()
if(HPX_WITH_RUNTIME)
add_hpx_pseudo_target(runtime)
add_subdirectory(runtime)
View
@@ -23,6 +23,8 @@ macro(add_hpx_test category name)
if(TARGET ${${name}_EXECUTABLE}_test_exe)
set(_exe "$<TARGET_FILE:${${name}_EXECUTABLE}_test_exe>")
elseif(TARGET ${${name}_EXECUTABLE}_exe)
set(_exe "$<TARGET_FILE:${${name}_EXECUTABLE}_exe>")
else()
set(_exe "${${name}_EXECUTABLE}")
endif()
@@ -136,3 +138,8 @@ macro(add_hpx_regression_test category name)
add_hpx_test("tests.regressions.${category}" ${name} ${ARGN})
endmacro()
macro(add_hpx_example_test category name)
add_hpx_test("tests.examples.${category}" ${name} ${ARGN})
endmacro()
@@ -75,6 +75,7 @@ set(HPX_WITH_TESTS ON CACHE BOOL "Testing enabled by default")
set(HPX_WITH_TESTS_BENCHMARKS ON CACHE BOOL "Testing enabled by default")
set(HPX_WITH_TESTS_REGRESSIONS ON CACHE BOOL "Testing enabled by default")
set(HPX_WITH_TESTS_UNIT ON CACHE BOOL "Testing enabled by default")
set(HPX_WITH_TESTS_EXAMPLES ON CACHE BOOL "Testing enabled by default")
set(HPX_WITH_TESTS_EXTERNAL_BUILD OFF CACHE BOOL "Turn off build of cmake build tests")
set(DART_TESTING_TIMEOUT 45 CACHE STRING "Life is too short")
@@ -21,14 +21,33 @@ if(HPX_WITH_APEX)
1d_stencil_4_repart
1d_stencil_4_throttle
)
set(1d_stencil_4_repart_PARAMETERS THREADS_PER_LOCALITY 4)
set(1d_stencil_4_throttle_PARAMETERS THREADS_PER_LOCALITY 4)
endif()
if(HPX_WITH_EXAMPLES_OPENMP)
set(example_programs ${example_programs}
1d_stencil_1_omp
1d_stencil_3_omp)
set(disabled_tests
1d_stencil_1_omp
1d_stencil_3_omp
)
endif()
set(1d_stencil_1_PARAMETERS THREADS_PER_LOCALITY 4)
set(1d_stencil_2_PARAMETERS THREADS_PER_LOCALITY 4)
set(1d_stencil_3_PARAMETERS THREADS_PER_LOCALITY 4)
set(1d_stencil_4_PARAMETERS THREADS_PER_LOCALITY 4)
set(1d_stencil_4_checkpoint_PARAMETERS THREADS_PER_LOCALITY 4)
set(1d_stencil_4_parallel_PARAMETERS THREADS_PER_LOCALITY 4)
set(1d_stencil_5_PARAMETERS THREADS_PER_LOCALITY 4)
set(1d_stencil_6_PARAMETERS THREADS_PER_LOCALITY 4)
set(1d_stencil_7_PARAMETERS THREADS_PER_LOCALITY 4)
set(1d_stencil_8_PARAMETERS THREADS_PER_LOCALITY 4)
foreach(example_program ${example_programs})
set(${example_program}_FLAGS COMPONENT_DEPENDENCIES iostreams)
@@ -53,6 +72,16 @@ foreach(example_program ${example_programs})
# add dependencies to pseudo-target
add_hpx_pseudo_dependencies(examples.1d_stencil.${example_program}
${example_program}_exe)
if(HPX_WITH_TESTS AND HPX_WITH_TESTS_EXAMPLES AND
NOT ("${example_program}" IN_LIST disabled_tests))
add_hpx_example_test("1d_stencil" ${example_program} ${${example_program}_PARAMETERS})
add_hpx_pseudo_target(tests.examples.1d_stencil.${example_program})
add_hpx_pseudo_dependencies(tests.examples.1d_stencil
tests.examples.1d_stencil.${example_program})
add_hpx_pseudo_dependencies(tests.examples.1d_stencil.${example_program}
${example_program}_exe)
endif()
endforeach()
if(HPX_WITH_EXAMPLES_OPENMP)
View
@@ -55,7 +55,17 @@ if(HPX_WITH_COMPUTE)
)
endif()
if(HPX_WITH_TESTS AND HPX_WITH_TESTS_EXAMPLES)
add_hpx_pseudo_target(tests.examples)
add_hpx_pseudo_dependencies(tests tests.examples)
endif()
foreach(subdir ${subdirs})
if(HPX_WITH_TESTS AND HPX_WITH_TESTS_EXAMPLES)
add_hpx_pseudo_target(tests.examples.${subdir})
add_hpx_pseudo_dependencies(tests.examples tests.examples.${subdir})
endif()
add_hpx_pseudo_target(examples.${subdir})
add_subdirectory(${subdir})
add_hpx_pseudo_dependencies(examples examples.${subdir})
@@ -10,6 +10,8 @@ set(examples
template_function_accumulator
)
# TODO: Add non-interactive version that can be tested.
# for all targets specified above
foreach(example ${examples})
set(client_sources ${example}_client.cpp)
@@ -41,4 +43,3 @@ foreach(example ${examples})
add_hpx_pseudo_dependencies(examples.accumulators.${example}
${example}_client_exe)
endforeach()
@@ -12,6 +12,12 @@ set(example_programs
apex_fibonacci
)
set(apex_policy_engine_periodic_PARAMETERS THREADS_PER_LOCALITY 4)
set(apex_policy_engine_events_PARAMETERS THREADS_PER_LOCALITY 4)
set(apex_policy_engine_active_thread_coutn_PARAMETERS THREADS_PER_LOCALITY 4)
set(apex_balance_PARAMETERS THREADS_PER_LOCALITY 4)
set(apex_fibonacci_PARAMETERS THREADS_PER_LOCALITY 4)
foreach(example_program ${example_programs})
set(sources
${example_program}.cpp)
@@ -34,5 +40,13 @@ foreach(example_program ${example_programs})
# add dependencies to pseudo-target
add_hpx_pseudo_dependencies(examples.apex.${example_program}
${example_program}_exe)
endforeach()
if(HPX_WITH_TESTS AND HPX_WITH_TESTS_EXAMPLES)
add_hpx_example_test("apex" ${example_program} ${${example_program}_PARAMETERS})
add_hpx_pseudo_target(tests.examples.apex.${example_program})
add_hpx_pseudo_dependencies(tests.examples.apex
tests.examples.apex.${example_program})
add_hpx_pseudo_dependencies(tests.examples.apex.${example_program}
${example_program}_exe)
endif()
endforeach()
@@ -9,6 +9,11 @@ set(example_programs
async_io_external
async_io_low_level)
set(async_io_simple_PARAMETERS THREADS_PER_LOCALITY 4)
set(async_io_action_PARAMETERS THREADS_PER_LOCALITY 4)
set(async_io_external_PARAMETERS THREADS_PER_LOCALITY 4)
set(async_io_low_level_PARAMETERS THREADS_PER_LOCALITY 4)
foreach(example_program ${example_programs})
set(${example_program}_FLAGS DEPENDENCIES iostreams_component)
@@ -33,5 +38,13 @@ foreach(example_program ${example_programs})
# add dependencies to pseudo-target
add_hpx_pseudo_dependencies(examples.async_io.${example_program}
${example_program}_exe)
endforeach()
if(HPX_WITH_TESTS AND HPX_WITH_TESTS_EXAMPLES)
add_hpx_example_test("async_io" ${example_program} ${${example_program}_PARAMETERS})
add_hpx_pseudo_target(tests.examples.async_io.${example_program})
add_hpx_pseudo_dependencies(tests.examples.async_io
tests.examples.async_io.${example_program})
add_hpx_pseudo_dependencies(tests.examples.async_io.${example_program}
${example_program}_exe)
endif()
endforeach()
@@ -9,6 +9,9 @@ set(example_programs
set(os_thread_num_FLAGS DEPENDENCIES iostreams_component)
set(os_thread_num_PARAMETERS THREADS_PER_LOCALITY 4)
set(hpx_thread_phase_PARAMETERS THREADS_PER_LOCALITY 4)
foreach(example_program ${example_programs})
set(sources ${example_program}.cpp)
@@ -30,5 +33,13 @@ foreach(example_program ${example_programs})
# add dependencies to pseudo-target
add_hpx_pseudo_dependencies(examples.balancing.${example_program}
${example_program}_exe)
endforeach()
if(HPX_WITH_TESTS AND HPX_WITH_TESTS_EXAMPLES)
add_hpx_example_test("balancing" ${example_program} ${${example_program}_PARAMETERS})
add_hpx_pseudo_target(tests.examples.balancing.${example_program})
add_hpx_pseudo_dependencies(tests.examples.balancing
tests.examples.balancing.${example_program})
add_hpx_pseudo_dependencies(tests.examples.balancing.${example_program}
${example_program}_exe)
endif()
endforeach()
@@ -27,3 +27,11 @@ add_hpx_pseudo_dependencies(examples examples.cancelable_action)
add_hpx_pseudo_dependencies(examples.cancelable_action
cancelable_action_client_exe)
if(HPX_WITH_TESTS AND HPX_WITH_TESTS_EXAMPLES)
add_hpx_example_test("cancelable_action" cancelable_action_client THREADS_PER_LOCALITY 4)
add_hpx_pseudo_target(tests.examples.cancelable_action.cancelable_action)
add_hpx_pseudo_dependencies(tests.examples.cancelable_action
tests.examples.cancelable_action.cancelable_action)
add_hpx_pseudo_dependencies(tests.examples.cancelable_action.cancelable_action
cancelable_action_client_exe)
endif()
@@ -13,8 +13,12 @@ if(HPX_WITH_CUDA)
endif()
foreach(subdir ${subdirs})
if(HPX_WITH_TESTS AND HPX_WITH_TESTS_EXAMPLES)
add_hpx_pseudo_target(tests.examples.compute.${subdir})
add_hpx_pseudo_dependencies(tests.examples.compute tests.examples.compute.${subdir})
endif()
add_hpx_pseudo_target(examples.compute.${subdir})
add_subdirectory(${subdir})
add_hpx_pseudo_dependencies(examples examples.compute.${subdir})
endforeach()
@@ -14,11 +14,17 @@ if(HPX_WITH_CUDA)
hello_compute
)
set(cublas_matmul_PARAMETERS THREADS_PER_LOCALITY 4)
set(cuda_future_PARAMETERS THREADS_PER_LOCALITY 4)
set(data_copy_PARAMETERS THREADS_PER_LOCALITY 4)
set(hello_compute_PARAMETERS THREADS_PER_LOCALITY 4)
# Append example programs that only compiles with Cuda Clang
if(HPX_WITH_CUDA_CLANG)
list(APPEND example_programs
partitioned_vector
)
set(partitioned_vector_PARAMETERS THREADS_PER_LOCALITY 4)
endif()
include_directories(${CUDA_INCLUDE_DIRS})
@@ -67,4 +73,13 @@ foreach(example_program ${example_programs})
# add dependencies to pseudo-target
add_hpx_pseudo_dependencies(examples.compute.cuda.${example_program}
${example_program}_exe)
if(HPX_WITH_TESTS AND HPX_WITH_TESTS_EXAMPLES)
add_hpx_example_test("cuda" ${example_program} ${${example_program}_PARAMETERS})
add_hpx_pseudo_target(tests.examples.compute.cuda.${example_program})
add_hpx_pseudo_dependencies(tests.examples.compute.cuda
tests.examples.compute.cuda.${example_program})
add_hpx_pseudo_dependencies(tests.examples.compute.cuda.${example_program}
${example_program}_exe)
endif()
endforeach()
@@ -11,6 +11,7 @@ if(HPX_HAVE_CXX11_STD_RANDOM)
${example_programs}
rnd_future_reduce)
set(rnd_future_reduce_FLAGS DEPENDENCIES iostreams_component)
set(rnd_future_reduce_PARAMETERS THREADS_PER_LOCALITY 4)
endif()
foreach(example_program ${example_programs})
@@ -35,5 +36,13 @@ foreach(example_program ${example_programs})
# add dependencies to pseudo-target
add_hpx_pseudo_dependencies(examples.future_reduce.${example_program}
${example_program}_exe)
endforeach()
if(HPX_WITH_TESTS AND HPX_WITH_TESTS_EXAMPLES)
add_hpx_example_test("future_reduce" ${example_program} ${${example_program}_PARAMETERS})
add_hpx_pseudo_target(tests.examples.future_reduce.${example_program})
add_hpx_pseudo_dependencies(tests.examples.future_reduce
tests.examples.future_reduce.${example_program})
add_hpx_pseudo_dependencies(tests.examples.future_reduce.${example_program}
${example_program}_exe)
endif()
endforeach()
@@ -40,3 +40,4 @@ add_hpx_executable(heartbeat_console
# add pseudo-target dependencies
add_hpx_pseudo_dependencies(examples.heartbeat heartbeat_console_exe)
# TODO: Add non-interactive version that can be tested.
@@ -15,6 +15,8 @@ if(HPX_WITH_EXAMPLES_HDF5)
set(subdirs
interpolate1d)
set(interpolate1d_PARAMETERS THREADS_PER_LOCALITY 4)
# for all targets specified above
foreach(subdir ${subdirs})
add_subdirectory(${subdir})
@@ -40,6 +42,15 @@ if(HPX_WITH_EXAMPLES_HDF5)
# add dependencies to pseudo-target
add_hpx_pseudo_dependencies(examples.interpolate1d.${subdir}_
${subdir}_client_exe)
if(HPX_WITH_TESTS AND HPX_WITH_TESTS_EXAMPLES)
add_hpx_example_test("interpolate1d" ${subdir} ${${subdir}_PARAMETERS})
add_hpx_pseudo_target(tests.examples.interpolate1d.${subdir})
add_hpx_pseudo_dependencies(tests.examples.interpolate1d
tests.examples.interpolate1d.${subdir})
add_hpx_pseudo_dependencies(tests.examples.interpolate1d.${subdir}
${subdir}_client_exe)
endif()
endforeach()
add_hpx_executable(create_1d_testdata
@@ -29,3 +29,5 @@ add_hpx_pseudo_dependencies(examples.jacobi
# add dependencies to pseudo-target
add_hpx_pseudo_dependencies(examples.jacobi.jacobi_simple
jacobi_exe)
# TODO: Fix example. Not added to unit tests until fixed.
Oops, something went wrong.

0 comments on commit 6df436b

Please sign in to comment.