From 46b819946914fdf15215ad330f101d1bba5edc5b Mon Sep 17 00:00:00 2001 From: abn Date: Fri, 18 Dec 2015 15:06:43 +0100 Subject: [PATCH] Tests are now all runnable from BUILD dir only with no install. --- CMakeLists.txt | 2 +- src/INTERP_KERNELTest/CMakeLists.txt | 11 +++-- .../TestInterpKernelUtils.cxx | 30 +++++++------- .../TestInterpKernelUtils.hxx | 12 ++++-- src/MEDLoader/Swig/CMakeLists.txt | 6 +-- .../Swig/MEDLoaderCouplingTrainingSession.py | 8 ++-- src/MEDLoader/Swig/SauvLoaderTest.py | 14 ++++--- src/MEDLoader/Test/CMakeLists.txt | 6 +-- src/MEDLoader/Test/MEDLoaderTest.cxx | 27 ++---------- src/MEDLoader/Test/MEDLoaderTest.hxx | 1 - src/MEDLoader/Test/SauvLoaderTest.cxx | 32 ++------------- src/MEDLoader/Test/SauvLoaderTest.hxx | 1 - .../Test/MEDPARTITIONERTest.cxx | 15 +++---- .../Test/MEDPARTITIONERTestPara.cxx | 16 ++++---- src/MEDPartitioner_Swig/CMakeLists.txt | 1 + src/ParaMEDMEMTest/CMakeLists.txt | 3 +- src/ParaMEDMEMTest/ParaMEDMEMTest.cxx | 18 +------- src/ParaMEDMEMTest/ParaMEDMEMTest.hxx | 1 - .../ParaMEDMEMTest_InterpKernelDEC.cxx | 41 +++++++++++-------- ...ParaMEDMEMTest_StructuredCoincidentDEC.cxx | 5 ++- src/RENUMBER_Swig/CMakeLists.txt | 1 + 21 files changed, 108 insertions(+), 143 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3aa32d340..8786daa3a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() diff --git a/src/INTERP_KERNELTest/CMakeLists.txt b/src/INTERP_KERNELTest/CMakeLists.txt index 17f8cc689..fcc8f4147 100644 --- a/src/INTERP_KERNELTest/CMakeLists.txt +++ b/src/INTERP_KERNELTest/CMakeLists.txt @@ -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 diff --git a/src/INTERP_KERNELTest/TestInterpKernelUtils.cxx b/src/INTERP_KERNELTest/TestInterpKernelUtils.cxx index 262699a35..2275c57b0 100644 --- a/src/INTERP_KERNELTest/TestInterpKernelUtils.cxx +++ b/src/INTERP_KERNELTest/TestInterpKernelUtils.cxx @@ -27,31 +27,31 @@ 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 +#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_ diff --git a/src/MEDLoader/Swig/CMakeLists.txt b/src/MEDLoader/Swig/CMakeLists.txt index e448f189c..29a81d6dc 100644 --- a/src/MEDLoader/Swig/CMakeLists.txt +++ b/src/MEDLoader/Swig/CMakeLists.txt @@ -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 diff --git a/src/MEDLoader/Swig/MEDLoaderCouplingTrainingSession.py b/src/MEDLoader/Swig/MEDLoaderCouplingTrainingSession.py index 24520950d..730772680 100644 --- a/src/MEDLoader/Swig/MEDLoaderCouplingTrainingSession.py +++ b/src/MEDLoader/Swig/MEDLoaderCouplingTrainingSession.py @@ -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() diff --git a/src/MEDLoader/Swig/SauvLoaderTest.py b/src/MEDLoader/Swig/SauvLoaderTest.py index cab156183..3e0a45fcf 100644 --- a/src/MEDLoader/Swig/SauvLoaderTest.py +++ b/src/MEDLoader/Swig/SauvLoaderTest.py @@ -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): diff --git a/src/MEDLoader/Test/CMakeLists.txt b/src/MEDLoader/Test/CMakeLists.txt index 79dd72204..1304af82c 100644 --- a/src/MEDLoader/Test/CMakeLists.txt +++ b/src/MEDLoader/Test/CMakeLists.txt @@ -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}") diff --git a/src/MEDLoader/Test/MEDLoaderTest.cxx b/src/MEDLoader/Test/MEDLoaderTest.cxx index 84a59d8ba..85f0add78 100644 --- a/src/MEDLoader/Test/MEDLoaderTest.cxx +++ b/src/MEDLoader/Test/MEDLoaderTest.cxx @@ -24,10 +24,10 @@ #include "MEDCouplingUMesh.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingMemArray.hxx" +#include "TestInterpKernelUtils.hxx" // getResourceFile() #include #include -#include // 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 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 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 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 }; diff --git a/src/MEDLoader/Test/MEDLoaderTest.hxx b/src/MEDLoader/Test/MEDLoaderTest.hxx index b42b3b3db..1839c674c 100644 --- a/src/MEDLoader/Test/MEDLoaderTest.hxx +++ b/src/MEDLoader/Test/MEDLoaderTest.hxx @@ -100,7 +100,6 @@ namespace ParaMEDMEM MEDCouplingFieldDouble *buildVecFieldOnGauss_1(); MEDCouplingFieldDouble *buildVecFieldOnGaussNE_1(); - std::string getResourceFile( const std::string& filename ) const; }; } diff --git a/src/MEDLoader/Test/SauvLoaderTest.cxx b/src/MEDLoader/Test/SauvLoaderTest.cxx index 6ac13e4fe..66fbcda6b 100644 --- a/src/MEDLoader/Test/SauvLoaderTest.cxx +++ b/src/MEDLoader/Test/SauvLoaderTest.cxx @@ -24,6 +24,7 @@ #include "MEDFileData.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingMemArray.hxx" +#include "TestInterpKernelUtils.hxx" // getResourceFile() #ifdef WIN32 # include @@ -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 sr=SauvReader::New(file.c_str()); MEDCouplingAutoRefCountObjectPtr 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 sr=SauvReader::New(sauvFile.c_str()); MEDCouplingAutoRefCountObjectPtr 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 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; -} diff --git a/src/MEDLoader/Test/SauvLoaderTest.hxx b/src/MEDLoader/Test/SauvLoaderTest.hxx index 586285cad..ee21344a5 100644 --- a/src/MEDLoader/Test/SauvLoaderTest.hxx +++ b/src/MEDLoader/Test/SauvLoaderTest.hxx @@ -42,7 +42,6 @@ namespace ParaMEDMEM public: void tearDown(); - static std::string getResourceFile( const std::string& filename ); }; } diff --git a/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx b/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx index 242de7f99..505d48366 100644 --- a/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx +++ b/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx @@ -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; } diff --git a/src/MEDPartitioner/Test/MEDPARTITIONERTestPara.cxx b/src/MEDPartitioner/Test/MEDPARTITIONERTestPara.cxx index ed5bc1809..991abf0ae 100644 --- a/src/MEDPartitioner/Test/MEDPARTITIONERTestPara.cxx +++ b/src/MEDPartitioner/Test/MEDPARTITIONERTestPara.cxx @@ -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; } diff --git a/src/MEDPartitioner_Swig/CMakeLists.txt b/src/MEDPartitioner_Swig/CMakeLists.txt index 5a715efc9..78ab03066 100644 --- a/src/MEDPartitioner_Swig/CMakeLists.txt +++ b/src/MEDPartitioner_Swig/CMakeLists.txt @@ -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}") diff --git a/src/ParaMEDMEMTest/CMakeLists.txt b/src/ParaMEDMEMTest/CMakeLists.txt index 75eccd314..167db6bc5 100644 --- a/src/ParaMEDMEMTest/CMakeLists.txt +++ b/src/ParaMEDMEMTest/CMakeLists.txt @@ -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) diff --git a/src/ParaMEDMEMTest/ParaMEDMEMTest.cxx b/src/ParaMEDMEMTest/ParaMEDMEMTest.cxx index dab88ab1d..2da61c8e7 100644 --- a/src/ParaMEDMEMTest/ParaMEDMEMTest.cxx +++ b/src/ParaMEDMEMTest/ParaMEDMEMTest.cxx @@ -18,6 +18,7 @@ // #include "ParaMEDMEMTest.hxx" +#include "TestInterpKernelUtils.hxx" #include #include @@ -30,23 +31,6 @@ #include #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; -} //================================================================================ diff --git a/src/ParaMEDMEMTest/ParaMEDMEMTest.hxx b/src/ParaMEDMEMTest/ParaMEDMEMTest.hxx index dab6d31ac..77f59fe75 100644 --- a/src/ParaMEDMEMTest/ParaMEDMEMTest.hxx +++ b/src/ParaMEDMEMTest/ParaMEDMEMTest.hxx @@ -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& = "" ); diff --git a/src/ParaMEDMEMTest/ParaMEDMEMTest_InterpKernelDEC.cxx b/src/ParaMEDMEMTest/ParaMEDMEMTest_InterpKernelDEC.cxx index 9ca93d3d6..e71170e4d 100644 --- a/src/ParaMEDMEMTest/ParaMEDMEMTest_InterpKernelDEC.cxx +++ b/src/ParaMEDMEMTest/ParaMEDMEMTest_InterpKernelDEC.cxx @@ -33,6 +33,7 @@ #include "ICoCoMEDField.hxx" #include "ParaMEDLoader.hxx" #include "MEDLoader.hxx" +#include "TestInterpKernelUtils.hxx" #include @@ -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 < @@ -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"); diff --git a/src/RENUMBER_Swig/CMakeLists.txt b/src/RENUMBER_Swig/CMakeLists.txt index 48dafb136..1640b5dd5 100644 --- a/src/RENUMBER_Swig/CMakeLists.txt +++ b/src/RENUMBER_Swig/CMakeLists.txt @@ -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}") -- 2.39.2