]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Tests are now all runnable from BUILD dir only with no install.
authorabn <adrien.bruneton@cea.fr>
Fri, 18 Dec 2015 14:06:43 +0000 (15:06 +0100)
committerabn <adrien.bruneton@cea.fr>
Fri, 18 Dec 2015 14:06:43 +0000 (15:06 +0100)
21 files changed:
CMakeLists.txt
src/INTERP_KERNELTest/CMakeLists.txt
src/INTERP_KERNELTest/TestInterpKernelUtils.cxx
src/INTERP_KERNELTest/TestInterpKernelUtils.hxx
src/MEDLoader/Swig/CMakeLists.txt
src/MEDLoader/Swig/MEDLoaderCouplingTrainingSession.py
src/MEDLoader/Swig/SauvLoaderTest.py
src/MEDLoader/Test/CMakeLists.txt
src/MEDLoader/Test/MEDLoaderTest.cxx
src/MEDLoader/Test/MEDLoaderTest.hxx
src/MEDLoader/Test/SauvLoaderTest.cxx
src/MEDLoader/Test/SauvLoaderTest.hxx
src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx
src/MEDPartitioner/Test/MEDPARTITIONERTestPara.cxx
src/MEDPartitioner_Swig/CMakeLists.txt
src/ParaMEDMEMTest/CMakeLists.txt
src/ParaMEDMEMTest/ParaMEDMEMTest.cxx
src/ParaMEDMEMTest/ParaMEDMEMTest.hxx
src/ParaMEDMEMTest/ParaMEDMEMTest_InterpKernelDEC.cxx
src/ParaMEDMEMTest/ParaMEDMEMTest_StructuredCoincidentDEC.cxx
src/RENUMBER_Swig/CMakeLists.txt

index 3aa32d340595fae6d083e1b3e23d3daf75a03cd7..8786daa3ae290540da336ff45eb450d6e8c494f7 100644 (file)
@@ -227,7 +227,7 @@ IF(NOT MEDCOUPLING_MICROMED)
     ENDIF()
   ENDIF()
   IF(MEDCOUPLING_BUILD_TESTS)
-    LIST(APPEND _${PROJECT_NAME}_exposed_targets InterpKernelTest)
+    LIST(APPEND _${PROJECT_NAME}_exposed_targets InterpKernelTest InterpKernelTestUtils)
   ENDIF()
 ENDIF()
 
index 17f8cc6894ade819e669ee748147e8e7094a7695..fcc8f41470fd79dab37c094d0e6236afd2a3a4a2 100644 (file)
@@ -48,10 +48,13 @@ SET(InterpKernelTest_SOURCES
   TransformedTriangleTest.cxx
   UnitTetra3D2DIntersectionTest.cxx
   UnitTetraIntersectionBaryTest.cxx
-  TestInterpKernelUtils.cxx
   ThreeDSurfProjectionTest.cxx
 )
 
+SET(InterpKernelTestUtils_SOURCES
+    TestInterpKernelUtils.cxx
+)
+
 SET(TestINTERP_KERNEL_SOURCES
   TestInterpKernel.cxx
   )
@@ -75,13 +78,14 @@ IF(NOT MEDCOUPLING_MICROMED)
   INSTALL(TARGETS PerfTest DESTINATION ${MEDCOUPLING_INSTALL_BINS})
 ENDIF(NOT MEDCOUPLING_MICROMED)
 
+ADD_LIBRARY(InterpKernelTestUtils SHARED ${InterpKernelTestUtils_SOURCES})
 ADD_LIBRARY(InterpKernelTest SHARED ${InterpKernelTest_SOURCES})
 
 SET(InterpKernelTest_LIBS medcoupling interpkernel ${CPPUNIT_LIBRARIES})
 IF(NOT MEDCOUPLING_MICROMED)
   SET(InterpKernelTest_LIBS medloader ${InterpKernelTest_LIBS})
 ENDIF(NOT MEDCOUPLING_MICROMED)
-TARGET_LINK_LIBRARIES(InterpKernelTest ${InterpKernelTest_LIBS})
+TARGET_LINK_LIBRARIES(InterpKernelTest ${InterpKernelTest_LIBS} InterpKernelTestUtils)
 
 ADD_EXECUTABLE(TestINTERP_KERNEL ${TestINTERP_KERNEL_SOURCES})
 TARGET_LINK_LIBRARIES(TestINTERP_KERNEL InterpKernelTest ${CPPUNIT_LIBRARIES} ${PLATFORM_LIBS})
@@ -91,7 +95,8 @@ SET_TESTS_PROPERTIES(TestINTERP_KERNEL PROPERTIES ENVIRONMENT "${tests_env}")
 
 INSTALL(TARGETS TestINTERP_KERNEL DESTINATION ${MEDCOUPLING_INSTALL_BINS})
 INSTALL(TARGETS InterpKernelTest DESTINATION ${MEDCOUPLING_INSTALL_LIBS})
