From 9f8e11f30c49cf5afc05a5cbb11e9cfe1aa62f27 Mon Sep 17 00:00:00 2001 From: "M. Eric Irrgang" Date: Tue, 17 Nov 2020 16:53:02 +0000 Subject: [PATCH] Separate the testutils module. Create `testutils` target and separate public/private headers. Remove `src/` from global build tree include path. Apply some tidying demanded by clang-tidy. Ref #3288 --- CMakeLists.txt | 3 - .../trajectoryanalysis/tests/CMakeLists.txt | 6 +- src/programs/CMakeLists.txt | 4 +- src/testutils/CMakeLists.txt | 93 ++++++++++--------- src/testutils/TestMacros.cmake | 6 +- src/testutils/cmdlinetest.cpp | 2 +- src/testutils/conftest.cpp | 4 +- src/testutils/filematchers.cpp | 4 +- .../{ => include/testutils}/cmdlinetest.h | 0 .../{ => include/testutils}/conftest.h | 2 +- .../{ => include/testutils}/filematchers.h | 2 +- .../{ => include/testutils}/interactivetest.h | 2 +- .../{ => include/testutils}/loggertest.h | 2 +- .../{ => include/testutils}/mpitest.h | 2 +- .../{ => include/testutils}/refdata.h | 0 .../{ => include/testutils}/setenv.h | 2 +- .../testutils}/simulationdatabase.h | 2 +- .../{ => include/testutils}/stdiohelper.h | 2 +- .../{ => include/testutils}/stringtest.h | 2 +- .../{ => include/testutils}/test_device.h | 0 .../testutils}/test_hardware_environment.h | 0 .../{ => include/testutils}/testasserts.h | 0 .../{ => include/testutils}/testexceptions.h | 2 +- .../{ => include/testutils}/testfilemanager.h | 0 .../testutils}/testfileredirector.h | 2 +- .../{ => include/testutils}/testinit.h | 0 .../{ => include/testutils}/testmatchers.h | 0 .../{ => include/testutils}/testoptions.h | 0 .../testutils}/textblockmatchers.h | 2 +- .../testutils}/tprfilegenerator.h | 2 +- .../{ => include/testutils}/xvgtest.h | 2 +- src/testutils/interactivetest.cpp | 4 +- src/testutils/loggertest.cpp | 4 +- src/testutils/mpitest.cpp | 4 +- src/testutils/refdata.cpp | 9 +- src/testutils/refdata_checkers.h | 5 +- src/testutils/refdata_xml.cpp | 5 +- src/testutils/refdata_xml.h | 4 +- src/testutils/simulationdatabase.cpp | 4 +- src/testutils/stdiohelper.cpp | 4 +- src/testutils/stringtest.cpp | 4 +- src/testutils/test_device.cpp | 2 +- src/testutils/test_hardware_environment.cpp | 2 +- src/testutils/testasserts.cpp | 4 +- src/testutils/testfilemanager.cpp | 9 +- src/testutils/testfileredirector.cpp | 4 +- src/testutils/testinit.cpp | 5 +- src/testutils/testmatchers.cpp | 2 +- src/testutils/testoptions.cpp | 4 +- src/testutils/tests/CMakeLists.txt | 2 + src/testutils/textblockmatchers.cpp | 4 +- src/testutils/tprfilegenerator.cpp | 4 +- src/testutils/xvgtest.cpp | 4 +- 53 files changed, 127 insertions(+), 116 deletions(-) rename src/testutils/{ => include/testutils}/cmdlinetest.h (100%) rename src/testutils/{ => include/testutils}/conftest.h (97%) rename src/testutils/{ => include/testutils}/filematchers.h (98%) rename src/testutils/{ => include/testutils}/interactivetest.h (98%) rename src/testutils/{ => include/testutils}/loggertest.h (97%) rename src/testutils/{ => include/testutils}/mpitest.h (98%) rename src/testutils/{ => include/testutils}/refdata.h (100%) rename src/testutils/{ => include/testutils}/setenv.h (97%) rename src/testutils/{ => include/testutils}/simulationdatabase.h (98%) rename src/testutils/{ => include/testutils}/stdiohelper.h (97%) rename src/testutils/{ => include/testutils}/stringtest.h (97%) rename src/testutils/{ => include/testutils}/test_device.h (100%) rename src/testutils/{ => include/testutils}/test_hardware_environment.h (100%) rename src/testutils/{ => include/testutils}/testasserts.h (100%) rename src/testutils/{ => include/testutils}/testexceptions.h (97%) rename src/testutils/{ => include/testutils}/testfilemanager.h (100%) rename src/testutils/{ => include/testutils}/testfileredirector.h (98%) rename src/testutils/{ => include/testutils}/testinit.h (100%) rename src/testutils/{ => include/testutils}/testmatchers.h (100%) rename src/testutils/{ => include/testutils}/testoptions.h (100%) rename src/testutils/{ => include/testutils}/textblockmatchers.h (98%) rename src/testutils/{ => include/testutils}/tprfilegenerator.h (97%) rename src/testutils/{ => include/testutils}/xvgtest.h (98%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8884423152..945cacd0c9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -602,10 +602,7 @@ gmx_add_cache_dependency(GMX_BUILD_UNITTESTS BOOL BUILD_TESTING OFF) # Our own GROMACS tests ######################################################################## -include_directories(BEFORE ${CMAKE_SOURCE_DIR}/src) include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/src/external) -# Required for config.h, maybe should only be set in src/CMakeLists.txt -include_directories(BEFORE ${CMAKE_BINARY_DIR}/src) include(gmxTestInlineASM) gmx_test_inline_asm_gcc_x86(GMX_X86_GCC_INLINE_ASM) diff --git a/src/gromacs/trajectoryanalysis/tests/CMakeLists.txt b/src/gromacs/trajectoryanalysis/tests/CMakeLists.txt index 20c5b9386e..ec69fddd66 100644 --- a/src/gromacs/trajectoryanalysis/tests/CMakeLists.txt +++ b/src/gromacs/trajectoryanalysis/tests/CMakeLists.txt @@ -59,5 +59,9 @@ target_link_libraries(trajectoryanalysis-test PRIVATE analysisdata-test-shared) target_link_libraries(trajectoryanalysis-test PRIVATE common) add_executable(test_selection ${UNITTEST_TARGET_OPTIONS} test_selection.cpp) +target_link_libraries(test_selection PRIVATE + common + libgromacs + ${GMX_EXE_LINKER_FLAGS}) # TODO: Explicitly link to module dependencies. -target_link_libraries(test_selection PRIVATE common libgromacs legacy_modules ${GMX_EXE_LINKER_FLAGS}) +target_link_libraries(test_selection PRIVATE legacy_modules) diff --git a/src/programs/CMakeLists.txt b/src/programs/CMakeLists.txt index 1b29eb711b..f1209b75aa 100644 --- a/src/programs/CMakeLists.txt +++ b/src/programs/CMakeLists.txt @@ -44,7 +44,7 @@ target_include_directories(mdrun_objlib SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/src target_link_libraries(mdrun_objlib PRIVATE common) target_link_libraries(mdrun_objlib PRIVATE legacy_api) # TODO: Explicitly link specific modules. -target_link_libraries(mdrun_objlib PRIVATE common legacy_modules) +target_link_libraries(mdrun_objlib PRIVATE legacy_modules) if(GMX_FAHCORE) # The lack of a real source file here alongside the object library @@ -95,8 +95,8 @@ else() gmx_target_compile_options(gmx) target_compile_definitions(gmx PRIVATE HAVE_CONFIG_H) target_link_libraries(gmx PRIVATE - libgromacs common + libgromacs ${GMX_COMMON_LIBRARIES} ${GMX_EXE_LINKER_FLAGS}) if(GMX_X11) diff --git a/src/testutils/CMakeLists.txt b/src/testutils/CMakeLists.txt index 8b4c6f16b2..fa52d3c840 100644 --- a/src/testutils/CMakeLists.txt +++ b/src/testutils/CMakeLists.txt @@ -38,42 +38,12 @@ if (NOT GMX_BUILD_UNITTESTS) return() endif() -set(TESTUTILS_SOURCES - cmdlinetest.cpp - conftest.cpp - filematchers.cpp - interactivetest.cpp - loggertest.cpp - mpi_printer.cpp - mpitest.cpp - refdata.cpp - refdata_xml.cpp - simulationdatabase.cpp - stdiohelper.cpp - stringtest.cpp - testasserts.cpp - testfilemanager.cpp - testfileredirector.cpp - test_device.cpp - test_hardware_environment.cpp - testinit.cpp - testmatchers.cpp - testoptions.cpp - textblockmatchers.cpp - tprfilegenerator.cpp - xvgtest.cpp - ) - -if(NOT HAVE_TINYXML2) - list(APPEND TESTUTILS_SOURCES ../external/tinyxml2/tinyxml2.cpp) -endif() - if (GMX_GPU_CUDA) # Work around FindCUDA that prevents using target_link_libraries() # with keywords otherwise... set(CUDA_LIBRARIES PRIVATE ${CUDA_LIBRARIES}) if (NOT GMX_CLANG_CUDA) - gmx_cuda_add_library(testutils ${TESTUTILS_SOURCES}) + gmx_cuda_add_library(testutils) else() set_source_files_properties(test_device.cpp PROPERTIES CUDA_SOURCE_PROPERTY_FORMAT OBJ) gmx_compile_cuda_file_with_clang(test_device.cpp) @@ -82,10 +52,53 @@ if (GMX_GPU_CUDA) endif() target_link_libraries(testutils PRIVATE ${CUDA_CUFFT_LIBRARIES}) else() - add_library(testutils STATIC ${UNITTEST_TARGET_OPTIONS} ${TESTUTILS_SOURCES}) + add_library(testutils STATIC ${UNITTEST_TARGET_OPTIONS}) +endif() + +# Module interface / provided facilities +target_include_directories(testutils PUBLIC include) + +# Executable targets for tests based on `testutils` acquire the source for +# their entry point from unittest_main.cpp when linking to the `testutils` target. +target_sources(testutils INTERFACE unittest_main.cpp) + + +target_sources(testutils PRIVATE + cmdlinetest.cpp + conftest.cpp + filematchers.cpp + interactivetest.cpp + loggertest.cpp + mpi_printer.cpp + mpitest.cpp + refdata.cpp + refdata_xml.cpp + simulationdatabase.cpp + stdiohelper.cpp + stringtest.cpp + testasserts.cpp + testfilemanager.cpp + testfileredirector.cpp + test_device.cpp + test_hardware_environment.cpp + testinit.cpp + testmatchers.cpp + testoptions.cpp + textblockmatchers.cpp + tprfilegenerator.cpp + xvgtest.cpp + ) + + +if(HAVE_TINYXML2) + target_include_directories(testutils SYSTEM PRIVATE ${TinyXML2_INCLUDE_DIR}) + target_link_libraries(testutils PRIVATE ${TinyXML2_LIBRARIES}) +else() + target_include_directories(testutils SYSTEM BEFORE PRIVATE ${CMAKE_SOURCE_DIR}/src/external/tinyxml2) + target_sources(testutils PRIVATE ${CMAKE_SOURCE_DIR}/src/external/tinyxml2/tinyxml2.cpp) endif() -# TODO: Use a non-degenerate interface include directory. -target_include_directories(testutils PUBLIC ${CMAKE_SOURCE_DIR}/src) + +target_include_directories(testutils PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) if (GMX_GPU_SYCL) set_source_files_properties(test_device.cpp @@ -98,12 +111,10 @@ target_include_directories(testutils SYSTEM BEFORE PRIVATE ${PROJECT_SOURCE_DIR} target_link_libraries(testutils PRIVATE libgromacs ${GMX_COMMON_LIBRARIES} gmock) target_link_libraries(testutils PUBLIC common) -if(HAVE_TINYXML2) - include_directories(SYSTEM ${TinyXML2_INCLUDE_DIR}) - target_link_libraries(testutils PRIVATE ${TinyXML2_LIBRARIES}) -else() - include_directories(BEFORE SYSTEM "../external/tinyxml2") -endif() +# GROMACS module dependencies. +# Note that testutils conveys transitive dependencies on some modules. +# TODO: Explicitly link specific modules with minimal exposure. +target_link_libraries(testutils PUBLIC legacy_modules) # TODO Use gmx_add_missing_tests_notice() instead of the messages below. set(GMX_CAN_RUN_MPI_TESTS 1) @@ -131,8 +142,6 @@ elseif (NOT GMX_THREAD_MPI) set(GMX_CAN_RUN_MPI_TESTS 0) endif() -set(TESTUTILS_DIR ${CMAKE_CURRENT_SOURCE_DIR}) -set(TESTUTILS_DIR ${TESTUTILS_DIR} PARENT_SCOPE) set(GMX_CAN_RUN_MPI_TESTS ${GMX_CAN_RUN_MPI_TESTS} PARENT_SCOPE) add_subdirectory(tests) diff --git a/src/testutils/TestMacros.cmake b/src/testutils/TestMacros.cmake index e5c4c33190..5f29e65402 100644 --- a/src/testutils/TestMacros.cmake +++ b/src/testutils/TestMacros.cmake @@ -119,12 +119,10 @@ function (gmx_add_gtest_executable EXENAME) cuda_add_executable(${EXENAME} ${UNITTEST_TARGET_OPTIONS} ${ARG_CPP_SOURCE_FILES} ${ARG_CUDA_CU_SOURCE_FILES} - ${ARG_GPU_CPP_SOURCE_FILES} - ${TESTUTILS_DIR}/unittest_main.cpp) + ${ARG_GPU_CPP_SOURCE_FILES}) else() add_executable(${EXENAME} ${UNITTEST_TARGET_OPTIONS} - ${ARG_CPP_SOURCE_FILES} - ${TESTUTILS_DIR}/unittest_main.cpp) + ${ARG_CPP_SOURCE_FILES}) endif() if (GMX_GPU_CUDA) diff --git a/src/testutils/cmdlinetest.cpp b/src/testutils/cmdlinetest.cpp index 1c6bdc0f9f..9746d3ba51 100644 --- a/src/testutils/cmdlinetest.cpp +++ b/src/testutils/cmdlinetest.cpp @@ -42,7 +42,7 @@ */ #include "gmxpre.h" -#include "cmdlinetest.h" +#include "testutils/cmdlinetest.h" #include #include diff --git a/src/testutils/conftest.cpp b/src/testutils/conftest.cpp index e7be0564a9..3fd50276cb 100644 --- a/src/testutils/conftest.cpp +++ b/src/testutils/conftest.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2017,2018,2019, by the GROMACS development team, led by + * Copyright (c) 2017,2018,2019,2020, 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,7 +41,7 @@ */ #include "gmxpre.h" -#include "conftest.h" +#include "testutils/conftest.h" #include #include diff --git a/src/testutils/filematchers.cpp b/src/testutils/filematchers.cpp index d836f4e6fc..a312dddd0f 100644 --- a/src/testutils/filematchers.cpp +++ b/src/testutils/filematchers.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2017,2018,2019, by the GROMACS development team, led by + * Copyright (c) 2017,2018,2019,2020, 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,7 +41,7 @@ */ #include "gmxpre.h" -#include "filematchers.h" +#include "testutils/filematchers.h" #include "gromacs/utility/filestream.h" diff --git a/src/testutils/cmdlinetest.h b/src/testutils/include/testutils/cmdlinetest.h similarity index 100% rename from src/testutils/cmdlinetest.h rename to src/testutils/include/testutils/cmdlinetest.h diff --git a/src/testutils/conftest.h b/src/testutils/include/testutils/conftest.h similarity index 97% rename from src/testutils/conftest.h rename to src/testutils/include/testutils/conftest.h index c8c7c14dc3..d22033c537 100644 --- a/src/testutils/conftest.h +++ b/src/testutils/include/testutils/conftest.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2017,2018,2019, by the GROMACS development team, led by + * Copyright (c) 2017,2018,2019,2020, 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. diff --git a/src/testutils/filematchers.h b/src/testutils/include/testutils/filematchers.h similarity index 98% rename from src/testutils/filematchers.h rename to src/testutils/include/testutils/filematchers.h index 84201794a5..921d44709f 100644 --- a/src/testutils/filematchers.h +++ b/src/testutils/include/testutils/filematchers.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2017,2018,2019, by the GROMACS development team, led by + * Copyright (c) 2017,2018,2019,2020, 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. diff --git a/src/testutils/interactivetest.h b/src/testutils/include/testutils/interactivetest.h similarity index 98% rename from src/testutils/interactivetest.h rename to src/testutils/include/testutils/interactivetest.h index 6e0e279deb..eeed955928 100644 --- a/src/testutils/interactivetest.h +++ b/src/testutils/include/testutils/interactivetest.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2015,2017,2019, by the GROMACS development team, led by + * Copyright (c) 2015,2017,2019,2020, 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. diff --git a/src/testutils/loggertest.h b/src/testutils/include/testutils/loggertest.h similarity index 97% rename from src/testutils/loggertest.h rename to src/testutils/include/testutils/loggertest.h index 5fe63949ce..29c5ee5335 100644 --- a/src/testutils/loggertest.h +++ b/src/testutils/include/testutils/loggertest.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2016,2017,2019, by the GROMACS development team, led by + * Copyright (c) 2016,2017,2019,2020, 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. diff --git a/src/testutils/mpitest.h b/src/testutils/include/testutils/mpitest.h similarity index 98% rename from src/testutils/mpitest.h rename to src/testutils/include/testutils/mpitest.h index dbb640a933..e769fbfa90 100644 --- a/src/testutils/mpitest.h +++ b/src/testutils/include/testutils/mpitest.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2016,2019, by the GROMACS development team, led by + * Copyright (c) 2016,2019,2020, 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. diff --git a/src/testutils/refdata.h b/src/testutils/include/testutils/refdata.h similarity index 100% rename from src/testutils/refdata.h rename to src/testutils/include/testutils/refdata.h diff --git a/src/testutils/setenv.h b/src/testutils/include/testutils/setenv.h similarity index 97% rename from src/testutils/setenv.h rename to src/testutils/include/testutils/setenv.h index 588d93f921..fc577ee3d4 100644 --- a/src/testutils/setenv.h +++ b/src/testutils/include/testutils/setenv.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2019, by the GROMACS development team, led by + * Copyright (c) 2019,2020, 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. diff --git a/src/testutils/simulationdatabase.h b/src/testutils/include/testutils/simulationdatabase.h similarity index 98% rename from src/testutils/simulationdatabase.h rename to src/testutils/include/testutils/simulationdatabase.h index 11b1e428d9..04f89b0a46 100644 --- a/src/testutils/simulationdatabase.h +++ b/src/testutils/include/testutils/simulationdatabase.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2018,2019, by the GROMACS development team, led by + * Copyright (c) 2018,2019,2020, 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. diff --git a/src/testutils/stdiohelper.h b/src/testutils/include/testutils/stdiohelper.h similarity index 97% rename from src/testutils/stdiohelper.h rename to src/testutils/include/testutils/stdiohelper.h index 6cb8b68947..c46df9bf5f 100644 --- a/src/testutils/stdiohelper.h +++ b/src/testutils/include/testutils/stdiohelper.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2013,2014,2017,2019, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2017,2019,2020, 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. diff --git a/src/testutils/stringtest.h b/src/testutils/include/testutils/stringtest.h similarity index 97% rename from src/testutils/stringtest.h rename to src/testutils/include/testutils/stringtest.h index edf09974a1..597078d536 100644 --- a/src/testutils/stringtest.h +++ b/src/testutils/include/testutils/stringtest.h @@ -120,7 +120,7 @@ public: * \param[in] refFilename File with the expected contents. * \param[in] testFilename File with the contents to be tested. */ - void testFilesEqual(const std::string& refFilename, const std::string& testFilename); + static void testFilesEqual(const std::string& refFilename, const std::string& testFilename); private: class Impl; diff --git a/src/testutils/test_device.h b/src/testutils/include/testutils/test_device.h similarity index 100% rename from src/testutils/test_device.h rename to src/testutils/include/testutils/test_device.h diff --git a/src/testutils/test_hardware_environment.h b/src/testutils/include/testutils/test_hardware_environment.h similarity index 100% rename from src/testutils/test_hardware_environment.h rename to src/testutils/include/testutils/test_hardware_environment.h diff --git a/src/testutils/testasserts.h b/src/testutils/include/testutils/testasserts.h similarity index 100% rename from src/testutils/testasserts.h rename to src/testutils/include/testutils/testasserts.h diff --git a/src/testutils/testexceptions.h b/src/testutils/include/testutils/testexceptions.h similarity index 97% rename from src/testutils/testexceptions.h rename to src/testutils/include/testutils/testexceptions.h index edbdd6b6fa..86ea316a94 100644 --- a/src/testutils/testexceptions.h +++ b/src/testutils/include/testutils/testexceptions.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2011,2012,2015,2018,2019, by the GROMACS development team, led by + * Copyright (c) 2011,2012,2015,2018,2019,2020, 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. diff --git a/src/testutils/testfilemanager.h b/src/testutils/include/testutils/testfilemanager.h similarity index 100% rename from src/testutils/testfilemanager.h rename to src/testutils/include/testutils/testfilemanager.h diff --git a/src/testutils/testfileredirector.h b/src/testutils/include/testutils/testfileredirector.h similarity index 98% rename from src/testutils/testfileredirector.h rename to src/testutils/include/testutils/testfileredirector.h index 5e34af133b..19dfa499f4 100644 --- a/src/testutils/testfileredirector.h +++ b/src/testutils/include/testutils/testfileredirector.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2015,2018,2019, by the GROMACS development team, led by + * Copyright (c) 2015,2018,2019,2020, 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. diff --git a/src/testutils/testinit.h b/src/testutils/include/testutils/testinit.h similarity index 100% rename from src/testutils/testinit.h rename to src/testutils/include/testutils/testinit.h diff --git a/src/testutils/testmatchers.h b/src/testutils/include/testutils/testmatchers.h similarity index 100% rename from src/testutils/testmatchers.h rename to src/testutils/include/testutils/testmatchers.h diff --git a/src/testutils/testoptions.h b/src/testutils/include/testutils/testoptions.h similarity index 100% rename from src/testutils/testoptions.h rename to src/testutils/include/testutils/testoptions.h diff --git a/src/testutils/textblockmatchers.h b/src/testutils/include/testutils/textblockmatchers.h similarity index 98% rename from src/testutils/textblockmatchers.h rename to src/testutils/include/testutils/textblockmatchers.h index 6eb6be88e9..67cb5b95bb 100644 --- a/src/testutils/textblockmatchers.h +++ b/src/testutils/include/testutils/textblockmatchers.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2015,2018,2019, by the GROMACS development team, led by + * Copyright (c) 2015,2018,2019,2020, 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. diff --git a/src/testutils/tprfilegenerator.h b/src/testutils/include/testutils/tprfilegenerator.h similarity index 97% rename from src/testutils/tprfilegenerator.h rename to src/testutils/include/testutils/tprfilegenerator.h index 2073eccfd6..ece2bfe3fa 100644 --- a/src/testutils/tprfilegenerator.h +++ b/src/testutils/include/testutils/tprfilegenerator.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2019, by the GROMACS development team, led by + * Copyright (c) 2019,2020, 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. diff --git a/src/testutils/xvgtest.h b/src/testutils/include/testutils/xvgtest.h similarity index 98% rename from src/testutils/xvgtest.h rename to src/testutils/include/testutils/xvgtest.h index 1812cc328d..5783fff1ed 100644 --- a/src/testutils/xvgtest.h +++ b/src/testutils/include/testutils/xvgtest.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2015,2018,2019, by the GROMACS development team, led by + * Copyright (c) 2015,2018,2019,2020, 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. diff --git a/src/testutils/interactivetest.cpp b/src/testutils/interactivetest.cpp index 897a01660e..e28dbd751d 100644 --- a/src/testutils/interactivetest.cpp +++ b/src/testutils/interactivetest.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2015,2016,2017,2018,2019, by the GROMACS development team, led by + * Copyright (c) 2015,2016,2017,2018,2019,2020, 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,7 +41,7 @@ */ #include "gmxpre.h" -#include "interactivetest.h" +#include "testutils/interactivetest.h" #include #include diff --git a/src/testutils/loggertest.cpp b/src/testutils/loggertest.cpp index c090c3b2f7..c534f3c0a9 100644 --- a/src/testutils/loggertest.cpp +++ b/src/testutils/loggertest.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2016,2017,2019, by the GROMACS development team, led by + * Copyright (c) 2016,2017,2019,2020, 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,7 +41,7 @@ */ #include "gmxpre.h" -#include "loggertest.h" +#include "testutils/loggertest.h" #include diff --git a/src/testutils/mpitest.cpp b/src/testutils/mpitest.cpp index 63b04b9ce6..7c11477f54 100644 --- a/src/testutils/mpitest.cpp +++ b/src/testutils/mpitest.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2016,2018,2019, by the GROMACS development team, led by + * Copyright (c) 2016,2018,2019,2020, 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,7 +41,7 @@ */ #include "gmxpre.h" -#include "mpitest.h" +#include "testutils/mpitest.h" #include "config.h" diff --git a/src/testutils/refdata.cpp b/src/testutils/refdata.cpp index 8c92d6754f..6f44673a64 100644 --- a/src/testutils/refdata.cpp +++ b/src/testutils/refdata.cpp @@ -42,7 +42,7 @@ */ #include "gmxpre.h" -#include "refdata.h" +#include "testutils/refdata.h" #include #include @@ -64,13 +64,14 @@ #include "gromacs/utility/real.h" #include "gromacs/utility/stringutil.h" -#include "testutils/refdata_checkers.h" -#include "testutils/refdata_impl.h" -#include "testutils/refdata_xml.h" #include "testutils/testasserts.h" #include "testutils/testexceptions.h" #include "testutils/testfilemanager.h" +#include "refdata_checkers.h" +#include "refdata_impl.h" +#include "refdata_xml.h" + namespace gmx { namespace test diff --git a/src/testutils/refdata_checkers.h b/src/testutils/refdata_checkers.h index f8c69f791a..9b5c7c2faa 100644 --- a/src/testutils/refdata_checkers.h +++ b/src/testutils/refdata_checkers.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2015,2016,2017,2018,2019, by the GROMACS development team, led by + * Copyright (c) 2015,2016,2017,2018,2019,2020, 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. @@ -55,10 +55,11 @@ #include "gromacs/utility/strconvert.h" #include "gromacs/utility/stringutil.h" -#include "testutils/refdata_impl.h" #include "testutils/testasserts.h" #include "testutils/testexceptions.h" +#include "refdata_impl.h" + namespace gmx { namespace test diff --git a/src/testutils/refdata_xml.cpp b/src/testutils/refdata_xml.cpp index 4d2a71775d..aa8dac17b8 100644 --- a/src/testutils/refdata_xml.cpp +++ b/src/testutils/refdata_xml.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2015,2016,2017,2019, by the GROMACS development team, led by + * Copyright (c) 2015,2016,2017,2019,2020, 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. @@ -48,9 +48,10 @@ #include "gromacs/utility/exceptions.h" -#include "testutils/refdata_impl.h" #include "testutils/testexceptions.h" +#include "refdata_impl.h" + namespace gmx { namespace test diff --git a/src/testutils/refdata_xml.h b/src/testutils/refdata_xml.h index d2a9707ccf..546d87903f 100644 --- a/src/testutils/refdata_xml.h +++ b/src/testutils/refdata_xml.h @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2015,2016,2019, by the GROMACS development team, led by + * Copyright (c) 2015,2016,2019,2020, 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. @@ -44,7 +44,7 @@ #include -#include "testutils/refdata_impl.h" +#include "refdata_impl.h" namespace gmx { diff --git a/src/testutils/simulationdatabase.cpp b/src/testutils/simulationdatabase.cpp index b8edf03682..52d866f258 100644 --- a/src/testutils/simulationdatabase.cpp +++ b/src/testutils/simulationdatabase.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2016,2018,2019, by the GROMACS development team, led by + * Copyright (c) 2016,2018,2019,2020, 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,7 +41,7 @@ */ #include "gmxpre.h" -#include "simulationdatabase.h" +#include "testutils/simulationdatabase.h" #include #include diff --git a/src/testutils/stdiohelper.cpp b/src/testutils/stdiohelper.cpp index 4afb9ba460..8bceb0c923 100644 --- a/src/testutils/stdiohelper.cpp +++ b/src/testutils/stdiohelper.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2013,2014,2015,2017,2019, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015,2017,2019,2020, 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,7 +41,7 @@ */ #include "gmxpre.h" -#include "stdiohelper.h" +#include "testutils/stdiohelper.h" #include #include diff --git a/src/testutils/stringtest.cpp b/src/testutils/stringtest.cpp index 452c300435..4e5e8b0ae2 100644 --- a/src/testutils/stringtest.cpp +++ b/src/testutils/stringtest.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2015,2019, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2019,2020, 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,7 +41,7 @@ */ #include "gmxpre.h" -#include "stringtest.h" +#include "testutils/stringtest.h" #include diff --git a/src/testutils/test_device.cpp b/src/testutils/test_device.cpp index 8d3865eee0..6865e94984 100644 --- a/src/testutils/test_device.cpp +++ b/src/testutils/test_device.cpp @@ -43,7 +43,7 @@ */ #include "gmxpre.h" -#include "test_device.h" +#include "testutils/test_device.h" #include diff --git a/src/testutils/test_hardware_environment.cpp b/src/testutils/test_hardware_environment.cpp index 267c73cf27..da352962e1 100644 --- a/src/testutils/test_hardware_environment.cpp +++ b/src/testutils/test_hardware_environment.cpp @@ -44,7 +44,7 @@ #include "gmxpre.h" -#include "test_hardware_environment.h" +#include "testutils/test_hardware_environment.h" #include diff --git a/src/testutils/testasserts.cpp b/src/testutils/testasserts.cpp index acf173cd95..83fbf5568c 100644 --- a/src/testutils/testasserts.cpp +++ b/src/testutils/testasserts.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2014,2015,2016,2018,2019, by the GROMACS development team, led by + * Copyright (c) 2014,2015,2016,2018,2019,2020, 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,7 +41,7 @@ */ #include "gmxpre.h" -#include "testasserts.h" +#include "testutils/testasserts.h" #include #include diff --git a/src/testutils/testfilemanager.cpp b/src/testutils/testfilemanager.cpp index cb0a1ceeb5..99748ff77f 100644 --- a/src/testutils/testfilemanager.cpp +++ b/src/testutils/testfilemanager.cpp @@ -42,7 +42,7 @@ */ #include "gmxpre.h" -#include "testfilemanager.h" +#include "testutils/testfilemanager.h" #include @@ -214,11 +214,8 @@ std::string TestFileManager::getInputFilePath(const char* filename) // Assume file is in global directory for simulation input files. return Path::join(getTestSimulationDatabaseDirectory(), filename); } - else - { - // Assume file is present locally without full name (e.g. extension). - return Path::join(getInputDataDirectory(), filename); - } + // Assume file is present locally without full name (e.g. extension). + return Path::join(getInputDataDirectory(), filename); } std::string TestFileManager::getInputFilePath(const std::string& filename) diff --git a/src/testutils/testfileredirector.cpp b/src/testutils/testfileredirector.cpp index da0e74ae21..d233ae0178 100644 --- a/src/testutils/testfileredirector.cpp +++ b/src/testutils/testfileredirector.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2015,2016,2017,2019, by the GROMACS development team, led by + * Copyright (c) 2015,2016,2017,2019,2020, 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,7 +41,7 @@ */ #include "gmxpre.h" -#include "testfileredirector.h" +#include "testutils/testfileredirector.h" #include #include diff --git a/src/testutils/testinit.cpp b/src/testutils/testinit.cpp index 753b814a0f..330e2563b6 100644 --- a/src/testutils/testinit.cpp +++ b/src/testutils/testinit.cpp @@ -42,7 +42,7 @@ */ #include "gmxpre.h" -#include "testinit.h" +#include "testutils/testinit.h" #include #include @@ -68,12 +68,13 @@ #include "gromacs/utility/programcontext.h" #include "gromacs/utility/textwriter.h" -#include "testutils/mpi_printer.h" #include "testutils/refdata.h" #include "testutils/test_hardware_environment.h" #include "testutils/testfilemanager.h" #include "testutils/testoptions.h" +#include "mpi_printer.h" + namespace gmx { namespace test diff --git a/src/testutils/testmatchers.cpp b/src/testutils/testmatchers.cpp index 9a4446847e..782d0bd162 100644 --- a/src/testutils/testmatchers.cpp +++ b/src/testutils/testmatchers.cpp @@ -42,7 +42,7 @@ */ #include "gmxpre.h" -#include "testmatchers.h" +#include "testutils/testmatchers.h" #include diff --git a/src/testutils/testoptions.cpp b/src/testutils/testoptions.cpp index 02749d8259..f2805afe24 100644 --- a/src/testutils/testoptions.cpp +++ b/src/testutils/testoptions.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2015,2019, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2019,2020, 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,7 +41,7 @@ */ #include "gmxpre.h" -#include "testoptions.h" +#include "testutils/testoptions.h" #include diff --git a/src/testutils/tests/CMakeLists.txt b/src/testutils/tests/CMakeLists.txt index 7a6d651ab4..8a10308527 100644 --- a/src/testutils/tests/CMakeLists.txt +++ b/src/testutils/tests/CMakeLists.txt @@ -39,8 +39,10 @@ gmx_add_unit_test(TestUtilsUnitTests testutils-test testasserts_tests.cpp xvgtest_tests.cpp ) +target_link_libraries(testutils-test PRIVATE testutils) gmx_add_mpi_unit_test(TestUtilsMpiUnitTests testutils-mpi-test 2 CPP_SOURCE_FILES mpitest.cpp ) +target_link_libraries(testutils-test PRIVATE testutils) diff --git a/src/testutils/textblockmatchers.cpp b/src/testutils/textblockmatchers.cpp index 7dd2f7ca6c..0a9ec10a68 100644 --- a/src/testutils/textblockmatchers.cpp +++ b/src/testutils/textblockmatchers.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2015,2018,2019, by the GROMACS development team, led by + * Copyright (c) 2015,2018,2019,2020, 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,7 +41,7 @@ */ #include "gmxpre.h" -#include "textblockmatchers.h" +#include "testutils/textblockmatchers.h" #include #include diff --git a/src/testutils/tprfilegenerator.cpp b/src/testutils/tprfilegenerator.cpp index 872703eef1..9321f9ef7a 100644 --- a/src/testutils/tprfilegenerator.cpp +++ b/src/testutils/tprfilegenerator.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2019, by the GROMACS development team, led by + * Copyright (c) 2019,2020, 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. @@ -42,7 +42,7 @@ #include "gmxpre.h" -#include "tprfilegenerator.h" +#include "testutils/tprfilegenerator.h" #include "gromacs/gmxpreprocess/grompp.h" #include "gromacs/utility/textwriter.h" diff --git a/src/testutils/xvgtest.cpp b/src/testutils/xvgtest.cpp index eb73e8fb27..437f046a0f 100644 --- a/src/testutils/xvgtest.cpp +++ b/src/testutils/xvgtest.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2015,2016,2017,2018,2019, by the GROMACS development team, led by + * Copyright (c) 2015,2016,2017,2018,2019,2020, 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. @@ -42,7 +42,7 @@ */ #include "gmxpre.h" -#include "xvgtest.h" +#include "testutils/xvgtest.h" #include #include -- 2.22.0