Sort includes outside src/gromacs
[alexxy/gromacs.git] / src / testutils / testoptions.cpp
index 943e7deb4ccbd315c19ca392376a76fb31475a53..a46d8875c37797a55813eb2eefff52aad683f464 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2012,2013, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -39,6 +39,8 @@
  * \author Teemu Murtola <teemu.murtola@gmail.com>
  * \ingroup module_testutils
  */
+#include "gmxpre.h"
+
 #include "testoptions.h"
 
 #include <cstdio>
 
 #include <gmock/gmock.h>
 
-#include "gromacs/legacyheaders/thread_mpi/mutex.h"
+#include "thread_mpi/mutex.h"
 
 #include "gromacs/commandline/cmdlinehelpcontext.h"
 #include "gromacs/commandline/cmdlinehelpwriter.h"
+#include "gromacs/commandline/cmdlineinit.h"
 #include "gromacs/commandline/cmdlineparser.h"
 #include "gromacs/options/basicoptions.h"
 #include "gromacs/options/options.h"
 #include "gromacs/utility/errorcodes.h"
 #include "gromacs/utility/exceptions.h"
 #include "gromacs/utility/file.h"
-#include "gromacs/utility/init.h"
+#include "gromacs/utility/programcontext.h"
 
-#include "refdata.h"
-#include "testfilemanager.h"
-#include "mpi-printer.h"
+#include "testutils/mpi-printer.h"
+#include "testutils/refdata.h"
+#include "testutils/testfilemanager.h"
 
 namespace gmx
 {
@@ -74,7 +77,7 @@ namespace
 {
 
 /*! \brief
- * Singleton registry for test options added with GMX_TEST_OPTIONS.
+ * Singleton registry for test options added with #GMX_TEST_OPTIONS.
  *
  * \ingroup module_testutils
  */
@@ -129,6 +132,7 @@ void printHelp(const Options &options)
                  "to control the behavior of the tests:\n\n");
     CommandLineHelpContext context(&File::standardError(),
                                    eHelpOutputFormat_Console, NULL);
+    context.setModuleDisplayName(getProgramContext().displayName());
     CommandLineHelpWriter(options).writeHelp(context);
 }
 
@@ -141,9 +145,9 @@ void registerTestOptions(const char *name, TestOptionsProvider *provider)
 
 void initTestUtils(const char *dataPath, const char *tempPath, int *argc, char ***argv)
 {
+    gmx::initForCommandLine(argc, argv);
     try
     {
-        gmx::init(argc, argv);
         ::testing::InitGoogleMock(argc, *argv);
         if (dataPath != NULL)
         {
@@ -151,7 +155,7 @@ void initTestUtils(const char *dataPath, const char *tempPath, int *argc, char *
         }
         if (tempPath != NULL)
         {
-            TestFileManager::setOutputTempDirectory(tempPath);
+            TestFileManager::setGlobalOutputTempDirectory(tempPath);
         }
         bool    bHelp = false;
         Options options(NULL, NULL);
@@ -191,7 +195,7 @@ void initTestUtils(const char *dataPath, const char *tempPath, int *argc, char *
 
 void finalizeTestUtils()
 {
-    gmx::finalize();
+    gmx::finalizeForCommandLine();
 }
 
 } // namespace test