-INSTALL(FILES CppUnitTest.hxx InterpKernelTestExport.hxx DESTINATION ${MEDCOUPLING_INSTALL_HEADERS})
+INSTALL(TARGETS InterpKernelTestUtils DESTINATION ${MEDCOUPLING_INSTALL_LIBS})
+INSTALL(FILES CppUnitTest.hxx InterpKernelTestExport.hxx TestInterpKernelUtils.hxx DESTINATION ${MEDCOUPLING_INSTALL_HEADERS})
 
 # Application tests
 
index 262699a35a47a40430e8388acdb5a3f076f225de..2275c57b0a939d7a62feb5dc98c0b2271759a37d 100644 (file)
 
 namespace INTERP_TEST
 {
-  std::string getResourceFile( const std::string& filename )
+  std::string getResourceFile( const std::string& filename, int levelUp)
   {
     std::string resourceFile = "";
-    bool good = false;
-
     if ( getenv("MEDCOUPLING_ROOT_DIR") ) {
       // use MEDCOUPLING_ROOT_DIR env.var
       resourceFile = getenv("MEDCOUPLING_ROOT_DIR");
-      resourceFile += "/share/resources/med/";
+      resourceFile += IK_PATH_SEP + "share" + IK_PATH_SEP + "resources" + IK_PATH_SEP + "med" + IK_PATH_SEP;
       resourceFile += filename;
       std::ifstream my_file(resourceFile);
       if (my_file.good())
-        good = true;
+        return resourceFile;
     }
-    if (!good)
+    // else
+    resourceFile = get_current_dir_name();
+    resourceFile += IK_PATH_SEP;
+    for(int i=0; i<levelUp; i++)
+      resourceFile += ".." + IK_PATH_SEP;
+    resourceFile += "resources" + IK_PATH_SEP;
+    resourceFile += filename;
+    std::ifstream my_file(resourceFile);
+    if (!my_file.good())
       {
-        resourceFile = get_current_dir_name();
-        resourceFile += "/../../resources/";
-        std::ifstream my_file(resourceFile);
-        if (!my_file.good())
-          {
-            std::stringstream ss;
-            ss << "INTERP_TEST::getResourceFile(): could not open resource test file: " << filename << "\n";
-            throw INTERP_KERNEL::Exception(ss.str().c_str());
-          }
+        std::stringstream ss;
+        ss << "INTERP_TEST::getResourceFile(): could not open resource test file: " << filename << "\n";
+        throw INTERP_KERNEL::Exception(ss.str().c_str());
       }
 
     return resourceFile;
index d17240a7f5bb867d38eefa4c7ebdac28faaf8cff..6d249e096591e50441d986fb93bedf11a49d3c9d 100644 (file)
 
 #include <string>
 
+#ifdef WIN32
+# define IK_PATH_SEP std::string("\\")
+#else
+# define IK_PATH_SEP std::string("/")
+#endif
+
 namespace INTERP_TEST
 {
-
-  INTERPKERNELTEST_EXPORT std::string getResourceFile( const std::string& );
-
-} // namespace INTERP_TEST
+  INTERPKERNELTEST_EXPORT std::string getResourceFile( const std::string& filename, int levelUp=2);
+}
 
 #endif // _TESTINTERPKERNELUTILS_HXX_
index e448f189ca5097f2f2b36c5d8e2a27829ebf3926..29a81d6dc3e0efcece0459916977b75781d5bfb9 100644 (file)
@@ -92,6 +92,9 @@ ADD_TEST(SauvLoaderTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/SauvLoa
 SET_TESTS_PROPERTIES(SauvLoaderTest PROPERTIES ENVIRONMENT "${tests_env}")
 
 IF(NUMPY_FOUND)
+  # Add Remapper to the Python path:
+  SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH "${CMAKE_CURRENT_BINARY_DIR}/../../MEDCoupling_Swig")
+  SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env)
   ADD_TEST(MEDLoaderCouplingTrainingSession ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDLoaderCouplingTrainingSession.py)
   SET_TESTS_PROPERTIES(MEDLoaderCouplingTrainingSession PROPERTIES ENVIRONMENT "${tests_env}")
 ENDIF(NUMPY_FOUND)
@@ -117,9 +120,6 @@ SET(MEDLOADER_TEST_FILES
     medutilities.py
 )
 
