CMakeLists.txt (5859B)
1 # Add the -config to all PISM test runs (necessary because we want to use the 2 # config file from *this* build, not the one that might be present in the 3 # install location). 4 file (WRITE ${CMAKE_CURRENT_BINARY_DIR}/.petscrc "-config ${PROJECT_BINARY_DIR}/pism_config.nc") 5 6 # Copy nccmp.py into the build directory: 7 configure_file (${PROJECT_SOURCE_DIR}/util/nccmp.py ${PROJECT_BINARY_DIR}/nccmp.py COPYONLY) 8 9 # Set the location of PISM regression test scripts 10 set(PISM_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}) 11 12 set (MEMORYCHECK_COMMAND_OPTIONS "--dsymutil=yes --trace-children=yes --trace-children-skip=*python,*nccmp.py,*rm,*which,*env,*diff,*cp,*hydra_*") 13 14 function(add_memcheck_test name binary) 15 set(memcheck_command "${MEMORYCHECK_COMMAND} ${MEMORYCHECK_COMMAND_OPTIONS}") 16 separate_arguments(memcheck_command) 17 add_test(memcheck_${name} ${memcheck_command} ${binary} ${ARGN}) 18 endfunction(add_memcheck_test) 19 20 function(set_memcheck_test_properties name) 21 set_tests_properties(memcheck_${name} ${ARGN}) 22 endfunction(set_memcheck_test_properties) 23 24 # A macro simplifying test creation: 25 macro(pism_test name script) 26 add_test("${name}:${script}" ${PISM_TEST_DIR}/${script} ${PROJECT_BINARY_DIR} ${MPIEXEC} ${PROJECT_SOURCE_DIR}) 27 if (${Pism_TEST_USING_VALGRIND}) 28 add_memcheck_test("${name}:${script}" ${PISM_TEST_DIR}/${script} ${PROJECT_BINARY_DIR} ${MPIEXEC} ${PROJECT_SOURCE_DIR}) 29 set_memcheck_test_properties("${name}:${script}" 30 PROPERTIES FAIL_REGULAR_EXPRESSION "ERROR SUMMARY: [^0]") 31 endif() 32 endmacro() 33 34 macro(pism_python_test name script) 35 add_test("${name}:${script}" ${PISM_TEST_DIR}/${script} ${PROJECT_BINARY_DIR} ${MPIEXEC} ${PROJECT_SOURCE_DIR} -python ${PYTHON_EXECUTABLE}) 36 endmacro() 37 38 # Tests themselves: 39 pism_test (pism_testing_tools test_regression_tools.py) 40 41 pism_test (pismr_exact_restartability_SIA_only test_01.sh) 42 43 pism_test (pismv_processor_independence test_02.sh) 44 45 pism_test (pismr_zero_length_run test_03.sh) 46 47 pism_test (pismr_regridding_during_bootstrapping test_04.sh) 48 49 pism_test (pismr_bootstrap_variable_order test_05.sh) 50 51 pism_test (pismr_bootstrap_variable_ranges test_06.sh) 52 53 pism_test (regridding:bootstrap_vs_regrid_file test_07.sh) 54 55 pism_test (regridding:vertical_direction test_08.sh) 56 57 pism_test (regridding:variable_order test_09.sh) 58 59 pism_test (regridding:processor_independence test_10.sh) 60 61 pism_test (regridding:no_enthalpy test_32.sh) 62 63 pism_test (SIA_mass_conservation test_12.sh) 64 65 pism_test (temperature_continuity_base_polythermal temp_continuity.py) 66 67 pism_test (enthalpy_symmetry_near_base test_13.sh) 68 69 pism_test (Verification:test_C test_15.sh) 70 71 pism_test (Verification:test_L test_16.sh) 72 73 pism_test (Verification:test_G test_17.sh) 74 75 pism_test (Verification:test_K test_18.sh) 76 77 pism_test (restart:i_vs_bootstrap_and_regrid_file test_23.sh) 78 79 pism_test (runtime_viewers test_27.sh) 80 81 pism_test (bootstrapping_incomplete_input test_28.sh) 82 83 pism_test (distributed_hydrology test_29.py) 84 85 pism_test (initialization_without_enthalpy test_31.sh) 86 87 pism_test (vertical_grid_expansion vertical_grid_expansion.sh) 88 89 pism_test (bed_deformation:LC:exact_restartability beddef_lc_restart.sh) 90 91 if (Pism_USE_PROJ) 92 pism_test (epsg_code_processing test_epsg_processing.py) 93 endif() 94 95 if(Pism_BUILD_EXTRA_EXECS) 96 # These tests require special executables. They are disabled unless 97 # these executables are built. This way we don't need to explain why 98 # "make && make test" shows some test failures when PISM is built 99 # with default settings. 100 pism_test (Verification:PISMBedThermalUnit_test_K btu_regression.sh) 101 102 pism_test (Verification:test_V_SSAFD_CFBC ssa/ssa_test_cfbc_fd.sh) 103 104 pism_test (Verification:test_V_SSAFEM_CFBC ssa/ssa_test_cfbc_fem.sh) 105 106 pism_test (Verification:test_I_SSAFD ssa/ssa_testi_fd.sh) 107 108 pism_test (Verification:test_I_SSAFEM ssa/ssa_testi_fem.sh) 109 110 pism_test (Verification:test_J_SSAFD ssa/ssa_testj_fd.sh) 111 112 pism_test (Verification:test_J_SSAFEM ssa/ssa_testj_fem.sh) 113 114 pism_test (Verification:SSAFEM_linear_flow ssa/ssafem_test_linear.sh) 115 116 pism_test (Verification:SSAFEM_plug_flow ssa/ssafem_test_plug.sh) 117 endif() 118 119 if(Pism_BUILD_PYTHON_BINDINGS) 120 121 pism_python_test (Python:Verification:test_I_SSAFD ssa/ssa_testi_fd.sh) 122 123 pism_python_test (Python:Verification:test_I_SSAFEM ssa/ssa_testi_fem.sh) 124 125 pism_python_test (Python:Verification:test_J_SSAFD ssa/ssa_testj_fd.sh) 126 127 pism_python_test (Python:Verification:test_J_SSAFEM ssa/ssa_testj_fem.sh) 128 129 pism_python_test (Python:Verification:SSAFEM_linear_flow ssa/ssafem_test_linear.sh) 130 131 pism_python_test (Python:Verification:SSAFEM_plug_flow ssa/ssafem_test_plug.sh) 132 133 pism_python_test (Python:Verification:test_V_SSAFD_CFBC ssa/ssa_test_cfbc_fd.sh) 134 135 pism_python_test (Python:Verification:test_V_SSAFEM_CFBC ssa/ssa_test_cfbc_fem.sh) 136 137 pism_python_test (Python:sia_forward.py test_33.sh) 138 139 # Inversion regression tests. 140 141 execute_process (COMMAND ${PYTHON_EXECUTABLE} -c "import siple" 142 RESULT_VARIABLE IMPORT_SIPLE_ERRCODE 143 OUTPUT_QUIET ERROR_QUIET) 144 145 set (Pism_HAS_SIPLE ${IMPORT_SIPLE_ERRCODE} EQUAL 0) 146 147 # Copy over commonly used files 148 foreach (FILE 149 ${PROJECT_SOURCE_DIR}/examples/inverse/make_synth_ssa.py 150 ${PROJECT_SOURCE_DIR}/examples/inverse/pismi.py 151 ${PROJECT_SOURCE_DIR}/examples/inverse/verify_ssa_inv.py 152 inverse/build_tiny.py) 153 get_filename_component(OUTPUT ${FILE} NAME) 154 configure_file (${FILE} ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT} COPYONLY) 155 endforeach() 156 157 158 if (Pism_HAS_SIPLE) # siple is installed 159 160 message (STATUS "Enabling regression tests that use siple") 161 162 pism_python_test (Python:inversion:nlcg inverse/tiny_nlcg.sh) 163 164 endif() 165 166 pism_python_test (Python:inversion:tikhonov inverse/tiny_tikhonov_lmvm.sh) 167 168 endif()