diff --git a/.travis.yml b/.travis.yml index 292d2cad5881e6e3d1031c3a4ebb958c71e0b2a0..2432ae775002c080f0ac0f97bc7f6626cebd60bd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,6 +40,8 @@ before_install: script: - "pwd & mkdir build && cd build && cmake $CMAKE_ARGS .. && cmake .. && make" - make test + # PetSc + - if [[ "$CASE" == "CLI_PETSC" ]]; then make test_mpi; fi notifications: email: diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index ab1362afa47e378fe2adeeb3c8149514d3f70899..3e5cc42b013d09be328a19dcdd635192f21011f3 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -78,7 +78,11 @@ ENDIF() # This should override CTest's predefined test-target but it does not IF (OGS_USE_PETSC) ADD_CUSTOM_TARGET(test - mpirun -np 3 $<TARGET_FILE:testrunner> + mpirun -np 1 $<TARGET_FILE:testrunner> --gtest_filter=-MPITest* + DEPENDS testrunner + ) + ADD_CUSTOM_TARGET(test_mpi + mpirun -np 3 $<TARGET_FILE:testrunner> --gtest_filter=MPITest* DEPENDS testrunner ) ELSE () diff --git a/Tests/FileIO/TestBoostXmlCndInterface.cpp b/Tests/FileIO/TestBoostXmlCndInterface.cpp index 1e6c724b2761719882476d45d65d57845c7a5f3c..27c4db89d726017bdfdecb495330797e5e3c42b0 100644 --- a/Tests/FileIO/TestBoostXmlCndInterface.cpp +++ b/Tests/FileIO/TestBoostXmlCndInterface.cpp @@ -27,13 +27,6 @@ TEST(FileIO, TestBoostXmlCndInterfaceUsingBoundaryCondition) { -#if defined(USE_PETSC) || defined(USE_MPI) - int mrank; - MPI_Comm_rank(MPI_COMM_WORLD, &mrank); - if(mrank == 0) - { -#endif - // setup test data std::string geometry_name("GeometryForBC"); const std::string bc_pnt_name("bc_pnt"); @@ -123,8 +116,4 @@ TEST(FileIO, TestBoostXmlCndInterfaceUsingBoundaryCondition) conds[1]->getProcessDistributionType()); ASSERT_EQ(conds[0]->getDisValues().size(), conds[1]->getDisValues().size()); ASSERT_NEAR(conds[0]->getDisValues()[0], conds[1]->getDisValues()[0], std::numeric_limits<double>::epsilon()); - -#if defined(USE_PETSC) || defined(USE_MPI) - } -#endif } diff --git a/Tests/FileIO/TestXmlGmlReader.cpp b/Tests/FileIO/TestXmlGmlReader.cpp index bf6c1fc8af735652a72cec1d2d60361dfc596a11..5f3ee0f91e37a6c69d98f7d6e5bc75d39727ada8 100644 --- a/Tests/FileIO/TestXmlGmlReader.cpp +++ b/Tests/FileIO/TestXmlGmlReader.cpp @@ -26,16 +26,10 @@ // GeoLib #include "Polyline.h" + TEST(FileIO, XmlGmlWriterReaderTest) { -#if defined(USE_PETSC) || defined(USE_MPI) - int mrank; - MPI_Comm_rank(MPI_COMM_WORLD, &mrank); - if(mrank == 0) - { -#endif - - // Writer test + // Writer test std::string test_data_file(std::string(SOURCEPATH).append("/Tests/FileIO/xmlgmltestdata.gml")); ProjectData project; @@ -127,10 +121,4 @@ TEST(FileIO, XmlGmlWriterReaderTest) boost::filesystem::remove(test_data_file); test_data_file += ".md5"; boost::filesystem::remove(test_data_file); - -#if defined(USE_PETSC) || defined(USE_MPI) - } -#endif - } -#endif diff --git a/Tests/MathLib/TestGlobalMatrixInterface.cpp b/Tests/MathLib/TestGlobalMatrixInterface.cpp index 04e1fe8637506b36b252e0e83d1082d67a84f47b..d11f17493692d6f85bca41a19799d52f9f4a33d8 100644 --- a/Tests/MathLib/TestGlobalMatrixInterface.cpp +++ b/Tests/MathLib/TestGlobalMatrixInterface.cpp @@ -178,7 +178,7 @@ TEST(Math, CheckInterface_LisMatrix) #endif #ifdef USE_PETSC // or MPI -TEST(Math, CheckInterface_PETScMatrix_Local_Size) +TEST(MPITest_Math, CheckInterface_PETScMatrix_Local_Size) { MathLib::PETScMatrixOption opt; opt.d_nz = 2; @@ -193,7 +193,7 @@ TEST(Math, CheckInterface_PETScMatrix_Local_Size) checkGlobalMatrixInterfaceMPI(A, x); } -TEST(Math, CheckInterface_PETScMatrix_Global_Size) +TEST(MPITest_Math, CheckInterface_PETScMatrix_Global_Size) { MathLib::PETScMatrixOption opt; opt.d_nz = 2; @@ -206,7 +206,7 @@ TEST(Math, CheckInterface_PETScMatrix_Global_Size) } // Test rectangular matrix -TEST(Math, CheckInterface_PETSc_Rectangular_Matrix_Local_Size) +TEST(MPITest_Math, CheckInterface_PETSc_Rectangular_Matrix_Local_Size) { MathLib::PETScMatrixOption opt; opt.d_nz = 3; @@ -221,7 +221,7 @@ TEST(Math, CheckInterface_PETSc_Rectangular_Matrix_Local_Size) checkGlobalRectangularMatrixInterfaceMPI(A, x); } -TEST(Math, CheckInterface_PETSc_Rectangular_Matrix_Global_Size) +TEST(MPITest_Math, CheckInterface_PETSc_Rectangular_Matrix_Global_Size) { MathLib::PETScMatrixOption opt; opt.d_nz = 3; diff --git a/Tests/MathLib/TestGlobalVectorInterface.cpp b/Tests/MathLib/TestGlobalVectorInterface.cpp index bfcf01796a44a2527f192a07874b553f8f5451e4..01e21e28c164af2176944cef6cde7dc75052d39f 100644 --- a/Tests/MathLib/TestGlobalVectorInterface.cpp +++ b/Tests/MathLib/TestGlobalVectorInterface.cpp @@ -204,7 +204,7 @@ TEST(Math, CheckInterface_LisVector) //-------------------------------------------- #ifdef USE_PETSC -TEST(Math, CheckInterface_PETScVector) +TEST(MPITest_Math, CheckInterface_PETScVector) { checkGlobalVectorInterfaceMPI<MathLib::PETScVector >(); } diff --git a/Tests/MathLib/TestLinearSolver.cpp b/Tests/MathLib/TestLinearSolver.cpp index 4efb05e27c8777bec4552cf1fb90bbb2742da19b..0b5ff0d799de5223f57f317fdaf341b9d6949eb4 100644 --- a/Tests/MathLib/TestLinearSolver.cpp +++ b/Tests/MathLib/TestLinearSolver.cpp @@ -219,7 +219,7 @@ TEST(Math, CheckInterface_Lis) #endif #ifdef USE_PETSC -TEST(Math, CheckInterface_PETSc_Linear_Solver_basic) +TEST(MPITest_Math, CheckInterface_PETSc_Linear_Solver_basic) { MathLib::PETScMatrixOption opt; opt.d_nz = 2; @@ -243,7 +243,7 @@ TEST(Math, CheckInterface_PETSc_Linear_Solver_basic) MathLib::PETScLinearSolver>(A, b, "ptest1_"); } -TEST(Math, CheckInterface_PETSc_Linear_Solver_chebyshev_sor) +TEST(MPITest_Math, CheckInterface_PETSc_Linear_Solver_chebyshev_sor) { MathLib::PETScMatrixOption opt; opt.d_nz = 2; @@ -267,7 +267,7 @@ TEST(Math, CheckInterface_PETSc_Linear_Solver_chebyshev_sor) MathLib::PETScLinearSolver>(A, b, "ptest2_"); } -TEST(Math, CheckInterface_PETSc_Linear_Solver_gmres_amg) +TEST(MPITest_Math, CheckInterface_PETSc_Linear_Solver_gmres_amg) { MathLib::PETScMatrixOption opt; opt.d_nz = 2;