-FOREACH(testfile ${MEDLOADER_TEST_FILES})
-  CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/${testfile}" "${CMAKE_CURRENT_BINARY_DIR}/${testfile}" COPYONLY)
-ENDFOREACH(testfile)
 INSTALL(FILES ${MEDLOADER_TEST_FILES} DESTINATION ${TEST_INSTALL_DIRECTORY})
 
 INSTALL(FILES CTestTestfileInstall.cmake
index 24520950dfe1d11f1ee959c9ba5f939e305caec3..730772680b27ae39f79e1275d27503e62de6978c 100644 (file)
@@ -482,10 +482,10 @@ from math import acos
 
 med_root_dir=os.getenv("MEDCOUPLING_ROOT_DIR")
 if med_root_dir:
-  agitateur_file=os.path.join(os.getenv("MEDCOUPLING_ROOT_DIR"),"share","resources","med","agitateur.med")
-else:
-  current_dir = os.path.dirname(os.path.realpath(__file__))
-  agitateur_file=os.path.join(current_dir, "..", "..", "..", "resources","agitateur.med")
+  agitateur_file = os.path.join(os.getenv("MEDCOUPLING_ROOT_DIR"),"share","resources","med","agitateur.med")
+  if not os.path.exists(agitateur_file):
+    current_dir = os.path.dirname(os.path.realpath(__file__))
+    agitateur_file=os.path.join(current_dir, "..", "..", "..", "resources","agitateur.med")
   pass
 data=MEDFileData(agitateur_file)
 ts=data.getFields()[0].getTimeSteps()
index cab156183fad0faa8621a1db91f6413dc031383a..3e0a45fcfbf9ffef56326b8e725c8b7ea7868803 100644 (file)
@@ -26,12 +26,16 @@ from MEDLoaderDataForTest import MEDLoaderDataForTest
 class SauvLoaderTest(unittest.TestCase):
 
     def __getResourcesDirectory(self):
-        med_root_dir=os.getenv("MEDCOUPLING_ROOT_DIR")
+        med_root_dir = os.getenv("MEDCOUPLING_ROOT_DIR")
         if med_root_dir:
-            return os.path.join( os.getenv("MEDCOUPLING_ROOT_DIR"), "share","resources","med")
-        else:
-            current_dir = os.path.dirname(os.path.realpath(__file__))
-            return os.path.join(current_dir, "..", "..", "..", "resources")
+            pth = os.path.join( os.getenv("MEDCOUPLING_ROOT_DIR"), "share","resources","med")
+            if os.path.exists(pth):
+              return pth
+        current_dir = os.path.dirname(os.path.realpath(__file__))
+        pth = os.path.join(current_dir, "..", "..", "..", "resources")
+        if not os.path.exists(pth):
+          raise Exception("SauvLoaderTest: Unable to get resource directory")
+        return pth
         pass
 
     def testSauv2Med(self):
index 79dd72204d06df108acedaec4b140ee33fe3a44f..1304af82cf1e1c941f0392e94ede63c67909d40b 100644 (file)
@@ -26,7 +26,7 @@ INCLUDE_DIRECTORIES(
   ${CMAKE_CURRENT_SOURCE_DIR}/../../MEDCoupling
   ${CMAKE_CURRENT_SOURCE_DIR}/../../INTERP_KERNEL
   ${CMAKE_CURRENT_SOURCE_DIR}/../../INTERP_KERNEL/Bases
-  ${CMAKE_CURRENT_SOURCE_DIR}/../../INTERP_KERNELTest # For common CppUnitTest.hxx file
+  ${CMAKE_CURRENT_SOURCE_DIR}/../../INTERP_KERNELTest # For common CppUnitTest.hxx file and TestIKUtils.hxx 
   )
 
 SET(TestMEDLoader_SOURCES
@@ -42,13 +42,13 @@ SET(TestSauvLoader_SOURCES
 SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env)
 
 ADD_EXECUTABLE(TestMEDLoader ${TestMEDLoader_SOURCES})
-TARGET_LINK_LIBRARIES(TestMEDLoader medloader ${CPPUNIT_LIBRARIES} ${PLATFORM_LIBS})
+TARGET_LINK_LIBRARIES(TestMEDLoader medloader InterpKernelTestUtils ${CPPUNIT_LIBRARIES} ${PLATFORM_LIBS})
 ADD_TEST(TestMEDLoader TestMEDLoader)
 SET_TESTS_PROPERTIES(TestMEDLoader PROPERTIES ENVIRONMENT "${tests_env}")
 
 ADD_EXECUTABLE(TestSauvLoader ${TestSauvLoader_SOURCES})
 
-TARGET_LINK_LIBRARIES(TestSauvLoader medloader ${CPPUNIT_LIBRARIES} ${PLATFORM_LIBS})
+TARGET_LINK_LIBRARIES(TestSauvLoader medloader InterpKernelTestUtils ${CPPUNIT_LIBRARIES} ${PLATFORM_LIBS})
 ADD_TEST(TestSauvLoader TestSauvLoader)
 SET_TESTS_PROPERTIES(TestSauvLoader PROPERTIES ENVIRONMENT "${tests_env}")
 
index 84a59d8ba0b93bedb8631c37705bbba42c6cd494..85f0add7887f8d8d3a9590ace9bbc747397600cd 100644 (file)
 #include "MEDCouplingUMesh.hxx"
 #include "MEDCouplingFieldDouble.hxx"
 #include "MEDCouplingMemArray.hxx"
+#include "TestInterpKernelUtils.hxx"  // getResourceFile()
 
 #include <cmath>
 #include <numeric>
-#include <unistd.h>  // get_current_dir_name()
 
 using namespace ParaMEDMEM;
 
@@ -778,7 +778,7 @@ void MEDLoaderTest::testMEDLoaderRead1()
   using namespace std;
   using namespace INTERP_KERNEL;
 
-  string fileName=getResourceFile("pointe.med");
+  string fileName= INTERP_TEST::getResourceFile("pointe.med", 3);
   vector<string> meshNames=MEDLoader::GetMeshNames(fileName.c_str());
   CPPUNIT_ASSERT_EQUAL(1,(int)meshNames.size());
   MEDCouplingUMesh *mesh=MEDLoader::ReadUMeshFromFile(fileName.c_str(),meshNames[0].c_str(),0);
@@ -1002,7 +1002,7 @@ void MEDLoaderTest::testMEDLoaderPolygonRead()
   using namespace std;
   using namespace INTERP_KERNEL;
 
-  string fileName=getResourceFile("polygones.med");
+  string fileName=INTERP_TEST::getResourceFile("polygones.med", 3);
   vector<string> meshNames=MEDLoader::GetMeshNames(fileName.c_str());
   CPPUNIT_ASSERT_EQUAL(1,(int)meshNames.size());
   CPPUNIT_ASSERT(meshNames[0]=="Bord");
@@ -1068,7 +1068,7 @@ void MEDLoaderTest::testMEDLoaderPolyhedronRead()
   using namespace std;
   using namespace INTERP_KERNEL;
 
-  string fileName=getResourceFile("poly3D.med");
+  string fileName=INTERP_TEST::getResourceFile("poly3D.med", 3);
   vector<string> meshNames=MEDLoader::GetMeshNames(fileName.c_str());
   CPPUNIT_ASSERT_EQUAL(1,(int)meshNames.size());
   CPPUNIT_ASSERT(meshNames[0]=="poly3D");
@@ -1147,25 +1147,6 @@ void MEDLoaderTest::testMEDLoaderPolyhedronRead()
   mesh->decrRef();
 }
 
-std::string MEDLoaderTest::getResourceFile( const std::string& filename ) const
-{
-  std::string resourceFile = "";
-
-  if ( getenv("MEDCOUPLING_ROOT_DIR") ) {
-    // use MEDCOUPLING_ROOT_DIR env.var
-    resourceFile = getenv("MEDCOUPLING_ROOT_DIR");
-    resourceFile += "/share/resources/med/";
-  }
-  else {
-    resourceFile = get_current_dir_name();
-    resourceFile += "/../../../resources/";
-  }
-
-  resourceFile += filename;
-  return resourceFile;
-}
-
-
 MEDCouplingUMesh *MEDLoaderTest::build1DMesh_1()
 {
   double coords[6]={ 0.0, 0.3, 0.75, 1.0, 1.4, 1.3 };
index b42b3b3db4f106d4e03c9e3c0f016c2d6ad57602..1839c674ccd971e2b4e51128e8aff6e030c77edc 100644 (file)
@@ -100,7 +100,6 @@ namespace ParaMEDMEM
     MEDCouplingFieldDouble *buildVecFieldOnGauss_1();
     MEDCouplingFieldDouble *buildVecFieldOnGaussNE_1();
 
-    std::string getResourceFile( const std::string& filename ) const;
   };
 }
 
