Salome HOME
Ajout d'un test de non régression pour blocFissure
[modules/smesh.git] / src / Tools / blocFissure / CasTests / execution_Cas.py
index 971405d1d738da1d39a374c6a110bcf0e3a50ae5..2213dbce75d8edcb75207a400cb018eb3263474b 100644 (file)
 #
 """Lancement des cas-tests de blocFissure"""
 
-import traceback
 import logging
-from blocFissure import gmu
+import os
+import tempfile
+import traceback
+
 from blocFissure.gmu import initLog
-from blocFissure.gmu import geomsmesh
 from blocFissure.gmu.casStandard import casStandard
 
 # -----------------------------------------------------------------------------------------------
-#initLog.setDebug()
-#initLog.setVerbose()
-#initLog.setRelease()
-#initLog.setPerfTests()
+LOGFILE = os.path.join(tempfile.gettempdir(),"blocFissure.log")
+#initLog.setDebug(LOGFILE)     # debug = 10
+#initLog.setVerbose(LOGFILE)   # info = 20
+#initLog.setRelease(LOGFILE)   # warning = 30
+#initLog.setPerfTests(LOGFILE) # critical = 50
+#initLog.setAlways(LOGFILE)    # critical = 50
 
 # ---tous les cas en séquence, ou les cas sélectionnés ...
-TORUNOK = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0] # OK
+TORUNOK = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 ] # OK 19/04/2021
 #           0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28
 #RUNALL = False
 RUNALL = True
 if RUNALL:
-  TORUN =   [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
-#             0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28
+  TORUN = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
+#           0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28
+  TORUN = TORUNOK
 else:
   TORUNPB = list()
   for IAUX in TORUNOK:
@@ -47,7 +51,7 @@ else:
   print ("TORUN = {} # OK".format(TORUNOK))
   print ("TORUN = {} # PB".format(TORUNPB))
 #                                                                                                    genereMateriel
-  TORUN = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0] # aucun
+  TORUN = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0] # aucun
   TORUN = [ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # cubeAngle
   TORUN = [ 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # cubeFin
   TORUN = [ 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # decoupeCylindre
@@ -56,11 +60,12 @@ else:
   TORUN = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # ellipse_probleme + fissureGauche2
   TORUN = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # eprouvetteCourbe
   TORUN = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # eprouvetteDroite
-  TORUN = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # fissureGauche + fissureGauche2
+  TORUN = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # fissureGauche
+  TORUN = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # fissureGauche2
   TORUN = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0] # vis
   TORUN = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1] # tube
 #           0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28
-  TORUN = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0] # OK
+  TORUN = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0] #  OK
 # -----------------------------------------------------------------------------------------------
 
 def caract_l_problemes ():
@@ -142,29 +147,13 @@ def caract_l_problemes ():
 
   n_cas = 13
   # genereMateriel : fissureGauche
-  # genereMateriel : fissureGauche2
   from blocFissure.CasTests.faceGauche import faceGauche
   l_problemes.append(faceGauche(n_cas))
 
   n_cas = 14
-  # genereMateriel : aucun
+  # genereMateriel : fissureGauche2
   from blocFissure.CasTests.faceGauche_2 import faceGauche_2
   l_problemes.append(faceGauche_2(n_cas))
-  #"boiteDefaut" has not been computed:
-  #-  "algo3d_boiteDefaut" failed. Error: Algorithm failed. Presumably, the surface mesh is not compatible with the domain being processed (warning).
-  #An edge is unique (i.e., bounds a hole in the surface).
-  #The surface mesh includes at least one hole. The domain is not well defined.
-  #See /tmp/GHS3D_18605_10269264.log for more information
-  #Traceback (most recent call last):
-    #File "/home/D68518/salome-dev/DEV_package/appli_DEV_package/lib/python3.6/site-packages/salome/blocFissure/CasTests/execution_Cas.py", line 222, in <module>
-      #ok_maillage = cas.executeProbleme()
-    #File "/home/D68518/salome-dev/DEV_package/appli_DEV_package/lib/python3.6/site-packages/salome/blocFissure/gmu/fissureGenerique.py", line 122, in executeProbleme
-      #self.maillageFissureParams, elementsDefaut, step)
-    #File "/home/D68518/salome-dev/DEV_package/appli_DEV_package/lib/python3.6/site-packages/salome/blocFissure/CasTests/faceGauche_2.py", line 108, in genereMaillageFissure
-      #maillageFissureParams, elementsDefaut, step)
-    #File "/home/D68518/salome-dev/DEV_package/appli_DEV_package/lib/python3.6/site-packages/salome/blocFissure/gmu/construitFissureGenerale.py", line 330, in construitFissureGenerale
-      #raise Exception(text)
-  #Exception: Erreur au calcul du maillage.
 
   n_cas = 15
   # genereMateriel : aucun
