Consistent naming for gmxana tests
authorTeemu Murtola <teemu.murtola@gmail.com>
Fri, 31 Mar 2017 14:54:34 +0000 (17:54 +0300)
committerAleksei Iupinov <a.yupinov@gmail.com>
Thu, 6 Apr 2017 13:04:06 +0000 (15:04 +0200)
Move gmxana tests from legacytests/ to tests/ to make them conform with
the same approach as other tests.  Split the tests for different tools
to different test files, conforming to the name of the tool source file.
Some other minor cleanup.

Change-Id: I5df79ebe0fdb7a8fcc8057d54994ec64e531e2a4

14 files changed:
docs/doxygen/gmxtree.py
src/gromacs/gmxana/CMakeLists.txt
src/gromacs/gmxana/tests/CMakeLists.txt [moved from src/gromacs/gmxana/legacytests/CMakeLists.txt with 87% similarity]
src/gromacs/gmxana/tests/gmx_traj.cpp [new file with mode: 0644]
src/gromacs/gmxana/tests/gmx_trjconv.cpp [moved from src/gromacs/gmxana/legacytests/gmx_traj_tests.cpp with 69% similarity]
src/gromacs/gmxana/tests/spc2-traj.g96 [moved from src/gromacs/gmxana/legacytests/spc2-traj.g96 with 100% similarity]
src/gromacs/gmxana/tests/spc2-traj.gro [moved from src/gromacs/gmxana/legacytests/spc2-traj.gro with 100% similarity]
src/gromacs/gmxana/tests/spc2-traj.pdb [moved from src/gromacs/gmxana/legacytests/spc2-traj.pdb with 100% similarity]
src/gromacs/gmxana/tests/spc2-traj.tng [moved from src/gromacs/gmxana/legacytests/spc2-traj.tng with 100% similarity]
src/gromacs/gmxana/tests/spc2-traj.trr [moved from src/gromacs/gmxana/legacytests/spc2-traj.trr with 100% similarity]
src/gromacs/gmxana/tests/spc2-traj.xtc [moved from src/gromacs/gmxana/legacytests/spc2-traj.xtc with 100% similarity]
src/gromacs/gmxana/tests/spc2.gro [moved from src/gromacs/gmxana/legacytests/spc2.gro with 100% similarity]
src/gromacs/gmxana/tests/spc2.ndx [moved from src/gromacs/gmxana/legacytests/spc2.ndx with 100% similarity]
src/programs/mdrun/tests/rerun.cpp

index cb6573922684e954d535e667273bddacd43f54f3..3f98b01c6587aa7ac10faf011c43b5b37612175f 100644 (file)
@@ -2,7 +2,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2014,2015,2016, by the GROMACS development team, led by
+# Copyright (c) 2014,2015,2016,2017, 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.
@@ -410,7 +410,7 @@ class Directory(object):
         self._module = None
         self._is_test_dir = False
         if parent and parent.is_test_directory() or \
-                self._name in ('tests', 'legacytests'):
+                self._name == 'tests':
             self._is_test_dir = True
         self._is_external = False
         if parent and parent.is_external() or self._name == 'external':
index c53ff6f4e61ea99bb793f5a58c4e9e542d55c244..9d4dc6ba62382af4c49b84a34fd13d1714a0ed17 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+# Copyright (c) 2013,2014,2015,2017, 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.
@@ -41,5 +41,5 @@ gmx_install_headers(
 set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${GMXANA_SOURCES} PARENT_SCOPE)
 
 if(BUILD_TESTING)
-    add_subdirectory(legacytests)
+    add_subdirectory(tests)
 endif()
similarity index 87%
rename from src/gromacs/gmxana/legacytests/CMakeLists.txt
rename to src/gromacs/gmxana/tests/CMakeLists.txt
index 558aa174a28af6bd114942f151dfe315feb45693..4ff714b24d79a3337de7dda454584dc10731452f 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+# Copyright (c) 2013,2014,2015,2016,2017, 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.
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
-set(exename "legacy-tools-test")
+set(exename gmxana-test)
 
 gmx_add_gtest_executable(
     ${exename}
-    # files with code for test fixtures
-    gmx_traj_tests.cpp
+    gmx_traj.cpp
+    gmx_trjconv.cpp
     )
