Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add t/stress/threads.t for GH #880 and GH #875

  • Loading branch information...
commit c3f235265792e0f85fd58d42254f289344f58b30 1 parent 1a27f28
Reini Urban rurban authored
Showing with 91 additions and 0 deletions.
  1. +1 −0  MANIFEST
  2. +90 −0 t/stress/threads.t
1  MANIFEST
View
@@ -2091,6 +2091,7 @@ t/steps/inter/types-01.t [test]
t/steps/inter/yacc-01.t [test]
t/steps/inter/yacc-02.t [test]
t/stress/gc.t [test]
+t/stress/threads.t [test]
t/tools/create_language.t [test]
t/tools/dev/headerizer/01_functions.t [test]
t/tools/dev/headerizer/02_methods.t [test]
90 t/stress/threads.t
View
@@ -0,0 +1,90 @@
+#! perl
+# Copyright (C) 2012, Parrot Foundation.
+
+=head1 NAME
+
+t/stress/threads.t - Threads with Garbage Collection
+
+=head1 SYNOPSIS
+
+ % prove -v t/stress/threads.t
+
+=head1 DESCRIPTION
+
+Tests threads stability under garbage collection.
+
+Also IO stress: Large -t trace pir output segfaults in GC
+
+=cut
+
+use strict;
+use warnings;
+use lib qw(lib . ../lib ../../lib);
+use Test::More;
+use Parrot::Test tests => 2;
+use Parrot::Config;
+
+# Task stress with GC
+{
+ $ENV{TEST_PROG_ARGS} ||= '';
+ my $parrot = File::Spec->join( File::Spec->curdir(), 'parrot' . $PConfig{exe} );
+ my $src = 'examples/threads/chameneos.pir';
+ my $pbc = 'examples/threads/chameneos.pbc';
+ system($parrot, '-o', $pbc, $src);
+ pbc_exit_code_is( $pbc, 0, 'chameneos', todo => 'GH880 GC walks into thread interp' );
+ unlink $pbc;
+}
+
+
+# IO stress: trace pir output segfaults
+{
+ local $ENV{TEST_PROG_ARGS} .= '-t1';
+
+ pir_exit_code_is( << 'CODE', 0, "IO Stress with -t", todo => 'GH875 threads and -t1: gc_gms_mark_pmc_header: self->work_list might be empty' );
+.sub test :main
+ load_bytecode "dumper.pbc"
+ load_bytecode 'Test/More.pbc'
+ load_bytecode 'MIME/Base64.pbc'
+ load_bytecode 'PGE.pbc'
+ load_bytecode 'PGE/Util.pbc'
+ load_language 'data_json'
+
+ .local pmc json
+ json = compreg 'data_json'
+
+ .local pmc encode_decode_tests, decode_tests
+ encode_decode_tests = json.'compile'( <<'END_JSON' )
+[ ["Hello, World!\n","SGVsbG8sIFdvcmxkIQo="],
+ ["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
+ "YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh\nYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYQ=="]
+]
+END_JSON
+
+ .local pmc enc_sub
+ enc_sub = get_global [ "MIME"; "Base64" ], 'encode_base64'
+ .local pmc is
+ is = get_hll_global [ 'Test'; 'More' ], 'is'
+ .local pmc test_iterator, test_case
+ encode_decode_tests = encode_decode_tests()
+ test_iterator = iter encode_decode_tests
+
+ .local string plain, base64, result
+ test_case = shift test_iterator
+ plain = shift test_case
+ base64 = shift test_case
+ result = enc_sub( plain )
+ is( result, base64 )
+
+.end
+CODE
+
+}
+
+1;
+
+# Local Variables:
+# mode: cperl
+# cperl-indent-level: 4
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
Please sign in to comment.
Something went wrong with that request. Please try again.