@@ -230,21 +219,6 @@ def caract_l_problemes ():
   # genereMateriel : vis
   from blocFissure.CasTests.vis_1 import vis_1
   l_problemes.append(vis_1(n_cas))
-  #"Mesh_22" has not been computed:
-  #-  "algo2d_faceFiss" failed on FACE #2. Error: Algorithm failed. NgException at Surface meshing: Problem in Surface mesh generation
-  #-  "algo1d_edgeFissPeau" failed on EDGE #9. Error: Algorithm failed. Source elements don't cover totally the geometrical edge
-  #Traceback (most recent call last):
-    #File "/home/D68518/salome-dev/DEV_package/appli_DEV_package/lib/python3.6/site-packages/salome/blocFissure/CasTests/execution_Cas.py", line 233, in <module>
-      #ok_maillage = cas.executeProbleme()
-    #File "/home/D68518/salome-dev/DEV_package/appli_DEV_package/lib/python3.6/site-packages/salome/blocFissure/gmu/fissureGenerique.py", line 122, in executeProbleme
-      #self.maillageFissureParams, elementsDefaut, step)
-    #File "/home/D68518/salome-dev/DEV_package/appli_DEV_package/lib/python3.6/site-packages/salome/blocFissure/CasTests/vis_1.py", line 116, in genereMaillageFissure
-      #maillageFissureParams, elementsDefaut, step)
-    #File "/home/D68518/salome-dev/DEV_package/appli_DEV_package/lib/python3.6/site-packages/salome/blocFissure/gmu/construitFissureGenerale.py", line 282, in construitFissureGenerale
-      #meshPipeGroups, areteFaceFissure, rayonPipe, nbsegRad)
-    #File "/home/D68518/salome-dev/DEV_package/appli_DEV_package/lib/python3.6/site-packages/salome/blocFissure/gmu/mailleFacesFissure.py", line 69, in mailleFacesFissure
-      #raise Exception(text)
-  #Exception: Erreur au calcul du maillage.
 
   n_cas = 28
   # genereMateriel : tube
@@ -268,20 +242,23 @@ def calcul_cas (n_cas, cas, d_aux, ligne):
     nom = cas.nomProbleme
   texte_a = "\n=== Exécution du cas n° {}, '{}'".format(n_cas,nom)
   logging.critical(ligne+texte_a)
+
   try:
     ok_maillage = cas.executeProbleme()
   except:
     traceback.print_exc()
-    texte = "Problème avec le cas n° {}, '{}'\n".format(n_cas,nom)
     ok_maillage = False
+  if not ok_maillage:
+    texte = "Problème avec le cas n° {}, '{}'\n".format(n_cas,nom)
   print(ligne)
+
   return ok_maillage, texte
 #=============================================================
 def calcul_tout (l_problemes, d_aux):
   """Calcul de tous les cas"""
 
   ligne = "---------------------------------------------------------------------"
-  texte = ""
+  texte = "\n"
   nb_cas_ok = 0
   nb_cas_nook = 0
   for n_cas, cas in enumerate(l_problemes):
@@ -303,6 +280,7 @@ def calcul_tout (l_problemes, d_aux):
     else:
       texte += "Les {} tests se sont bien passés.\n".format(nb_cas)
   print (texte+ligne)
+  logging.critical(ligne+texte)
 
   return
 #=============================================================