2 # This file is part of the GROMACS molecular simulation package.
4 # Copyright (c) 2014,2016,2017, by the GROMACS development team, led by
5 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 # and including many others, as listed in the AUTHORS file in the
7 # top-level source directory and at http://www.gromacs.org.
9 # GROMACS is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU Lesser General Public License
11 # as published by the Free Software Foundation; either version 2.1
12 # of the License, or (at your option) any later version.
14 # GROMACS is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # Lesser General Public License for more details.
19 # You should have received a copy of the GNU Lesser General Public
20 # License along with GROMACS; if not, see
21 # http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 # If you want to redistribute modifications to GROMACS, please
25 # consider that scientific software is very special. Version
26 # control is crucial - bugs must be traceable. We will be happy to
27 # consider code for inclusion in the official distribution, but
28 # derived work must not be called official GROMACS. Details are found
29 # in the README & COPYING files - if they are missing, get the
30 # official version at http://www.gromacs.org.
32 # To help us fund GROMACS development, we humbly ask that you cite
33 # the research papers on the package. Check out http://www.gromacs.org.
35 # "tests" target builds all the separate test binaries.
36 add_custom_target(tests)
38 # "run-ctest" is an internal target that actually runs the tests.
39 # This is necessary to be able to add separate targets that execute as part
40 # of 'make check', but are ensured to be executed after the actual tests.
41 add_custom_target(run-ctest
42 COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure
43 COMMENT "Running all tests"
44 USES_TERMINAL VERBATIM)
45 add_dependencies(run-ctest tests)
46 # "check-all" target builds and runs all tests.
47 add_custom_target(check-all DEPENDS run-ctest)
48 # "check-all-run" target builds and runs all tests, simulating the physical validation systems first.
49 add_custom_target(check-all-run DEPENDS run-phys-tests check-all)
51 # "run-ctest-nophys" is an internal target that actually runs the tests in analogy to "run-ctest".
52 # It runs all tests except the physical validation tests.
53 add_custom_target(run-ctest-nophys
54 COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -E physicalvalidationtests
55 COMMENT "Running all tests except physical validation"
56 USES_TERMINAL VERBATIM)
57 add_dependencies(run-ctest-nophys tests)
58 # "check" target builds and runs all tests except physical validation .
59 add_custom_target(check DEPENDS run-ctest-nophys)
61 # "run-ctest-phys" is an internal target that actually runs the tests in analogy to "run-ctest".
62 # It only runs the physical validation tests.
63 add_custom_target(run-ctest-phys
64 COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -R physicalvalidationtests
65 COMMENT "Running physical validation tests"
66 USES_TERMINAL VERBATIM)
67 # "check-phys" target runs only physical validation tests.
68 add_custom_target(check-phys DEPENDS run-ctest-phys)
69 # "check-phys-run" target runs only physical validation tests, simulating the systems first
70 add_custom_target(check-phys-run DEPENDS run-phys-tests check-phys)
71 # "check-phys-prepare" target does only prepare physical validation runs, to be ran externally.
72 add_custom_target(check-phys-prepare DEPENDS prepare-phys-tests)
75 # Calling targets "check-all" and "check-phys" does not make much sense if -DGMX_PHYSICAL_VALIDATION=OFF
76 if(NOT GMX_PHYSICAL_VALIDATION)
77 add_custom_target(missing-phys-val-phys
78 COMMAND ${CMAKE_COMMAND} -E echo "NOTE: You called the target `check-phys`, but ran cmake with\
79 `-DGMX_PHYSICAL_VALIDATION=OFF`. The physical validation tests are therefore unavailable,\
80 and this target is not testing anything."
81 DEPENDS run-ctest-phys
82 COMMENT "No physical validation" VERBATIM)
83 add_dependencies(check-phys missing-phys-val-phys)
84 add_custom_target(missing-phys-val-all
85 COMMAND ${CMAKE_COMMAND} -E echo "NOTE: You called the target `check-all`, but ran cmake with\
86 `-DGMX_PHYSICAL_VALIDATION=OFF`. The physical validation tests are therefore unavailable,\
87 and this target is equivalent to a simple `make check`."
89 COMMENT "No physical validation" VERBATIM)
90 add_dependencies(check-all missing-phys-val-all)
93 # Global property for collecting notices to show at the end of the targets.
94 # Expanded to avoid to show messages about physical validation when only
95 # the other tests are ran, and vice-versa.
96 set_property(GLOBAL PROPERTY GMX_TESTS_NOTICE)
98 function (gmx_add_missing_tests_notice TEXT)
99 set_property(GLOBAL APPEND PROPERTY GMX_TESTS_NOTICE ${TEXT})
102 function (gmx_create_missing_tests_notice_target)
103 get_property(_text GLOBAL PROPERTY GMX_TESTS_NOTICE)
105 foreach (_line ${_text})
106 list(APPEND _cmds COMMAND ${CMAKE_COMMAND} -E echo "NOTE: ${_line}")
109 # checking whether any messages should be displayed
111 # Needs to be separated in two targets: should be ran *either* after run-ctest-nophys,
112 # *or* after run-ctest. I don't think there's a way to do that with a single target.
113 add_custom_target(missing-tests-notice
115 DEPENDS run-ctest-nophys
116 COMMENT "Some tests not available" VERBATIM)
117 add_dependencies(check missing-tests-notice)
118 add_custom_target(missing-tests-notice-all
121 COMMENT "Some tests not available" VERBATIM)
122 add_dependencies(check-all missing-tests-notice-all)