index 6ac13e4fee291288b46196c1b8ad454d963a494d..66fbcda6b31ce6ff23df870f4bee6636ff30c221 100644 (file)
@@ -24,6 +24,7 @@
 #include "MEDFileData.hxx"
 #include "MEDCouplingFieldDouble.hxx"
 #include "MEDCouplingMemArray.hxx"
+#include "TestInterpKernelUtils.hxx"  // getResourceFile()
 
 #ifdef WIN32
 # include <windows.h>
@@ -39,7 +40,7 @@ using namespace ParaMEDMEM;
 void SauvLoaderTest::testSauv2Med()
 {
   // read a file containing all types of readable piles
-  std::string file = getResourceFile("allPillesTest.sauv");
+  std::string file = INTERP_TEST::getResourceFile("allPillesTest.sauv", 3);
   MEDCouplingAutoRefCountObjectPtr<SauvReader> sr=SauvReader::New(file.c_str());
   MEDCouplingAutoRefCountObjectPtr<MEDFileData> d2=sr->loadInMEDFileDS();
   // write MED
@@ -124,7 +125,7 @@ void SauvLoaderTest::testMed2SauvOnAMeshWithVoidFamily()
 void SauvLoaderTest::testSauv2MedOnA3SubsField()
 {
   // read SAUV
-  std::string sauvFile = getResourceFile("portico_3subs.sauv");
+  std::string sauvFile = INTERP_TEST::getResourceFile("portico_3subs.sauv", 3);
   MEDCouplingAutoRefCountObjectPtr<SauvReader> sr=SauvReader::New(sauvFile.c_str());
   MEDCouplingAutoRefCountObjectPtr<MEDFileData> d2=sr->loadInMEDFileDS();
   // check mesh
@@ -168,7 +169,7 @@ void SauvLoaderTest::testSauv2MedOnA3SubsField()
 void SauvLoaderTest::testMed2Sauv()
 {
   // read pointe.med
-  std::string file = getResourceFile("pointe.med");
+  std::string file = INTERP_TEST::getResourceFile("pointe.med", 3);
   MEDCouplingAutoRefCountObjectPtr<MEDFileData> pointeMed=MEDFileData::New(file.c_str());
 
   // add 3 faces to pointeMed
@@ -327,28 +328,3 @@ void SauvLoaderTest::tearDown()
       remove(fileToRemove[i]);
   }
 }
-
-std::string SauvLoaderTest::getResourceFile( const std::string& filename )
-{
-  std::string resourceFile = "";
-
-  if ( getenv("MEDCOUPLING_ROOT_DIR") ) {
-    // use MEDCOUPLING_ROOT_DIR env.var
-    resourceFile = getenv("MEDCOUPLING_ROOT_DIR");
-    resourceFile += "/share/resources/med/";
-  }
-  else {
-    resourceFile = get_current_dir_name();
-    resourceFile += "/../../../resources/";
-  }
-
-  resourceFile += filename;
-#ifdef WIN32
-  std::string fixedpath = resourceFile;
-  for ( int i=0; i < fixedpath.length(); ++i )
-    if (fixedpath[i] == '/')
-      fixedpath[i] = '\\';
-  return fixedpath;
-#endif
-  return resourceFile;
-}
index 586285cad55efdaa263efc7d2c411fe9beb9560d..ee21344a5de5ad1f785e826e6aba920176de88fd 100644 (file)
@@ -42,7 +42,6 @@ namespace ParaMEDMEM
 
   public:
     void tearDown();
-    static std::string getResourceFile( const std::string& filename );
   };
 }
 
