2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2013,2014, 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.
36 * \defgroup module_mdrun_integration_tests Integration test utilities
37 * \ingroup group_mdrun
39 * \brief Functionality for testing mdrun as a whole
41 #ifndef GMX_MDRUN_TESTS_MODULETEST_H
42 #define GMX_MDRUN_TESTS_MODULETEST_H
44 #include <gtest/gtest.h>
46 #include "testutils/cmdlinetest.h"
47 #include "testutils/integrationtests.h"
55 /*! \libinternal \brief Declares test fixture for integration tests of
58 * Derived fixture classes (or individual test cases) that might have
59 * specific requirements should assert that behaviour, rather than
60 * hard-code the requirements. A test that (for example) can't run
61 * with more than one thread should report that as a diagnostic, so the
62 * person running the test (or designing the test harness) can get
63 * feedback on what tests need what conditions without having to read
64 * the code of lots of tests.
66 * The setup phase creates various temporary files for input and
67 * output that are common for mdrun tests, using the file manager
68 * object of the parent class. Individual tests should create any
69 * extra filenames similarly, so that the test users's current working
70 * directory does not get littered with files left over from all
73 * Specifying the execution context (such as numbers of threads and
74 * processors) is normally sensible to specify from the test harness
75 * (i.e. when CMake/CTest/the user runs a test executable), because
76 * only there is information about the hardware available. The default
77 * values for such context provided in test fixtures for mdrun should
78 * mirror the defaults for mdrun, but currently mdrun.c hard-codes
79 * those in a gmx_hw_opt_t.
81 * Any method in this class may throw std::bad_alloc if out of memory.
83 * \ingroup module_mdrun_integration_tests
85 class MdrunTestFixture : public IntegrationTestFixture
89 virtual ~MdrunTestFixture();
91 //! Use an empty .mdp file as input to grompp
92 void useEmptyMdpFile();
93 //! Use a given string as input to grompp
94 void useStringAsMdpFile(const char *mdpString);
95 //! Use a given string as input to grompp
96 void useStringAsMdpFile(const std::string &mdpString);
97 //! Use a string as -n input to grompp
98 void useStringAsNdxFile(const char *ndxString);
99 //! Use a standard .top and .gro file as input to grompp
100 void useTopGroAndNdxFromDatabase(const char *name);
101 //! Calls grompp (on rank 0) to prepare for the mdrun test
103 //! Calls grompp (on this rank) to prepare for the mdrun test
104 int callGromppOnThisRank();
105 //! Calls mdrun for testing with a customized command line
106 int callMdrun(const CommandLine &callerRef);
107 /*! \brief Convenience wrapper for calling mdrun for testing
108 * with default command line */
112 /*! \name Names for frequently used grompp and mdrun output files
114 * These strings can be set to point to files present in the
115 * source tree, or to temporary files created for the test
116 * fixture. In the latter case,
117 * IntegrationTestFixture::fileManager_ should be used to fill
118 * these strings with paths to files, so that they are created
119 * in a temporary directory and (by default behaviour of
120 * TestFileManager) deleted when the test is complete.
122 std::string topFileName;
123 std::string groFileName;
124 std::string fullPrecisionTrajectoryFileName;
125 std::string reducedPrecisionTrajectoryFileName;
126 std::string groOutputFileName;
127 std::string ndxFileName;
128 std::string mdpInputFileName;
129 std::string mdpOutputFileName;
130 std::string tprFileName;
131 std::string logFileName;
132 std::string edrFileName;
133 std::string cptFileName;
134 std::string swapFileName;
139 /*! \libinternal \brief
140 * Parameterized test fixture for mdrun integration tests
142 class ParameterizedMdrunTestFixture : public gmx::test::MdrunTestFixture,
143 public ::testing::WithParamInterface<const char *>