[svn:parrot] r44160 - in trunk: . t/op

dukeleto at svn.parrot.org dukeleto at svn.parrot.org
Fri Feb 19 04:12:31 UTC 2010


Author: dukeleto
Date: Fri Feb 19 04:12:17 2010
New Revision: 44160
URL: https://trac.parrot.org/parrot/changeset/44160

Log:
[t] Add some tests to make sure a GC mark and sweep happens when a large amount of PMC's are created

Added:
   trunk/t/op/gc-leaky.t
Modified:
   trunk/MANIFEST
   trunk/t/op/string_mem.t

Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST	Fri Feb 19 03:57:19 2010	(r44159)
+++ trunk/MANIFEST	Fri Feb 19 04:12:17 2010	(r44160)
@@ -1,7 +1,7 @@
 # ex: set ro:
 # $Id$
 #
-# generated by tools/dev/mk_manifest_and_skip.pl Fri Feb 19 01:11:00 2010 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Fri Feb 19 04:10:16 2010 UT
 #
 # See below for documentation on the format of this file.
 #
@@ -1814,6 +1814,7 @@
 t/op/exceptions.t                                           [test]
 t/op/exit.t                                                 [test]
 t/op/fetch.t                                                [test]
+t/op/gc-leaky.t                                             [test]
 t/op/gc.t                                                   [test]
 t/op/globals.t                                              [test]
 t/op/ifunless.t                                             [test]

Added: trunk/t/op/gc-leaky.t
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/t/op/gc-leaky.t	Fri Feb 19 04:12:17 2010	(r44160)
@@ -0,0 +1,73 @@
+#!./parrot
+# Copyright (C) 2010, Parrot Foundation.
+# $Id: string_mem.t 43904 2010-02-11 13:49:42Z whiteknight $
+
+=head1 NAME
+
+t/op/gc-leaky.t - test for memory leaks in the Garbage Collector
+
+=head1 SYNOPSIS
+
+    % prove t/op/gc-leaky.t
+
+=head1 DESCRIPTION
+
+Tests that we actually do a GC mark and sweep after a large number of PMC's have
+been created. Test suggested by chromatic++ . More tests are needed to close
+TT1465 - http://trac.parrot.org/parrot/ticket/1465 .
+
+=cut
+
+# 20:57 <chromatic> For every million PMCs allocated, see that the GC has performed a mark/sweep.
+
+.include 'interpinfo.pasm'
+
+.sub _main :main
+    .include 'test_more.pir'
+
+    plan(2)
+
+    $S0 = interpinfo .INTERPINFO_GC_SYS_NAME
+    if $S0 == "inf" goto dont_run_hanging_tests
+
+    test_gc_mark_sweep()
+
+    goto test_end
+  dont_run_hanging_tests:
+    ok(1, "#TODO - Test disabled on gc_inf")
+    ok(1, "#TODO - Test disabled on gc_inf")
+  test_end:
+.end
+
+.sub test_gc_mark_sweep
+    .local int counter
+    counter = 0
+    loop:
+        $P0 = box 0
+        inc counter
+        if counter > 1e6 goto done
+        goto loop
+    done:
+        say ""
+        $I1 = interpinfo.INTERPINFO_GC_COLLECT_RUNS
+        $I2 = interpinfo.INTERPINFO_GC_MARK_RUNS
+
+        $I3 = isge $I1, 1
+        $I4 = isge $I2, 1
+
+        $S1 = $I1
+        $S0 = "performed " . $S1
+        $S0 .= " (which should be >=1) GC collect runs"
+        ok($I2,$S0)
+
+        $S1 = $I2
+        $S0 = "performed " . $S1
+        $S0 .= " (which should be >=1) GC mark runs"
+        ok($I2,$S0)
+.end
+
+# Local Variables:
+#   mode: pir
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:

Modified: trunk/t/op/string_mem.t
==============================================================================
--- trunk/t/op/string_mem.t	Fri Feb 19 03:57:19 2010	(r44159)
+++ trunk/t/op/string_mem.t	Fri Feb 19 04:12:17 2010	(r44160)
@@ -37,7 +37,6 @@
 .sub _main :main
     .include 'test_more.pir'
 
-    .local pmc _
     plan(TESTS)
 
     test_stringinfo()
@@ -52,7 +51,6 @@
 .end
 
 .sub test_stringinfo
-    .local pmc _
 
     $S1 = "Hello, world"
     $S0 = $S1


More information about the parrot-commits mailing list