index 242de7f99266ad75db0d22995e50734b7ca82dd7..505d48366380d7e9a124bbcf59015f037ccb4130 100644 (file)
@@ -89,14 +89,15 @@ std::string MEDPARTITIONERTest::getPartitionerExe() const
     {
       execName=getenv("MEDCOUPLING_ROOT_DIR");  //.../INSTALL/MED
       execName+="/bin/medpartitioner";
+      std::ifstream my_file(execName);
+      if (my_file.good())
+        return execName;
     }
-  else
-    {
-      execName = get_current_dir_name();
-      execName += "/../../MEDPartitioner/medpartitioner";
-      if (! std::ifstream(execName.c_str()))
-        CPPUNIT_FAIL("Can't find medpartitioner, please set MEDCOUPLING_ROOT_DIR");
-    }
+  execName = get_current_dir_name();
+  execName += "/../../MEDPartitioner/medpartitioner";
+  if (! std::ifstream(execName.c_str()))
+    CPPUNIT_FAIL("Can't find medpartitioner, please set MEDCOUPLING_ROOT_DIR");
+
   return execName;
 }
 
index ed5bc1809c6140f43d31947b47a91be8b1b30cc9..991abf0ae27d7d8b6039821592cf1d30dcf48344 100644 (file)
@@ -57,16 +57,16 @@ std::string MEDPARTITIONERTest::getPartitionerParaExe() const
   std::string execName;
   if ( getenv("MEDCOUPLING_ROOT_DIR") )
     {
-      execName=getenv("MEDCOUPLING_ROOT_DIR");  //.../INSTALL/MED
+      execName=getenv("MEDCOUPLING_ROOT_DIR");
       execName+="/bin/medpartitioner_para";
+      std::ifstream my_file(execName);
+      if (my_file.good())
+        return execName;
     }
-  else
-    {
-      execName = get_current_dir_name();
-      execName += "/../../MEDPartitioner/medpartitioner_para";
-      if (! std::ifstream(execName.c_str()))
-        CPPUNIT_FAIL("Can't find medpartitioner_para, please set MEDCOUPLING_ROOT_DIR");
-    }
+  execName = get_current_dir_name();
+  execName += "/../../MEDPartitioner/medpartitioner_para";
+  if (! std::ifstream(execName.c_str()))
+    CPPUNIT_FAIL("Can't find medpartitioner_para, please set MEDCOUPLING_ROOT_DIR");
   return execName;
 }
 
