]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
[EDF29150] : prepare test
authorAnthony Geay <anthony.geay@edf.fr>
Fri, 31 May 2024 16:48:37 +0000 (18:48 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Fri, 31 May 2024 16:48:37 +0000 (18:48 +0200)
src/Launcher/Test/testCrashProofContainer.py

index e8b7a973002f0666a8e1a17bb13466135d8897d7..11ac637ae793ae37b436a27767ecbdfc6b0b534c 100644 (file)
@@ -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()