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 DEPENDS run-physval-sims)
46 add_dependencies(run-ctest tests)
47 # "check-all" target builds and runs all tests, simulating the physical validation systems first.
48 add_custom_target(check-all DEPENDS run-ctest)
50 # "run-ctest-nophys" is an internal target that actually runs the tests analogously to "run-ctest".
51 # It runs all tests except the physical validation tests.
52 add_custom_target(run-ctest-nophys
53 COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -E physicalvalidationtests
54 COMMENT "Running all tests except physical validation"
55 USES_TERMINAL VERBATIM)
56 add_dependencies(run-ctest-nophys tests)
57 # "check" target builds and runs all tests except physical validation .
58 add_custom_target(check DEPENDS run-ctest-nophys)
60 # "run-ctest-phys" is an internal target that actually runs the tests analogously to "run-ctest".
61 # It only runs the physical validation tests.
62 add_custom_target(run-ctest-phys
63 COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -R physicalvalidationtests
64 COMMENT "Running physical validation tests"
65 USES_TERMINAL VERBATIM
66 DEPENDS run-physval-sims)
67 # "run-ctest-phys-analyze" is the equivalent to "run-ctest-phys" not running the physical validation simulations.
68 add_custom_target(run-ctest-phys-analyze
69 COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -R physicalvalidationtests
70 COMMENT "Running physical validation tests"
71 USES_TERMINAL VERBATIM
73 # "check-phys" target runs only physical validation tests, simulating the systems first.
74 add_custom_target(check-phys DEPENDS run-ctest-phys)
75 # "check-phys-analyze" target runs only physical validation tests, without simulating the systems first.
76 add_custom_target(check-phys-analyze DEPENDS run-ctest-phys-analyze)
78 # Calling targets "check-all" and "check-phys" does not make much sense if -DGMX_PHYSICAL_VALIDATION=OFF
79 if(NOT GMX_PHYSICAL_VALIDATION)
80 add_custom_target(missing-phys-val-phys
81 COMMAND ${CMAKE_COMMAND} -E echo "NOTE: You called the target `check-phys`, but ran cmake with\
82 `-DGMX_PHYSICAL_VALIDATION=OFF`. The physical validation tests are therefore unavailable,\
83 and this target is not testing anything."
84 DEPENDS run-ctest-phys
85 COMMENT "No physical validation" VERBATIM)
86 add_dependencies(check-phys missing-phys-val-phys)
87 add_custom_target(missing-phys-val-phys-analyze
88 COMMAND ${CMAKE_COMMAND} -E echo "NOTE: You called the target `check-phys-analyze`, but ran cmake with\
89 `-DGMX_PHYSICAL_VALIDATION=OFF`. The physical validation tests are therefore unavailable,\
90 and this target is not testing anything."
91 DEPENDS run-ctest-phys-analyze
92 COMMENT "No physical validation" VERBATIM)
93 add_dependencies(check-phys-analyze missing-phys-val-phys)
94 add_custom_target(missing-phys-val-all
95 COMMAND ${CMAKE_COMMAND} -E echo "NOTE: You called the target `check-all`, but ran cmake with\
96 `-DGMX_PHYSICAL_VALIDATION=OFF`. The physical validation tests are therefore unavailable,\
97 and this target is equivalent to a simple `make check`."
99 COMMENT "No physical validation" VERBATIM)
100 add_dependencies(check-all missing-phys-val-all)
103 # Global property for collecting notices to show at the end of the targets.
104 # Expanded to avoid to show messages about physical validation when only
105 # the other tests are ran, and vice-versa.
106 set_property(GLOBAL PROPERTY GMX_TESTS_NOTICE)
108 function (gmx_add_missing_tests_notice TEXT)
109 set_property(GLOBAL APPEND PROPERTY GMX_TESTS_NOTICE ${TEXT})
112 function (gmx_create_missing_tests_notice_target)
113 get_property(_text GLOBAL PROPERTY GMX_TESTS_NOTICE)
115 foreach (_line ${_text})
116 list(APPEND _cmds COMMAND ${CMAKE_COMMAND} -E echo "NOTE: ${_line}")
119 # checking whether any messages should be displayed
121 # Needs to be separated in two targets: should be ran *either* after run-ctest-nophys,
122 # *or* after run-ctest. I don't think there's a way to do that with a single target.
123 add_custom_target(missing-tests-notice
125 DEPENDS run-ctest-nophys
126 COMMENT "Some tests not available" VERBATIM)
127 add_dependencies(check missing-tests-notice)
128 add_custom_target(missing-tests-notice-all
131 COMMENT "Some tests not available" VERBATIM)
132 add_dependencies(check-all missing-tests-notice-all)