index 5a715efc951b7c5b07d7d725d5fdf03919bd1be4..78ab03066a738d1518f8f2d900d2f5863d6219d8 100644 (file)
@@ -63,6 +63,7 @@ INSTALL(FILES MEDPartitionerTest.py DESTINATION ${MEDCOUPLING_INSTALL_SCRIPT_PYT
 
 IF(MEDCOUPLING_PARTITIONER_METIS)
    # Python test of partitionner require METIS or PARMETIS?
+   SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH ${CMAKE_CURRENT_BINARY_DIR}/../MEDLoader/Swig)
    SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env)
    ADD_TEST(MEDPartitionerTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDPartitionerTest.py)
    SET_TESTS_PROPERTIES(MEDPartitionerTest PROPERTIES ENVIRONMENT "${tests_env}")
index 75eccd3148961a730e0466a5923f74c909828e01..167db6bc56ace6a886f29590d45b551b1e800b60 100644 (file)
@@ -28,6 +28,7 @@ INCLUDE_DIRECTORIES(
   ${CMAKE_CURRENT_SOURCE_DIR}/../MEDCoupling
   ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL
   ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL/Bases
+  ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNELTest   # for TestIKUtils.hxx
   )
 
 SET(ParaMEDMEMTest_SOURCES
@@ -67,7 +68,7 @@ SET(ParaMEDMEMTest_SOURCES
 
 ADD_LIBRARY(ParaMEDMEMTest SHARED ${ParaMEDMEMTest_SOURCES})
 SET_TARGET_PROPERTIES(ParaMEDMEMTest PROPERTIES COMPILE_FLAGS "")
-TARGET_LINK_LIBRARIES(ParaMEDMEMTest paramedmem paramedloader medcouplingremapper ${CPPUNIT_LIBRARIES})
+TARGET_LINK_LIBRARIES(ParaMEDMEMTest paramedmem paramedloader medcouplingremapper InterpKernelTestUtils ${CPPUNIT_LIBRARIES})
 INSTALL(TARGETS ParaMEDMEMTest DESTINATION ${MEDCOUPLING_INSTALL_LIBS})
 
 SET(TESTSParaMEDMEM)
index dab88ab1d5437f6b6e6f88b271ede3b3e547ff5e..2da61c8e72d421935d865f3d3e61cd44195682d9 100644 (file)
@@ -18,6 +18,7 @@
 //
 
 #include "ParaMEDMEMTest.hxx"
+#include "TestInterpKernelUtils.hxx"
 #include <cppunit/TestAssert.h>
 
 #include <sstream>
 #include <unistd.h>
 #endif
 
-std::string ParaMEDMEMTest::getResourceFile( const std::string& filename )
-{
-  std::string resourceFile = "";
-
-  if ( getenv("MEDCOUPLING_ROOT_DIR") ) {
-    // use MEDCOUPLING_ROOT_DIR env.var
-    resourceFile = getenv("MEDCOUPLING_ROOT_DIR");
-    resourceFile += "/share/resources/med/";
-  }
-  else {
-    resourceFile = get_current_dir_name();
-    resourceFile += "/../../resources/";
-  }
-
-  resourceFile += filename;
-  return resourceFile;
-}
 
 
 //================================================================================
index dab6d31ac91d099653e0641a97537430c30d36e2..77f59fe750c9db18c08de84e016c9e2b981b9550 100644 (file)
@@ -142,7 +142,6 @@ public:
   void testFabienAPI1();
   void testFabienAPI2();
 
-  std::string getResourceFile( const std::string& );
   std::string getTmpDirectory();
   std::string makeTmpFile( const std::string&, const std::string& = "" );
 
index 9ca93d3d69541f0d7b56f59ea608583b3e7ff280..e71170e4d0a70e37769f3e3f6312a14e141f2b39 100644 (file)
@@ -33,6 +33,7 @@
 #include "ICoCoMEDField.hxx"
 #include "ParaMEDLoader.hxx"
 #include "MEDLoader.hxx"
+#include "TestInterpKernelUtils.hxx"
 
  
 #include <string>
@@ -496,8 +497,8 @@ void ParaMEDMEMTest::testInterpKernelDEC_2D_(const char *srcMeth, const char *ta
   ParaMEDMEM::ParaFIELD* parafield;
   ICoCo::MEDField* icocofield ;
   
-  string filename_xml1              = getResourceFile("square1_split");
-  string filename_xml2              = getResourceFile("square2_split");
+  string filename_xml1              = "square1_split";
+  string filename_xml2              = "square2_split";
   //string filename_seq_wr            = makeTmpFile("");
   //string filename_seq_med           = makeTmpFile("myWrField_seq_pointe221.med");
   
@@ -511,10 +512,11 @@ void ParaMEDMEMTest::testInterpKernelDEC_2D_(const char *srcMeth, const char *ta
       
       ostringstream strstream;
       strstream <<master<<rank+1<<".med";
+      string fName = INTERP_TEST::getResourceFile(strstream.str());
       ostringstream meshname ;
       meshname<< "Mesh_2_"<< rank+1;
       
-      mesh=MEDLoader::ReadUMeshFromFile(strstream.str().c_str(),meshname.str().c_str(),0);
+      mesh=MEDLoader::ReadUMeshFromFile(fName.c_str(),meshname.str().c_str(),0);
       
     
       paramesh=new ParaMESH (mesh,*source_group,"source mesh");
@@ -550,9 +552,10 @@ void ParaMEDMEMTest::testInterpKernelDEC_2D_(const char *srcMeth, const char *ta
       string master= filename_xml2;
       ostringstream strstream;
       strstream << master<<(rank-nproc_source+1)<<".med";
+      string fName = INTERP_TEST::getResourceFile(strstream.str());
       ostringstream meshname ;
       meshname<< "Mesh_3_"<<rank-nproc_source+1;
-      mesh = MEDLoader::ReadUMeshFromFile(strstream.str().c_str(),meshname.str().c_str(),0);
+      mesh = MEDLoader::ReadUMeshFromFile(fName.c_str(),meshname.str().c_str(),0);
       
       paramesh=new ParaMESH (mesh,*target_group,"target mesh");
       //      ParaMEDMEM::ParaSUPPORT* parasupport=new UnstructuredParaSUPPORT(support,*target_group);
@@ -700,8 +703,8 @@ void ParaMEDMEMTest::testInterpKernelDEC2_2D_(const char *srcMeth, const char *t
   ParaMEDMEM::MEDCouplingUMesh* mesh;
   ParaMEDMEM::MEDCouplingFieldDouble* mcfield;
   
-  string filename_xml1              = getResourceFile("square1_split");
-  string filename_xml2              = getResourceFile("square2_split");
+  string filename_xml1              = "square1_split";
+  string filename_xml2              = "square2_split";
   
   // To remove tmp files from disk
   ParaMEDMEMTest_TmpFilesRemover aRemover;
@@ -713,10 +716,11 @@ void ParaMEDMEMTest::testInterpKernelDEC2_2D_(const char *srcMeth, const char *t
       
       ostringstream strstream;
       strstream <<master<<rank+1<<".med";
+      string fName = INTERP_TEST::getResourceFile(strstream.str());
       ostringstream meshname ;
       meshname<< "Mesh_2_"<< rank+1;
       
-      mesh=MEDLoader::ReadUMeshFromFile(strstream.str().c_str(),meshname.str().c_str(),0);
+      mesh=MEDLoader::ReadUMeshFromFile(fName.c_str(),meshname.str().c_str(),0);
       ParaMEDMEM::ComponentTopology comptopo;
       if(srcM=="P0")
         {
@@ -756,9 +760,10 @@ void ParaMEDMEMTest::testInterpKernelDEC2_2D_(const char *srcMeth, const char *t
       string master= filename_xml2;
       ostringstream strstream;
       strstream << master<<(rank-nproc_source+1)<<".med";
+      string fName = INTERP_TEST::getResourceFile(strstream.str());
       ostringstream meshname ;
       meshname<< "Mesh_3_"<<rank-nproc_source+1;
-      mesh = MEDLoader::ReadUMeshFromFile(strstream.str().c_str(),meshname.str().c_str(),0);
+      mesh = MEDLoader::ReadUMeshFromFile(fName.c_str(),meshname.str().c_str(),0);
       ParaMEDMEM::ComponentTopology comptopo;
       if(targetM=="P0")
         {
@@ -865,8 +870,8 @@ void ParaMEDMEMTest::testInterpKernelDEC_3D_(const char *srcMeth, const char *ta
     tmp_dir = string(tmp_dir_c);
   else
     tmp_dir = "/tmp";
-  string filename_xml1              = getResourceFile("Mesh3D_10_2d");
-  string filename_xml2              = getResourceFile("Mesh3D_11");
+  string filename_xml1              = "Mesh3D_10_2d";
+  string filename_xml2              = "Mesh3D_11";
   //string filename_seq_wr            = makeTmpFile("");
   //string filename_seq_med           = makeTmpFile("myWrField_seq_pointe221.med");
   
@@ -880,10 +885,11 @@ void ParaMEDMEMTest::testInterpKernelDEC_3D_(const char *srcMeth, const char *ta
       
       ostringstream strstream;
       strstream <<master<<rank+1<<".med";
+      std::string fName = INTERP_TEST::getResourceFile(strstream.str());
       ostringstream meshname ;
       meshname<< "Mesh_3_"<< rank+1;
       
-      mesh=MEDLoader::ReadUMeshFromFile(strstream.str().c_str(),meshname.str().c_str(),0);
+      mesh=MEDLoader::ReadUMeshFromFile(fName.c_str(),meshname.str().c_str(),0);
       
     
       paramesh=new ParaMESH (mesh,*source_group,"source mesh");
@@ -919,9 +925,10 @@ void ParaMEDMEMTest::testInterpKernelDEC_3D_(const char *srcMeth, const char *ta
       string master= filename_xml2;
       ostringstream strstream;
       strstream << master << ".med";
+      std::string fName = INTERP_TEST::getResourceFile(strstream.str());
       ostringstream meshname ;
       meshname<< "Mesh_6";
-      mesh = MEDLoader::ReadUMeshFromFile(strstream.str().c_str(),meshname.str().c_str(),0);
+      mesh = MEDLoader::ReadUMeshFromFile(fName.c_str(),meshname.str().c_str(),0);
       
       paramesh=new ParaMESH (mesh,*target_group,"target mesh");
       //      ParaMEDMEM::ParaSUPPORT* parasupport=new UnstructuredParaSUPPORT(support,*target_group);
@@ -2121,8 +2128,8 @@ void ParaMEDMEMTest::testAsynchronousInterpKernelDEC_2D(double dtA, double tmaxA
     tmp_dir = string(tmp_dir_c);
   else
     tmp_dir = "/tmp";
-  string filename_xml1              = getResourceFile("square1_split");
-  string filename_xml2              = getResourceFile("square2_split"); 
+  string filename_xml1              = "square1_split";
+  string filename_xml2              = "square2_split";
   //string filename_seq_wr            = makeTmpFile("");
   //string filename_seq_med           = makeTmpFile("myWrField_seq_pointe221.med");
   
@@ -2137,10 +2144,11 @@ void ParaMEDMEMTest::testAsynchronousInterpKernelDEC_2D(double dtA, double tmaxA
       
       ostringstream strstream;
       strstream <<master<<rank+1<<".med";
+      string fName = INTERP_TEST::getResourceFile(strstream.str());
       ostringstream meshname ;
       meshname<< "Mesh_2_"<< rank+1;
       
-      mesh=MEDLoader::ReadUMeshFromFile(strstream.str().c_str(),meshname.str().c_str(),0);
+      mesh=MEDLoader::ReadUMeshFromFile(fName.c_str(),meshname.str().c_str(),0);
 
       paramesh=new ParaMESH (mesh,*source_group,"source mesh");
     
@@ -2178,10 +2186,11 @@ void ParaMEDMEMTest::testAsynchronousInterpKernelDEC_2D(double dtA, double tmaxA
       string master= filename_xml2;
       ostringstream strstream;
       strstream << master<<(rank-nproc_source+1)<<".med";
+      string fName = INTERP_TEST::getResourceFile(strstream.str());
       ostringstream meshname ;
       meshname<< "Mesh_3_"<<rank-nproc_source+1;
       
-      mesh = MEDLoader::ReadUMeshFromFile(strstream.str().c_str(),meshname.str().c_str(),0);
+      mesh = MEDLoader::ReadUMeshFromFile(fName.c_str(),meshname.str().c_str(),0);
 
       paramesh=new ParaMESH (mesh,*target_group,"target mesh");
       //      ParaMEDMEM::ParaSUPPORT* parasupport=new UnstructuredParaSUPPORT(support,*target_group);
index 491bbf9e937057dd3e0187ef943646d9de4d8c3f..21959471cdb47f3a2ac59e8089f85742e77a4208 100644 (file)
@@ -31,6 +31,7 @@
 #include "ComponentTopology.hxx"
 #include "ICoCoMEDField.hxx"
 #include "MEDLoader.hxx"
+#include "TestInterpKernelUtils.hxx"
 
 #include <string>
 
@@ -75,8 +76,8 @@ void ParaMEDMEMTest::testStructuredCoincidentDEC() {
   ParaMEDMEM::ParaMESH* paramesh;
   ParaMEDMEM::ParaFIELD* parafield;
 
-  string filename_xml1 = getResourceFile("square1_split");
-  string filename_2    = getResourceFile("square1.med");
+  string filename_xml1 = INTERP_TEST::getResourceFile("square1_split");
+  string filename_2    = INTERP_TEST::getResourceFile("square1.med");
   //string filename_seq_wr  = makeTmpFile("");
   //string filename_seq_med = makeTmpFile("myWrField_seq_pointe221.med");
 
index 48dafb136312b81ddbfeb7a8057d90b3a3e2309e..1640b5dd5c3a7054483d4300c9540fac1eb680cd 100644 (file)
@@ -64,6 +64,7 @@ SALOME_INSTALL_SCRIPTS(${CMAKE_CURRENT_BINARY_DIR}/MEDRenumber.py ${MEDCOUPLING_
 INSTALL(FILES MEDRenumber.i MEDRenumberCommon.i DESTINATION ${MEDCOUPLING_INSTALL_HEADERS})
 INSTALL(FILES MEDRenumberTest.py DESTINATION ${MEDCOUPLING_INSTALL_SCRIPT_PYTHON})
 
+SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH ${CMAKE_CURRENT_BINARY_DIR}/../MEDCoupling_Swig)
 SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env)
 ADD_TEST(MEDRenumberTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDRenumberTest.py)
 SET_TESTS_PROPERTIES(MEDRenumberTest PROPERTIES ENVIRONMENT "${tests_env}")