From: Anthony Geay Date: Fri, 5 Jan 2018 07:19:23 +0000 (+0100) Subject: Test to check that listVars and fetchSerializedContent of RequestSwitcher are callabl... X-Git-Tag: V9_0_0~1^2~8 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=97cae9f9475e62f2a94a2bd9f3d65984048f2ae2;p=modules%2Fkernel.git Test to check that listVars and fetchSerializedContent of RequestSwitcher are callable even if holdRequests has been invoked on same DataScopeSever --- diff --git a/src/SALOMESDS/TestSalomeSDS.py b/src/SALOMESDS/TestSalomeSDS.py index 6ed7efc14..0a05549c0 100644 --- a/src/SALOMESDS/TestSalomeSDS.py +++ b/src/SALOMESDS/TestSalomeSDS.py @@ -345,21 +345,34 @@ class SalomeSDSTest(unittest.TestCase): Warning this method expects a not overloaded machine to be run because test is based on ellapse time. """ scopeName="Scope1" + varName="ab" + zeObj={"ab":[5,6]} dsm=salome.naming_service.Resolve("/DataServerManager") dsm.cleanScopesInNS() if scopeName in dsm.listScopes(): dsm.removeDataScope(scopeName) # l is for main process sync. to be sure to launch test when sub process is ready # l2 lock is for sub process sync. + dss,isCreated=dsm.giveADataScopeTransactionCalled(scopeName) + self.assertTrue(isCreated) l=mp.Lock(); l2=mp.Lock() l.acquire() ; l2.acquire() cv=mp.Condition(mp.Lock()) - dss,isCreated=dsm.giveADataScopeTransactionCalled(scopeName) - self.assertTrue(isCreated) p=mp.Process(target=func_test7,args=(scopeName,l,l2,cv)) p.start() + ################ agy : Do not invoke using dss before this line (p.start). + ################ If you do so, deadlock occurs between next rs.activeRequests() and dss.createRdWrVarTransac in func_test7 + ################ Why ? Dont know. Omnipy problem ? + ################ Sounds like a cache in omnipy. cache is copied on fork (implied by p.start) and this cache is so "shared" between this process and the child process. + dss,isCreated=dsm.giveADataScopeTransactionCalled(scopeName) + self.assertTrue(not isCreated) + t0=dss.createRdWrVarTransac(varName,obj2Str(zeObj)) + dss.atomicApply([t0]) + dss,isCreated=dsm.giveADataScopeTransactionCalled(scopeName) + self.assertTrue(not isCreated) l.acquire() rs=dss.getRequestSwitcher() ; rs.holdRequests() # The aim of the test + self.assertEqual(rs.listVars(),[varName]) # call whereas holdRequest is called l2.release() # tell slave process that it's ready for micro-test1 time.sleep(nbOfSecWait) rs.activeRequests() # The aim of the test @@ -370,6 +383,7 @@ class SalomeSDSTest(unittest.TestCase): time.sleep(0.01) # let main proc the priority rs.holdRequests() # the aim of the test is here. main process is occupied 1s -> holdRequests is Expected to wait s=(datetime.now()-s).total_seconds() + self.assertTrue(str2Obj(rs.fetchSerializedContent(varName))==zeObj) # call whereas holdRequest is called rs.activeRequests() self.assertTrue(s>=0.99*nbOfSecWait and s