Bug 751505 - Better memory cleanup during the test. r=jorendorff,yoric
authorDavid Rajchenbach-Teller <dteller@mozilla.com>
Thu, 03 May 2012 17:14:33 +0200
changeset 93051 720b32b1ef1e6c4d1359b16a057650011b9c50e0
parent 93050 d6c77d2796c0d1e73efd5ae5afaecfc226aaa3ba
child 93052 4742910656ad80b9eb3303e7d99b4dac4791f1da
push id8950
push userryanvm@gmail.com
push dateThu, 03 May 2012 22:33:56 +0000
treeherdermozilla-inbound@4742910656ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff, yoric
bugs751505
milestone15.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 751505 - Better memory cleanup during the test. r=jorendorff,yoric
toolkit/components/ctypes/tests/unit/test_finalizer_shouldaccept.js
toolkit/components/ctypes/tests/unit/xpcshell.ini
--- a/toolkit/components/ctypes/tests/unit/test_finalizer_shouldaccept.js
+++ b/toolkit/components/ctypes/tests/unit/test_finalizer_shouldaccept.js
@@ -81,42 +81,44 @@ function test_to_source()
 
 /**
  * Test conversion to int32
  */
 function test_to_int()
 {
   let value = 2;
   let wrapped, converted, finalizable;
-  wrapped   = ctypes.int32_t(value);
-  finalizable= ctypes.CDataFinalizer(acquire(value), dispose);
+  wrapped = ctypes.int32_t(value);
+  finalizable = ctypes.CDataFinalizer(acquire(value), dispose);
   converted = ctypes.int32_t(finalizable);
 
   structural_check_eq(converted, wrapped);
   structural_check_eq(converted, ctypes.int32_t(finalizable.forget()));
 
-  wrapped   = ctypes.int64_t(value);
-  converted = ctypes.int64_t(ctypes.CDataFinalizer(acquire(value),
-                                                   dispose));
+  finalizable = ctypes.CDataFinalizer(acquire(value), dispose);
+  wrapped = ctypes.int64_t(value);
+  converted = ctypes.int64_t(finalizable);
   structural_check_eq(converted, wrapped);
+  finalizable.dispose();
 }
 
 /**
  * Test that dispose can change errno but finalization cannot
  */
-function test_errno(size)
+function test_errno(size, tc, cleanup)
 {
   reset_errno();
   do_check_eq(ctypes.errno, 0);
 
   let finalizable = ctypes.CDataFinalizer(acquire(3), dispose_errno);
   finalizable.dispose();
   do_check_eq(ctypes.errno, 10);
   reset_errno();
 
   do_check_eq(ctypes.errno, 0);
   for (let i = 0; i < size; ++i) {
     finalizable = ctypes.CDataFinalizer(acquire(i), dispose_errno);
+    cleanup.add(finalizable);
   }
 
   trigger_gc();
   do_check_eq(ctypes.errno, 0);
-}
\ No newline at end of file
+}
--- a/toolkit/components/ctypes/tests/unit/xpcshell.ini
+++ b/toolkit/components/ctypes/tests/unit/xpcshell.ini
@@ -2,14 +2,11 @@
 head = head.js
 tail = 
 
 [test_errno.js]
 
 [test_finalizer.js]
 [test_finalizer_shouldfail.js]
 [test_finalizer_shouldaccept.js]
-# Bug 751505: test fails consistently on a few platforms post CPG landing
-skip-if = true
-
 [test_jsctypes.js]
 # Bug 676989: test fails consistently on Android
 fail-if = os == "android"