]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
fix a failure during 'make distcheck' where medpartitioner is not yet
authoreap <eap@opencascade.com>
Wed, 18 Apr 2012 09:00:08 +0000 (09:00 +0000)
committereap <eap@opencascade.com>
Wed, 18 Apr 2012 09:00:08 +0000 (09:00 +0000)
installed to MED_ROOT_DIR

+  std::string getPartitionerExe() const;

src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx
src/MEDPartitioner/Test/MEDPARTITIONERTest.hxx

index 04cd8a1981b05e0f5dc4ef6f68000dee9a35ffb1..1a377236333fa069aaaafc4779fb85d3bc5f99e8 100644 (file)
@@ -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");
   
index a27eff324016a73f543b5b56006dba37ad36315f..5d1445ec8c65f2a8974a91ea86cb631f83c20b0e 100644 (file)
@@ -89,6 +89,7 @@ public:
   void setSmallSize();
   void setMedianSize();
   void setbigSize();
+  std::string getPartitionerExe() const;
   ParaMEDMEM::MEDCouplingUMesh * buildCUBE3DMesh();
   ParaMEDMEM::MEDCouplingUMesh * buildFACE3DMesh();
   ParaMEDMEM::MEDCouplingUMesh * buildCARRE3DMesh();