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