-gmx_register_gtest_test(LegacyToolsTest ${exename} INTEGRATION_TEST)
+gmx_register_gtest_test(GmxAnaTest ${exename} INTEGRATION_TEST)
diff --git a/src/gromacs/gmxana/tests/gmx_traj.cpp b/src/gromacs/gmxana/tests/gmx_traj.cpp
new file mode 100644 (file)
index 0000000..93bff45
--- /dev/null
@@ -0,0 +1,111 @@
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 2013,2014,2016,2017, 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.
+ *
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
+ *
+ * If you want to redistribute modifications to GROMACS, please
+ * consider that scientific software is very special. Version
+ * control is crucial - bugs must be traceable. We will be happy to
+ * consider code for inclusion in the official distribution, but
+ * derived work must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version at http://www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the research papers on the package. Check out http://www.gromacs.org.
+ */
+/*! \internal \file
+ * \brief
+ * Tests for gmx traj.
+ *
+ * \author Mark Abraham <mark.j.abraham@gmail.com>
+ */
+#include "gmxpre.h"
+
+#include "config.h"
+
+#include "gromacs/gmxana/gmx_ana.h"
+
+#include "testutils/cmdlinetest.h"
+#include "testutils/integrationtests.h"
+
+namespace
+{
+
+class GmxTraj : public gmx::test::IntegrationTestFixture,
+                public ::testing::WithParamInterface<const char *>
+{
+    public:
+        GmxTraj() : groFileName(fileManager_.getInputFilePath("spc2.gro")),
+                    xvgFileName(fileManager_.getTemporaryFilePath("spc2.xvg"))
+        {
+        }
+
+        int runTest(const char *fileName)
+        {
+            gmx::test::CommandLine caller;
+            caller.append("traj");
+
+            caller.addOption("-s",  groFileName);
+            caller.addOption("-ox", xvgFileName);
+
+            std::string inputTrajectoryFileName = fileManager_.getInputFilePath(fileName);
+            caller.addOption("-f", inputTrajectoryFileName);
+
+            redirectStringToStdin("0\n");
+
+            return gmx_traj(caller.argc(), caller.argv());
+        }
+
+        std::string groFileName;
+        std::string xvgFileName;
+};
+
+/* TODO These tests are actually not very effective, because gmx-traj
+ * can only return 0 or exit via gmx_fatal() (which currently also
+ * exits the test binary). So, "no XDR/TNG support in the binary"
+ * leads to the reading test appearing to pass. Still, no fatal error
+ * and no segfault is useful information while modifying such code. */
+
+TEST_P(GmxTraj, WithDifferentInputFormats)
+{
+    runTest(GetParam());
+}
+
+/*! \brief Helper array of input files present in the source repo
+ * database. These all have two identical frames of two SPC water
+ * molecules, which were generated via trjconv from the .gro
+ * version. */
+const char *const trajectoryFileNames[] = {
+    "spc2-traj.trr",
+#if GMX_USE_TNG
+    "spc2-traj.tng",
+#endif
+    "spc2-traj.xtc",
+    "spc2-traj.gro",
+    "spc2-traj.pdb",
+    "spc2-traj.g96"
+};
+
+INSTANTIATE_TEST_CASE_P(NoFatalErrorWhenWritingFrom,
+                        GmxTraj, ::testing::ValuesIn(trajectoryFileNames));
+
+} // namespace
similarity index 69%
rename from src/gromacs/gmxana/legacytests/gmx_traj_tests.cpp
rename to src/gromacs/gmxana/tests/gmx_trjconv.cpp
index 6ac20f7a110827b3dc5b2460e7ad2f14d5ed0b31..4d82156c7f706229e563d2706759fe56ecb4036b 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2013,2014,2016, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2016,2017, 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.
  */
 /*! \internal \file
  * \brief
- * Tests for gmx traj
+ * Tests for gmx trjconv.
  *
  * \author Mark Abraham <mark.j.abraham@gmail.com>
  */
-
 #include "gmxpre.h"
 
 #include "config.h"
 
 #include "gromacs/gmxana/gmx_ana.h"
