1 # Copyright (C) 2015-2016 CEA/DEN, EDF R&D
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 # bug revealed by otgui on 8/2/16. Several lock/unlock session. test1.xml is Cogeneration.xml.
22 def buildScheme(fname):
25 SALOMERuntime.RuntimeSALOME.setRuntime()
26 r=SALOMERuntime.getSALOMERuntime()
27 p0=r.createProc("run")
29 p=r.createBloc("toto")
32 cont=p0.createContainer("MyWonderfulContainer","Salome")
33 td=p0.createType("double","double")
34 n0=r.createScriptNode("Salome","PyScript0")
36 q=n0.edAddInputPort("q",td)
37 ep=n0.edAddOutputPort("ep",td)
38 n0.setScript("ep=1./(4.-q)") # <- force division by 0
39 n0.setExecutionMode("remote")
46 session=evalyfx.YACSEvalSession()
49 efx=evalyfx.YACSEvalYFX.BuildFromFile(fname)
50 #efx.setParallelizeStatus(False)
51 efx.getParams().setStopASAPAfterErrorStatus(False)
52 inps=efx.getFreeInputPorts()
54 outps=efx.getFreeOutputPorts()
55 inps[0].setSequenceOfValuesToEval([1.,2.,3.,4.,5.,6.])
56 efx.lockPortsForEvaluation(inps,outps)
57 rss=efx.giveResources()
58 rss[0][0].setWantedMachine("localhost")
59 assert(rss.isInteractive())
61 assert(efx.getStatusOfRunStr()=='SOME_SAMPLES_FAILED_AND_ALL_OF_THEM_FAILED_DETERMINISTICALLY')
62 c,d=efx.getResultsInCaseOfFailure()
63 assert(d==[0,1,2,4,5])# case 3 is not in !
66 for f,g in zip(c,[0.3333333333333333,0.5,1.0,-1.0,-0.5]):
67 assert(abs(f-g)<1e-12)
69 st=efx.getErrorDetailsInCaseOfFailure()
70 assert("NODE = toto.PyScript0" in st)
71 assert("float division by zero" in st)