}
int
-MdrunTestFixture::callMdrun()
+MdrunTestFixture::callMdrun(const CommandLine &callerRef)
{
- CommandLine caller;
- caller.append("mdrun");
-
+ /* Conforming to style guide by not passing a non-const reference
+ to this function. Passing a non-const reference might make it
+ easier to write code that incorrectly re-uses callerRef after
+ the call to this function. */
+ CommandLine caller(callerRef);
caller.addOption("-s", tprFileName);
- caller.addOption("-rerun", rerunFileName);
caller.addOption("-g", logFileName);
caller.addOption("-e", edrFileName);
return gmx_mdrun(caller.argc(), caller.argv());
}
+int
+MdrunTestFixture::callMdrun()
+{
+ CommandLine caller;
+ caller.append("mdrun");
+ return callMdrun(caller);
+}
+
} // namespace test
} // namespace gmx
#include "testutils/integrationtests.h"
#include <gtest/gtest.h>
+#include "testutils/cmdlinetest.h"
namespace gmx
{
void useTopAndGroFromDatabase(const char *name);
//! Calls grompp to prepare for the mdrun test
int callGrompp();
- //! Calls mdrun for testing
+ //! Calls grompp (on this rank) to prepare for the mdrun test
+ int callGromppOnThisRank();
+ //! Calls mdrun for testing with a customized command line
+ int callMdrun(const CommandLine &callerRef);
+ /*! \brief Convenience wrapper for calling mdrun for testing
+ * with default command line */
int callMdrun();
//@{
std::string groFileName;
std::string trrFileName;
std::string xtcFileName;
- std::string rerunFileName;
std::string mdpInputFileName;
std::string mdpOutputFileName;
std::string tprFileName;
#include <gtest/gtest.h>
#include "moduletest.h"
#include "gromacs/options/filenameoption.h"
+#include "testutils/cmdlinetest.h"
namespace
{
useTopAndGroFromDatabase("spc2");
EXPECT_EQ(0, callGrompp());
- rerunFileName = fileManager_.getInputFilePath("spc2.trr");
- ASSERT_EQ(0, callMdrun());
+ std::string rerunFileName = fileManager_.getInputFilePath("spc2.trr");
+
+ ::gmx::test::CommandLine rerunCaller;
+ rerunCaller.append("mdrun");
+ rerunCaller.addOption("-rerun", rerunFileName);
+ ASSERT_EQ(0, callMdrun(rerunCaller));
}
/*! \todo Add other tests for mdrun -rerun, e.g.