gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] libvob/test/vob/util maps.test


From: Tuomas J. Lukka
Subject: [Gzz-commits] libvob/test/vob/util maps.test
Date: Sun, 22 Jun 2003 08:04:38 -0400

CVSROOT:        /cvsroot/libvob
Module name:    libvob
Branch:         
Changes by:     Tuomas J. Lukka <address@hidden>        03/06/22 08:04:38

Modified files:
        test/vob/util  : maps.test 

Log message:
        Pass some tests

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/test/vob/util/maps.test.diff?tr1=1.1&tr2=1.2&r1=text&r2=text

Patches:
Index: libvob/test/vob/util/maps.test
diff -u libvob/test/vob/util/maps.test:1.1 libvob/test/vob/util/maps.test:1.2
--- libvob/test/vob/util/maps.test:1.1  Sun Jun 22 07:55:11 2003
+++ libvob/test/vob/util/maps.test      Sun Jun 22 08:04:38 2003
@@ -28,13 +28,16 @@
     def __del__(self):
        print "FINALIZING: ",self.n
 
+def createCS(start):
+    return [ C(i) for i in range(start, start + 1000) ]
+
 def testWeakValueMap():
 
     m = vob.util.WeakValueMap()
 
-    cs = [C(i) for i in range(0,10)]
+    cs = createCS(0)
 
-    for i in range(0,10): 
+    for i in range(0,1000): 
        m.put(" %d"%i, cs[i])
 
     # assert they are still there
@@ -43,14 +46,22 @@
        assert m.get(" %d"%i) == cs[i]
 
     # Now, free them and collect garbage
-    cs = []
+    # The test MAY fail randomly when this is not effective any more...
+    cs = createCS(100000)
+    java.lang.Thread.sleep(500)
     java.lang.System.gc()
+    java.lang.Thread.sleep(500)
+    cs2 = createCS(100000)
+    java.lang.Thread.sleep(500)
     java.lang.System.gc()
+    java.lang.Thread.sleep(500)
+    cs3 = createCS(100000)
+    java.lang.Thread.sleep(500)
 
     # assert they've been zeroed
 
     for i in range(0,10): 
-       assert m.get(" %d"%i) == None
+       assert m.get(" %d"%i) == None, (i, m.get(" %d"%i))
 
     # assert overwriting works now
     m.put(" 0", "FOO")




reply via email to

[Prev in Thread] Current Thread [Next in Thread]