1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
4 # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
5 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
7 # This library is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2.1 of the License.
12 # This library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # Lesser General Public License for more details.
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with this library; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 from libMEDMEM_Swig import *
28 filesPath=os.environ["MED_ROOT_DIR"]
29 filesPath=os.path.join(filesPath, "share", "salome", "resources", "med")
37 # executables list to test functionalities
39 testExecfiles.append("testUArray")
40 argListTest.append("")
41 rootFileTest.append("")
45 testExecfiles.append("testUCellModel")
46 argListTest.append("")
47 rootFileTest.append("")
51 testExecfiles.append("testUCoordinate")
52 argListTest.append("")
53 rootFileTest.append("")
57 testExecfiles.append("testUGeoNameMeshEntities")
58 argListTest.append("")
59 rootFileTest.append("")
63 testExecfiles.append("testUMedException")
64 argListTest.append("")
65 rootFileTest.append("")
69 testExecfiles.append("testUModulusArray")
70 argListTest.append("")
71 rootFileTest.append("")
75 testExecfiles.append("testUPointerOf")
76 argListTest.append("")
77 rootFileTest.append("")
81 testExecfiles.append("testUSkyLineArray")
82 argListTest.append("")
83 rootFileTest.append("")
87 testExecfiles.append("testUUnit")
88 argListTest.append("")
89 rootFileTest.append("")
93 testExecfiles.append("test_affect_medarray")
94 argListTest.append("")
95 rootFileTest.append("")
99 testExecfiles.append("test_copie_coordinate")
100 argListTest.append("")
101 rootFileTest.append("")
105 testExecfiles.append("test_copie_medarray")
106 argListTest.append("")
107 rootFileTest.append("")
111 testExecfiles.append("test_MEDMEM_Array")
112 argListTest.append("")
113 rootFileTest.append("")
117 testExecfiles.append("test_MEDMEM_CellModel")
118 argListTest.append("")
119 rootFileTest.append("")
123 testExecfiles.append("test_MEDMEM_ModulusArray")
124 argListTest.append("")
125 rootFileTest.append("")
129 testExecfiles.append("test_MEDMEM_SkyLineArray")
130 argListTest.append("")
131 rootFileTest.append("")
135 testExecfiles.append("test_MEDMEM_Meshing")
136 argListTest.append("toto")
137 rootFileTest.append("")
141 testExecfiles.append("test_gibi_driver")
142 rootFileTest.append("Darcy3_3D_H_10x10x10")
143 argListTest.append(os.path.join(filesPath,"Darcy3_3D_H_10x10x10.sauve"))
147 testExecfiles.append("test_gibi_driver")
148 rootFileTest.append("dx200_dy1_avec_2couches")
149 argListTest.append(os.path.join(filesPath,"dx200_dy1_avec_2couches.sauve"))
153 testExecfiles.append("test_gibi_driver")
154 rootFileTest.append("elle_2D_QT_10x10")
155 argListTest.append(os.path.join(filesPath,"elle_2D_QT_10x10.sauve"))
159 testExecfiles.append("test_gibi_driver")
160 rootFileTest.append("elle_2D_QT_2x2")
161 argListTest.append(os.path.join(filesPath,"elle_2D_QT_2x2.sauve"))
165 testExecfiles.append("test_gibi_driver")
166 rootFileTest.append("elle_2D_QT_40x40")
167 argListTest.append(os.path.join(filesPath,"elle_2D_QT_40x40.sauve"))
171 testExecfiles.append("test_gibi_driver")
172 rootFileTest.append("elle_2D_QT_4x4")
173 argListTest.append(os.path.join(filesPath,"elle_2D_QT_4x4.sauve"))
177 testExecfiles.append("test_gibi_driver")
178 rootFileTest.append("elle_3D_HPr_10x10x10")
179 argListTest.append(os.path.join(filesPath,"elle_3D_HPr_10x10x10.sauve"))
183 testExecfiles.append("test_gibi_driver")
184 rootFileTest.append("elle_3D_HPr_2x2x2")
185 argListTest.append(os.path.join(filesPath,"elle_3D_HPr_2x2x2.sauve"))
189 testExecfiles.append("test_gibi_driver")
190 rootFileTest.append("elle_3D_HPr_4x4x4")
191 argListTest.append(os.path.join(filesPath,"elle_3D_HPr_4x4x4.sauve"))
195 testExecfiles.append("test_gibi_driver")
196 rootFileTest.append("inclusion_2d_raf")
197 argListTest.append(os.path.join(filesPath,"inclusion_2d_raf.sauve"))
201 testExecfiles.append("test_gibi_driver")
202 rootFileTest.append("inclusion_2d")
203 argListTest.append(os.path.join(filesPath,"inclusion_2d.sauve"))
207 testExecfiles.append("test_gibi_driver")
208 rootFileTest.append("mail_ktest1-3-hexa")
209 argListTest.append(os.path.join(filesPath,"mail_ktest1-3-hexa.sauve"))
213 testExecfiles.append("test_gibi_driver")
214 rootFileTest.append("mail_ktest1-3-tetra")
215 argListTest.append(os.path.join(filesPath,"mail_ktest1-3-tetra.sauve"))
219 testExecfiles.append("test_gibi_driver")
220 rootFileTest.append("mail_ktest3-1")
221 argListTest.append(os.path.join(filesPath,"mail_ktest3-1.sauve"))
225 testExecfiles.append("test_gibi_driver")
226 rootFileTest.append("mail_ktest3-2")
227 argListTest.append(os.path.join(filesPath,"mail_ktest3-2.sauve"))
231 testExecfiles.append("test_gibi_driver")
232 rootFileTest.append("maillage_andra2_100elts")
233 argListTest.append(os.path.join(filesPath,"maillage_andra2_100elts.sauve"))
237 testExecfiles.append("test_gibi_driver")
238 rootFileTest.append("maillage_cas2_2d")
239 argListTest.append(os.path.join(filesPath,"maillage_cas2_2d.sauve"))
243 testExecfiles.append("test_gibi_driver")
244 rootFileTest.append("maillage_cas4_234elts")
245 argListTest.append(os.path.join(filesPath,"maillage_cas4_234elts.sauve"))
249 testExecfiles.append("test_gibi_driver")
250 rootFileTest.append("maillage_CHEMVAL_100elts")
251 argListTest.append(os.path.join(filesPath,"maillage_CHEMVAL_100elts.sauve"))
255 testExecfiles.append("test_gibi_driver")
256 rootFileTest.append("maillage_CHEMVAL_40elts")
257 argListTest.append(os.path.join(filesPath,"maillage_CHEMVAL_40elts.sauve"))
261 testExecfiles.append("test_gibi_driver")
262 rootFileTest.append("maillage_chemvalIV_cas1_100elts")
263 argListTest.append(os.path.join(filesPath,"maillage_chemvalIV_cas1_100elts.sauve"))
267 testExecfiles.append("test_gibi_driver")
268 rootFileTest.append("maillage_chemvalIV_cas1_40elts")
269 argListTest.append(os.path.join(filesPath,"maillage_chemvalIV_cas1_40elts.sauve"))
273 # no resource file named maill_mistra_elim.sauve
274 # testExecfiles.append("test_gibi_driver")
275 # rootFileTest.append("maill_mistra_elim")
276 # argListTest.append(os.path.join(filesPath,"maill_mistra_elim.sauve"))
277 # meshTest.append("")
278 # fieldTest.append("")
280 testExecfiles.append("test_gibi_driver")
281 rootFileTest.append("mail_test1-1-qua")
282 argListTest.append(os.path.join(filesPath,"mail_test1-1-qua.sauve"))
286 testExecfiles.append("test_gibi_driver")
287 rootFileTest.append("mail_test1-1-tri")
288 argListTest.append(os.path.join(filesPath,"mail_test1-1-tri.sauve"))
292 testExecfiles.append("test_gibi_driver")
293 rootFileTest.append("mail_test1-2-qua")
294 argListTest.append(os.path.join(filesPath,"mail_test1-2-qua.sauve"))
298 testExecfiles.append("test_gibi_driver")
299 rootFileTest.append("mail_test1-2-tri")
300 argListTest.append(os.path.join(filesPath,"mail_test1-2-tri.sauve"))
304 testExecfiles.append("test_gibi_driver")
305 rootFileTest.append("mail-test1-4-1")
306 argListTest.append(os.path.join(filesPath,"mail-test1-4-1.sauve"))
310 testExecfiles.append("test_gibi_driver")
311 rootFileTest.append("mail-test1-4-2")
312 argListTest.append(os.path.join(filesPath,"mail-test1-4-2.sauve"))
316 testExecfiles.append("test_porflow_driver")
317 rootFileTest.append("boitenew")
318 argListTest.append(os.path.join(filesPath,"boitenew.inp"))
322 testExecfiles.append("test_porflow_driver")
323 rootFileTest.append("Case1")
324 argListTest.append(os.path.join(filesPath,"Case1.inp"))
328 testExecfiles.append("test_porflow_driver")
329 rootFileTest.append("cube")
330 argListTest.append(os.path.join(filesPath,"cube.inp"))
334 testExecfiles.append("test_porflow_driver")
335 rootFileTest.append("test3")
336 argListTest.append(os.path.join(filesPath,"test3.inp"))
340 testExecfiles.append("test_porflow_driver")
341 rootFileTest.append("titi")
342 argListTest.append(os.path.join(filesPath,"titi.inp"))
346 testExecfiles.append("test_copie_connectivity")
347 rootFileTest.append("mesh")
348 meshTest.append("Mesh 1")
350 argListTest.append(os.path.join(filesPath,"mesh.med") + " " + "'Mesh 1'")
352 testExecfiles.append("test_copie_connectivity")
353 rootFileTest.append("maillage_UniSegFam")
354 meshTest.append("maillage_CHEMVAL_100elts")
356 argListTest.append(os.path.join(filesPath,"maillage_UniSegFam.med") + " " + "maillage_CHEMVAL_100elts")
358 testExecfiles.append("test_copie_connectivity")
359 rootFileTest.append("carre_en_quad4")
360 meshTest.append("carre_en_quad4")
362 argListTest.append(os.path.join(filesPath,"carre_en_quad4.med") + " " + "carre_en_quad4")
364 testExecfiles.append("test_copie_connectivity")
365 rootFileTest.append("cube_hexa8")
366 meshTest.append("CUBE_EN_HEXA8")
368 argListTest.append(os.path.join(filesPath,"cube_hexa8.med") + " " + "CUBE_EN_HEXA8")
370 testExecfiles.append("test_copie_connectivity")
371 rootFileTest.append("test19")
372 meshTest.append("maa1")
374 argListTest.append(os.path.join(filesPath,"test19.med") + " " + "maa1")
376 testExecfiles.append("test_copie_connectivity")
377 rootFileTest.append("carre_en_quad4_seg2")
378 meshTest.append("carre_en_quad4_seg2")
380 argListTest.append(os.path.join(filesPath,"carre_en_quad4_seg2.med") + " " + "carre_en_quad4_seg2")
382 testExecfiles.append("test_copie_connectivity")
383 rootFileTest.append("cube_hexa8_quad4")
384 meshTest.append("CUBE_EN_HEXA8_QUAD4")
386 argListTest.append(os.path.join(filesPath,"cube_hexa8_quad4.med") + " " + "CUBE_EN_HEXA8_QUAD4")
388 testExecfiles.append("test_copie_connectivity")
389 rootFileTest.append("pointe")
390 meshTest.append("maa1")
392 argListTest.append(os.path.join(filesPath,"pointe.med") + " " + "maa1")
394 testExecfiles.append("test_copie_family")
395 rootFileTest.append("mesh")
396 meshTest.append("Mesh 1")
398 argListTest.append(os.path.join(filesPath,"mesh.med") + " " + "'Mesh 1'")
400 testExecfiles.append("test_copie_family")
401 rootFileTest.append("pointe")
402 meshTest.append("maa1")
404 argListTest.append(os.path.join(filesPath,"pointe.med") + " " + "maa1")
406 # no nodal families in carre_en_quad4.med
407 # testExecfiles.append("test_copie_family")
408 # rootFileTest.append("carre_en_quad4")
409 # meshTest.append("carre_en_quad4")
410 # fieldTest.append("")
411 # argListTest.append(os.path.join(filesPath,"carre_en_quad4.med") + " " + "carre_en_quad4")
413 testExecfiles.append("test_copie_family")
414 rootFileTest.append("cube_hexa8")
415 meshTest.append("CUBE_EN_HEXA8")
417 argListTest.append(os.path.join(filesPath,"cube_hexa8.med") + " " + "CUBE_EN_HEXA8")
419 testExecfiles.append("test_copie_family")
420 rootFileTest.append("test19")
421 meshTest.append("maa1")
423 argListTest.append(os.path.join(filesPath,"test19.med") + " " + "maa1")
425 # no nodal families in carre_en_quad4_seg2.med
426 # testExecfiles.append("test_copie_family")
427 # rootFileTest.append("carre_en_quad4_seg2")
428 # meshTest.append("carre_en_quad4_seg2")
429 # fieldTest.append("")
430 # argListTest.append(os.path.join(filesPath,"carre_en_quad4_seg2.med") + " " + "carre_en_quad4_seg2")
432 testExecfiles.append("test_copie_family")
433 rootFileTest.append("cube_hexa8_quad4")
434 meshTest.append("CUBE_EN_HEXA8_QUAD4")
436 argListTest.append(os.path.join(filesPath,"cube_hexa8_quad4.med") + " " + "CUBE_EN_HEXA8_QUAD4")
438 testExecfiles.append("test_copie_family")
439 rootFileTest.append("pointe")
440 meshTest.append("maa1")
442 argListTest.append(os.path.join(filesPath,"pointe.med") + " " + "maa1")
444 # no nodal grous in mesh.med
445 # testExecfiles.append("test_copie_group")
446 # rootFileTest.append("mesh")
447 # meshTest.append("Mesh 1")
448 # fieldTest.append("")
449 # argListTest.append(os.path.join(filesPath,"mesh.med") + " " + "'Mesh 1'")
451 # no nodal grous in maillage_UniSegFam.med
452 # testExecfiles.append("test_copie_group")
453 # rootFileTest.append("maillage_UniSegFam")
454 # meshTest.append("maillage_CHEMVAL_100elts")
455 # fieldTest.append("")
456 # argListTest.append(os.path.join(filesPath,"maillage_UniSegFam.med") + " " + "maillage_CHEMVAL_100elts")
458 # no nodal grous in maillage_UniSegFam.med
459 # testExecfiles.append("test_copie_group")
460 # rootFileTest.append("carre_en_quad4")
461 # meshTest.append("carre_en_quad4")
462 # fieldTest.append("")
463 # argListTest.append(os.path.join(filesPath,"carre_en_quad4.med") + " " + "carre_en_quad4")
465 testExecfiles.append("test_copie_group")
466 rootFileTest.append("cube_hexa8")
467 meshTest.append("CUBE_EN_HEXA8")
469 argListTest.append(os.path.join(filesPath,"cube_hexa8.med") + " " + "CUBE_EN_HEXA8")
471 testExecfiles.append("test_copie_group")
472 rootFileTest.append("test19")
473 meshTest.append("maa1")
475 argListTest.append(os.path.join(filesPath,"test19.med") + " " + "maa1")
477 # no nodal grous in carre_en_quad4_seg2.med
478 # testExecfiles.append("test_copie_group")
479 # rootFileTest.append("carre_en_quad4_seg2")
480 # meshTest.append("carre_en_quad4_seg2")
481 # fieldTest.append("")
482 # argListTest.append(os.path.join(filesPath,"carre_en_quad4_seg2.med") + " " + "carre_en_quad4_seg2")
484 testExecfiles.append("test_copie_group")
485 rootFileTest.append("cube_hexa8_quad4")
486 meshTest.append("CUBE_EN_HEXA8_QUAD4")
488 argListTest.append(os.path.join(filesPath,"cube_hexa8_quad4.med") + " " + "CUBE_EN_HEXA8_QUAD4")
490 testExecfiles.append("test_copie_group")
491 rootFileTest.append("pointe")
492 meshTest.append("maa1")
494 argListTest.append(os.path.join(filesPath,"pointe.med") + " " + "maa1")
496 testExecfiles.append("test_copie_mesh")
497 rootFileTest.append("mesh")
498 meshTest.append("Mesh 1")
500 argListTest.append(os.path.join(filesPath,"mesh.med") + " " + "'Mesh 1'")
502 testExecfiles.append("test_copie_mesh")
503 rootFileTest.append("maillage_UniSegFam")
504 meshTest.append("maillage_CHEMVAL_100elts")
506 argListTest.append(os.path.join(filesPath,"maillage_UniSegFam.med") + " " + "maillage_CHEMVAL_100elts")
508 testExecfiles.append("test_copie_mesh")
509 rootFileTest.append("carre_en_quad4")
510 meshTest.append("carre_en_quad4")
512 argListTest.append(os.path.join(filesPath,"carre_en_quad4.med") + " " + "carre_en_quad4")
514 testExecfiles.append("test_copie_mesh")
515 rootFileTest.append("cube_hexa8")
516 meshTest.append("CUBE_EN_HEXA8")
518 argListTest.append(os.path.join(filesPath,"cube_hexa8.med") + " " + "CUBE_EN_HEXA8")
520 testExecfiles.append("test_copie_mesh")
521 rootFileTest.append("test19")
522 meshTest.append("maa1")
524 argListTest.append(os.path.join(filesPath,"test19.med") + " " + "maa1")
526 testExecfiles.append("test_copie_mesh")
527 rootFileTest.append("carre_en_quad4_seg2")
528 meshTest.append("carre_en_quad4_seg2")
530 argListTest.append(os.path.join(filesPath,"carre_en_quad4_seg2.med") + " " + "carre_en_quad4_seg2")
532 testExecfiles.append("test_copie_mesh")
533 rootFileTest.append("cube_hexa8_quad4")
534 meshTest.append("CUBE_EN_HEXA8_QUAD4")
536 argListTest.append(os.path.join(filesPath,"cube_hexa8_quad4.med") + " " + "CUBE_EN_HEXA8_QUAD4")
538 testExecfiles.append("test_copie_mesh")
539 rootFileTest.append("pointe")
540 meshTest.append("maa1")
542 argListTest.append(os.path.join(filesPath,"pointe.med") + " " + "maa1")
544 testExecfiles.append("test_copie_support")
545 rootFileTest.append("mesh")
546 meshTest.append("Mesh 1")
548 argListTest.append(os.path.join(filesPath,"mesh.med") + " " + "'Mesh 1'")
550 testExecfiles.append("test_copie_support")
551 rootFileTest.append("maillage_UniSegFam")
552 meshTest.append("maillage_CHEMVAL_100elts")
554 argListTest.append(os.path.join(filesPath,"maillage_UniSegFam.med") + " " + "maillage_CHEMVAL_100elts")
556 testExecfiles.append("test_copie_support")
557 rootFileTest.append("carre_en_quad4")
558 meshTest.append("carre_en_quad4")
560 argListTest.append(os.path.join(filesPath,"carre_en_quad4.med") + " " + "carre_en_quad4")
562 testExecfiles.append("test_copie_support")
563 rootFileTest.append("cube_hexa8")
564 meshTest.append("CUBE_EN_HEXA8")
566 argListTest.append(os.path.join(filesPath,"cube_hexa8.med") + " " + "CUBE_EN_HEXA8")
568 testExecfiles.append("test_copie_support")
569 rootFileTest.append("test19")
570 meshTest.append("maa1")
572 argListTest.append(os.path.join(filesPath,"test19.med") + " " + "maa1")
574 testExecfiles.append("test_copie_support")
575 rootFileTest.append("carre_en_quad4_seg2")
576 meshTest.append("carre_en_quad4_seg2")
578 argListTest.append(os.path.join(filesPath,"carre_en_quad4_seg2.med") + " " + "carre_en_quad4_seg2")
580 testExecfiles.append("test_copie_support")
581 rootFileTest.append("cube_hexa8_quad4")
582 meshTest.append("CUBE_EN_HEXA8_QUAD4")
584 argListTest.append(os.path.join(filesPath,"cube_hexa8_quad4.med") + " " + "CUBE_EN_HEXA8_QUAD4")
586 testExecfiles.append("test_copie_support")
587 rootFileTest.append("pointe")
588 meshTest.append("maa1")
590 argListTest.append(os.path.join(filesPath,"pointe.med") + " " + "maa1")
592 ###############################################################################
594 nbOfTests = len(testExecfiles)
596 print "Running all test programs with several arguments ... total = ",nbOfTests
601 for i in range(nbOfTests):
602 if (rootFileTest[i] == ""):
603 testOutfiles.append(testExecfiles[i] + ".out")
605 if (meshTest[i] == ""):
606 testOutfiles.append(testExecfiles[i]+ "_" + rootFileTest[i] + ".out")
608 if (fieldTest[i] == ""):
609 meshName = string.replace(meshTest[i]," ","_")
610 testOutfiles.append(testExecfiles[i]+ "_" + rootFileTest[i] + "_" + meshName + ".out")
612 meshName = string.replace(meshTest[i]," ","_")
613 fieldName = string.replace(fieldTest[i]," ","_")
614 testOutfiles.append(testExecfiles[i]+ "_" + rootFileTest[i] + "_" + meshName + "_" + fieldName + ".out")
615 testErrfiles.append(testExecfiles[i] + ".err")
617 for i in range(nbOfTests):
618 aCommand = testExecfiles[i] + " " + argListTest[i] + " > " + testOutfiles[i] + " 2> " + testErrfiles[i]
619 status = os.system(aCommand)
621 print "problem with the command ", aCommand
623 print "END of the Pyhton script ..... Ctrl D to exit"