3 #############################
4 # macro for adding hoomd script tests
5 macro(add_hoomd_script_test test_py)
7 get_filename_component(_test_name ${test_py} NAME_WE)
9 if (CMAKE_MINOR_VERSION GREATER 7)
10 get_target_property(HOOMD_EXE hoomd LOCATION)
11 # with CMake 2.8.x and newer, use the NAME COMMAND form of add test to run the built hoomd target
12 add_test(NAME script-${_test_name}-cpu COMMAND ${HOOMD_EXE} ${test_py} "--mode=cpu" "--gpu_error_checking")
14 add_test(NAME script-${_test_name}-gpu COMMAND ${HOOMD_EXE} ${test_py} "--mode=gpu" "--gpu_error_checking")
17 else (CMAKE_MINOR_VERSION GREATER 7)
18 # with CMake 2.6.x, or shared builds use the old form of add_test to add a specific hoomd exename
19 # setup hoomd runner environment
20 get_target_property(HOOMD_EXE hoomd LOCATION)
22 add_test(script-${_test_name}-cpu ${HOOMD_EXE} ${test_py} "--mode=cpu" "--gpu_error_checking")
24 add_test(script-${_test_name}-gpu ${HOOMD_EXE} ${test_py} "--mode=gpu" "--gpu_error_checking")
27 endif (CMAKE_MINOR_VERSION GREATER 7)
28 endmacro(add_hoomd_script_test)
29 ###############################
31 #############################
32 # macro for adding hoomd script tests (MPI version)
33 macro(add_hoomd_script_test_mpi test_py nproc)
35 get_filename_component(_test_name ${test_py} NAME_WE)
36 get_target_property(HOOMD_EXE hoomd LOCATION)
38 add_test(NAME script-${_test_name}-mpi-cpu
39 COMMAND ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} ${nproc}
40 ${MPIEXEC_POSTFLAGS} ${HOOMD_EXE} ${test_py} "--mode=cpu" "--gpu_error_checking")
42 add_test(NAME script-${_test_name}-mpi-gpu
43 COMMAND ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} ${nproc}
44 ${MPIEXEC_POSTFLAGS} ${HOOMD_EXE} ${test_py} "--mode=gpu" "--gpu_error_checking")
46 endmacro(add_hoomd_script_test_mpi)
47 ###############################
50 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.ocelot ${CMAKE_CURRENT_BINARY_DIR}/configure.ocelot COPYONLY)
52 # loop through all test_*.py files
53 file(GLOB _hoomd_script_tests ${CMAKE_CURRENT_SOURCE_DIR}/test_*.py)
55 foreach(test ${_hoomd_script_tests})
56 add_hoomd_script_test(${test})
59 # exclude some tests from MPI
62 test_constraint_sphere
65 test_integrate_bdnvt_rigid
66 test_integrate_nvt_rigid
67 test_integrate_nve_rigid
69 test_update_rescale_temp
74 foreach(test ${_hoomd_script_tests})
75 GET_FILENAME_COMPONENT(test_name ${test} NAME_WE)
76 if(NOT "${EXCLUDE_FROM_MPI}" MATCHES ${test_name})
77 # execute on two processors
78 add_hoomd_script_test_mpi(${test} 2)