From: Anthony Geay Date: Fri, 31 May 2024 16:48:37 +0000 (+0200) Subject: [EDF29150] : prepare test X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f3f85a1f668c0d398329ba5a8e2022f8a4057b19;p=modules%2Fkernel.git [EDF29150] : prepare test --- diff --git a/src/Launcher/Test/testCrashProofContainer.py b/src/Launcher/Test/testCrashProofContainer.py index e8b7a9730..11ac637ae 100644 --- a/src/Launcher/Test/testCrashProofContainer.py +++ b/src/Launcher/Test/testCrashProofContainer.py @@ -53,6 +53,19 @@ cst = KernelBasis.GetTimeAdjustmentCst() KernelBasis.HeatMarcel(5 * nbcore * cst,nbcore) j = 8*i""" +killMeAtTheEnd = """import atexit +import KernelServices + +def ErrorAtexit(): + KernelServices.GenerateViolentMemoryFaultForTestPurpose() + +atexit.register(ErrorAtexit) + +print("OKKKKKK") +j = 9 * i +print("OKKKKKK3333") +""" + class testPerfLogManager1(unittest.TestCase): def test0(self): """ @@ -156,6 +169,26 @@ class testPerfLogManager1(unittest.TestCase): self.assertGreater(len(greater_than_100),1) # At minimum one measure must report CPU load > 100% cont.Shutdown() + def test3(self): + """ + [EDF29150] : test that we can resist to a crash at exit + """ + salome.salome_init() + KernelBasis.SetPyExecutionMode("OutOfProcessWithReplay") + hostname = "localhost" + cp = pylauncher.GetRequestForGiveContainer(hostname,"container_crash_test") + salome.cm.SetBigObjOnDiskThreshold(1000) + salome.cm.SetOverrideEnvForContainersSimple(env = []) + cont = salome.cm.GiveContainer(cp) + poa = salome.orb.resolve_initial_references("RootPOA") + obj = SALOME_PyNode.SenderByte_i(poa,pickle.dumps( (["i"],{"i": 3} ) )) ; id_o = poa.activate_object(obj) ; refPtr = poa.id_to_reference(id_o) + pyscript = cont.createPyScriptNode("testScript4",killMeAtTheEnd) + pyscript.executeFirst(refPtr) + ret = pyscript.executeSecond(["j"]) + ret = pickle.loads( SALOME_PyNode.SeqByteReceiver(ret[0]).data() ) + self.assertEqual(ret,27) + cont.Shutdown() + if __name__ == '__main__': from salome_utils import positionVerbosityOfLoggerRegardingState,setVerboseLevel,setVerbose salome.standalone()