From: eap Date: Wed, 18 Apr 2012 09:00:08 +0000 (+0000) Subject: fix a failure during 'make distcheck' where medpartitioner is not yet X-Git-Tag: TRIPOLI_323~52 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8fd527a07561861fe58681ad0f734a357362ff54;p=tools%2Fmedcoupling.git fix a failure during 'make distcheck' where medpartitioner is not yet installed to MED_ROOT_DIR + std::string getPartitionerExe() const; --- diff --git a/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx b/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx index 04cd8a198..1a3772363 100644 --- a/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx +++ b/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx @@ -80,6 +80,25 @@ void MEDPARTITIONERTest::setbigSize() setSize(200,300,500); //nb of hexa9 } +std::string MEDPARTITIONERTest::getPartitionerExe() const +{ + std::string execName; + if ( getenv("top_builddir")) // make distcheck + { + execName = getenv("top_builddir"); + execName += "/src/MEDPartitioner/medpartitioner"; + } + else if ( getenv("MED_ROOT_DIR") ) + { + execName=getenv("MED_ROOT_DIR"); //.../INSTALL/MED + execName+="/bin/salome/medpartitioner"; + } + else + { + CPPUNIT_FAIL("Can't find medpartitioner, neither MED_ROOT_DIR nor top_builddir is set"); + } + return execName; +} // ============================================================================ /*! @@ -971,12 +990,11 @@ void MEDPARTITIONERTest::launchMetisOrScotchMedpartitionerOnTestMeshes(std::stri int res; string cmd,execName,sourceName,targetName; - execName=getenv("MED_ROOT_DIR"); //.../INSTALL/MED - execName+="/bin/salome/medpartitioner"; + execName=getPartitionerExe(); cmd="which "+execName+" 2>/dev/null 1>/dev/null"; //no trace res=system(cmd.c_str()); - CPPUNIT_ASSERT_EQUAL(0, res); + CPPUNIT_ASSERT_EQUAL_MESSAGE(execName + " - INVALID PATH TO medpartitioner", 0, res); cmd=execName+" --ndomains=2 --split-method="+MetisOrScotch; //on same proc sourceName=_file_name; @@ -1019,8 +1037,7 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForMesh(std { int res; string fileName,cmd,execName,sourceName,targetName,input; - execName=getenv("MED_ROOT_DIR"); //.../INSTALL/MED - execName+="/bin/salome/medpartitioner"; + execName=getPartitionerExe(); fileName=_file_name_with_faces; ParaMEDMEM::MEDFileUMesh* initialMesh=ParaMEDMEM::MEDFileUMesh::New(fileName.c_str(),_mesh_name.c_str()); @@ -1117,8 +1134,7 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnC { int res; string fileName,cmd,execName,sourceName,targetName,input; - execName=getenv("MED_ROOT_DIR"); //.../INSTALL/MED - execName+="/bin/salome/medpartitioner"; + execName=getPartitionerExe(); fileName=_file_name; fileName.replace(fileName.find(".med"),4,"_WithVecFieldOnCells.med"); @@ -1205,8 +1221,7 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnG { int res; string fileName,cmd,execName,sourceName,targetName,input; - execName=getenv("MED_ROOT_DIR"); //.../INSTALL/MED - execName+="/bin/salome/medpartitioner"; + execName=getPartitionerExe(); fileName=_file_name; fileName.replace(fileName.find(".med"),4,"_WithVecFieldOnGaussNe.med"); diff --git a/src/MEDPartitioner/Test/MEDPARTITIONERTest.hxx b/src/MEDPartitioner/Test/MEDPARTITIONERTest.hxx index a27eff324..5d1445ec8 100644 --- a/src/MEDPartitioner/Test/MEDPARTITIONERTest.hxx +++ b/src/MEDPartitioner/Test/MEDPARTITIONERTest.hxx @@ -89,6 +89,7 @@ public: void setSmallSize(); void setMedianSize(); void setbigSize(); + std::string getPartitionerExe() const; ParaMEDMEM::MEDCouplingUMesh * buildCUBE3DMesh(); ParaMEDMEM::MEDCouplingUMesh * buildFACE3DMesh(); ParaMEDMEM::MEDCouplingUMesh * buildCARRE3DMesh();