-#include "gromacs/utility/arrayref.h"
 
 #include "testutils/cmdlinetest.h"
 #include "testutils/integrationtests.h"
 namespace
 {
 
-class GmxTraj : public gmx::test::IntegrationTestFixture,
-                public ::testing::WithParamInterface<const char *>
-{
-    public:
-        GmxTraj() : groFileName(fileManager_.getInputFilePath("spc2.gro")),
-                    xvgFileName(fileManager_.getTemporaryFilePath("spc2.xvg"))
-        {
-        }
-
-        int runTest(const char *fileName)
-        {
-            gmx::test::CommandLine caller;
-            caller.append("traj");
-
-            caller.addOption("-s",  groFileName);
-            caller.addOption("-ox", xvgFileName);
-
-            std::string inputTrajectoryFileName = fileManager_.getInputFilePath(fileName);
-            caller.addOption("-f", inputTrajectoryFileName);
-
-            redirectStringToStdin("0\n");
-
-            return gmx_traj(caller.argc(), caller.argv());
-        }
-
-        std::string groFileName;
-        std::string xvgFileName;
-};
-
-/* TODO These tests are actually not very effective, because gmx-traj
- * can only return 0 or exit via gmx_fatal() (which currently also
- * exits the test binary). So, "no XDR/TNG support in the binary"
- * leads to the reading test appearing to pass. Still, no fatal error
- * and no segfault is useful information while modifying such code. */
-
-TEST_P(GmxTraj, WithDifferentInputFormats)
-{
-    runTest(GetParam());
-}
-
-// ==
-
 class TrjconvWithIndexGroupSubset : public gmx::test::IntegrationTestFixture,
                                     public ::testing::WithParamInterface<const char *>
 {
@@ -133,13 +89,11 @@ TEST_P(TrjconvWithIndexGroupSubset, WithDifferentInputFormats)
     runTest(GetParam());
 }
 
-// ==
-
 /*! \brief Helper array of input files present in the source repo
  * database. These all have two identical frames of two SPC water
  * molecules, which were generated via trjconv from the .gro
  * version. */
-const char *trajectoryFileNames[] = {
+const char *const trajectoryFileNames[] = {
     "spc2-traj.trr",
 #if GMX_USE_TNG
     "spc2-traj.tng",
@@ -150,12 +104,8 @@ const char *trajectoryFileNames[] = {
     "spc2-traj.g96"
 };
 
-INSTANTIATE_TEST_CASE_P(NoFatalErrorWhenWritingFrom,
-                        GmxTraj,
-                            ::testing::ValuesIn(gmx::ArrayRef<const char*>(trajectoryFileNames)));
-
 INSTANTIATE_TEST_CASE_P(NoFatalErrorWhenWritingFrom,
                         TrjconvWithIndexGroupSubset,
-                            ::testing::ValuesIn(gmx::ArrayRef<const char*>(trajectoryFileNames)));
+                            ::testing::ValuesIn(trajectoryFileNames));
 
 } // namespace
index f2e2c7acfb2d589ed3fa6ba437e00ea410fabd6d..84368cee16e1e69b95a30946c784c6c547e34d75 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017, 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.
@@ -80,22 +80,22 @@ TEST_P(MdrunRerun, WithDifferentInputFormats)
  * database. These all have two identical frames of two SPC water
  * molecules, which were generated via trjconv from the .gro
  * version. */
-const char *trajectoryFileNames[] = {
-    "../../../gromacs/gmxana/legacytests/spc2-traj.trr",
+const char *const trajectoryFileNames[] = {
+    "../../../gromacs/gmxana/tests/spc2-traj.trr",
 #if GMX_USE_TNG
-    "../../../gromacs/gmxana/legacytests/spc2-traj.tng",
+    "../../../gromacs/gmxana/tests/spc2-traj.tng",
 #endif
-    "../../../gromacs/gmxana/legacytests/spc2-traj.xtc",
-    "../../../gromacs/gmxana/legacytests/spc2-traj.gro",
-    "../../../gromacs/gmxana/legacytests/spc2-traj.pdb",
-    "../../../gromacs/gmxana/legacytests/spc2-traj.g96"
+    "../../../gromacs/gmxana/tests/spc2-traj.xtc",
+    "../../../gromacs/gmxana/tests/spc2-traj.gro",
+    "../../../gromacs/gmxana/tests/spc2-traj.pdb",
+    "../../../gromacs/gmxana/tests/spc2-traj.g96"
 };
 // TODO later. Find a better way to manage this file database and
 // these string arrays that index it
 
 INSTANTIATE_TEST_CASE_P(NoFatalErrorFrom,
                         MdrunRerun,
-                            ::testing::ValuesIn(gmx::ArrayRef<const char*>(trajectoryFileNames)));
+                            ::testing::ValuesIn(trajectoryFileNames));
 
 /*! \todo Add other tests for mdrun -rerun, e.g.
  *