]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Temporary disable proxy file deletion to have time to solve refcnt problem
authorAnthony Geay <anthony.geay@edf.fr>
Fri, 25 Aug 2023 07:49:51 +0000 (09:49 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Fri, 25 Aug 2023 07:49:51 +0000 (09:49 +0200)
src/Container/SALOME_PyNode.py
src/Container/Test/testProxy.py

index d98ae6cfa5c533161b6d00c37fe921489afd4f8f..df59850ca00bde9f750b07a048c3689f92a4f209 100644 (file)
@@ -155,7 +155,10 @@ def DecrRefInFile(fname):
   cnt = TypeCounter.from_buffer_copy( cntb ).value
   #
   if cnt == 1:
-    os.unlink( fname )
+    pass
+    #print("Remove {}".format(fname))
+    #print("Remove {}".format(str(GetObjectFromFile(fname)[0])))
+    #os.unlink( fname )
   else:
     with open(fname,"rb+") as f:
         f.write( bytes( TypeCounter(cnt-1) ) )
@@ -233,6 +236,15 @@ class BigObjectOnDiskBase:
     if self._destroy:
       DecrRefInFile( self._filename )
 
+  def delDebug(self):
+    import os
+    if self._destroy:
+      if os.path.exists( self._filename ):
+        DecrRefInFile( self._filename )
+      else:
+        import KernelServices
+        KernelServices.GenerateViolentMemoryFaultForTestPurpose()
+
   def getFileName(self):
     return self._filename
   
index d3e7b50dbee2a7d9cdb0e9c076094c860feecb30..4ed4dce82ce6ca381b1ac65176bf90d4f4ffebc6 100644 (file)
@@ -70,9 +70,9 @@ c = os.environ["SALOME_BIG_OBJ_ON_DISK_THRES"]
 j = a,b,c"""
             pyscript = cont.createPyScriptNode("testScript",script_st)
             a,b,c = pickle.loads(pyscript.execute(["j"],pickle.dumps(([],{}))))[0]
-            assert( a == val_for_big_obj )
-            assert( b == val_for_jj )
-            assert( c == val_for_thres )
+            self.assertTrue( a == val_for_big_obj )
+            self.assertTrue( b == val_for_jj )
+            self.assertTrue( c == val_for_thres )
             # check environment using POSIX API in the container process
             for k,v in [("SALOME_FILE_BIG_OBJ_DIR",val_for_big_obj),("SALOME_BIG_OBJ_ON_DISK_THRES",val_for_thres),("jj",val_for_jj)]:
                 assert( {elt.key:elt.value.value() for elt in cont.get_os_environment()}[k] == v )
@@ -86,19 +86,19 @@ j = a,b,c"""
             pyscript2 = cont.createPyScriptNode("testScript2",script_st2)
             pyscript2.executeFirst(refPtr)
             ret2 = pyscript2.executeSecond(["ob"])
-            assert( len(ret2) == 1)
+            self.assertTrue( len(ret2) == 1)
             ret2 = ret2[0]
             ret3 = pickle.loads( SALOME_PyNode.SeqByteReceiver(ret2).data() )
-            assert( isinstance( ret3, SALOME_PyNode.BigObjectOnDiskList ) )
-            assert( val_for_big_obj == os.path.dirname( ret3.getFileName() ) )# very important part of test
-            assert( ret3.get() == list(range(100)) )
+            self.assertTrue( isinstance( ret3, SALOME_PyNode.BigObjectOnDiskList ) )
+            self.assertTrue( val_for_big_obj == os.path.dirname( ret3.getFileName() ) )# very important part of test
+            self.assertTrue( ret3.get() == list(range(100)) )
             fn = ret3.getFileName()
-            assert( os.path.exists( fn ) )
+            self.assertTrue( os.path.exists( fn ) )
             ret3.unlinkOnDestructor()
             del ret3
             import gc
             gc.collect(0)
-            assert( not os.path.exists( fn ) ) # at destruction of ret3 the corresponding pckl file must be destructed
+            #self.assertTrue( not os.path.exists( fn ) ) # at destruction of ret3 the corresponding pckl file must be destructed
             cont.Shutdown()
 
 if __name__ == '__main__':