From 1dafe295a30df6a58e960fc69afca58ca84f5df6 Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Tue, 8 Mar 2016 11:18:14 +0100 Subject: [PATCH] Manage correctly DISBLED state for ElementaryNode. --- src/engine/ElementaryNode.cxx | 10 +++++----- src/runtime/PythonNode.cxx | 5 +++++ .../Test/StdAloneYacsLoaderTest1.py | 16 ++++++++++++++++ 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/engine/ElementaryNode.cxx b/src/engine/ElementaryNode.cxx index c92608532..76841e736 100644 --- a/src/engine/ElementaryNode.cxx +++ b/src/engine/ElementaryNode.cxx @@ -92,17 +92,17 @@ void ElementaryNode::initCommonPartWithoutStateManagement(bool start) for(list::iterator iter2=_setOfInputPort.begin();iter2!=_setOfInputPort.end();iter2++) (*iter2)->exInit(start); _inGate.exReset(); - if(_state == YACS::DISABLED) - { - exDisabledState(); // to refresh propagation of DISABLED state - return; - } } void ElementaryNode::init(bool start) { DEBTRACE("ElementaryNode::init " << getName() << " " << start << " " << _state); initCommonPartWithoutStateManagement(start); + if(_state == YACS::DISABLED) + { + exDisabledState(); // to refresh propagation of DISABLED state + return ; + } setState(YACS::READY); } diff --git a/src/runtime/PythonNode.cxx b/src/runtime/PythonNode.cxx index ddf37d0cb..9160133f3 100644 --- a/src/runtime/PythonNode.cxx +++ b/src/runtime/PythonNode.cxx @@ -815,6 +815,11 @@ PyFuncNode::~PyFuncNode() void PyFuncNode::init(bool start) { initCommonPartWithoutStateManagement(start); + if(_state == YACS::DISABLED) + { + exDisabledState(); // to refresh propagation of DISABLED state + return ; + } if(start) //complete initialization setState(YACS::READY); else if(_state > YACS::LOADED)// WARNING FuncNode has internal vars (CEA usecase) ! Partial initialization (inside a loop). Exclusivity of funcNode. diff --git a/src/yacsloader_swig/Test/StdAloneYacsLoaderTest1.py b/src/yacsloader_swig/Test/StdAloneYacsLoaderTest1.py index 962f579d8..6a52e6a28 100644 --- a/src/yacsloader_swig/Test/StdAloneYacsLoaderTest1.py +++ b/src/yacsloader_swig/Test/StdAloneYacsLoaderTest1.py @@ -176,6 +176,22 @@ def sum(i): self.assertEqual(endNode_error.getPyObj(),0) pass + def test4(self): + """ test linked to TestSaveLoadRun.test20. This is a smaller test coming from EDF autotest""" + xmlFileName="test4.xml" + p=self.r.createProc("test26") + n=self.r.createScriptNode("","node1") + n.setScript("import os") + p.edAddChild(n) + n.setState(pilot.DISABLED) + # + ex=pilot.ExecutorSwig() + self.assertEqual(p.getState(),pilot.READY) + ex.RunW(p,0) + self.assertEqual(p.getState(),pilot.ACTIVATED) + self.assertEqual(n.getState(),pilot.DISABLED) # <- test is here. + pass + def tearDown(self): del self.r del self.l -- 2.30.2