Skip to content

Commit

Permalink
Merge branch 'smoke-me/signal-tests'
Browse files Browse the repository at this point in the history
  • Loading branch information
Reini Urban committed Dec 5, 2014
2 parents 1f0aa35 + 9f260c6 commit dc51163
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
2 changes: 2 additions & 0 deletions ChangeLog
Expand Up @@ -32,6 +32,8 @@
+ Fix most --floatval='long double' tests, just embed API broken #1111
+ Adjust tests for VALGRIND=valgrind #1150
+ Added tests to t/pmc/resizablepmcarray.t to cover all offset cases. #1152
+ Re-enabled instable signals tests as TODO. signals do work fine,
just the tests not.
- Community

2014-11-18 release 6.10.0
Expand Down
37 changes: 19 additions & 18 deletions t/pmc/signal.t
@@ -1,5 +1,5 @@
#! perl
# Copyright (C) 2001-2008, Parrot Foundation.
# Copyright (C) 2001-2014, Parrot Foundation.

use strict;
use warnings;
Expand All @@ -17,13 +17,14 @@ t/pmc/signal.t - Signal Handling
=head1 DESCRIPTION
Tests signal handling.
Tests signal handling. These tests are very instable, but do work manually.
=cut

# actually more platforms should work - all POSIX compliant ones
# a second problem is to get the test doing the right thing: mainly figuring
# out what PID to kill. The "ps" command isn't one of the portable ones.
# out what PID to kill. The "kill" and "ps" commands aren't one of the portable ones.


my %platforms = map { $_ => 1 } qw/
darwin
Expand All @@ -33,12 +34,12 @@ my %platforms = map { $_ => 1 } qw/
/;

if ( $platforms{$^O} ) {

#plan tests => 3;
plan skip_all => 'Signals currently disabled';
plan tests => 6;
$ENV{DYLD_LIBRARY_PATH} = "" if $^O eq 'darwin';
#plan skip_all => 'Instable signal tests currently disabled';
}
else {
plan skip_all => 'No events yet';
plan skip_all => 'Missing portable getpid and kill';
}

#
Expand All @@ -48,7 +49,8 @@ else {
my $pid;

sub parrot_pids {
grep { !/harness/ && !/sh -c/ } `ps axw | grep '[p]arrot'`;
grep { !/harness/ && !/ Z / && !/sh -c/ && !/ \(/}
`ps | grep '[p]arrot'`;
}
sub send_SIGHUP {
Expand All @@ -64,7 +66,6 @@ sub send_SIGHUP {
my $io_thread = pop @ps;
if ( $io_thread =~ /^\s*(\d+)/ ) {
$pid = $1;

# send a
kill 'SIGHUP', $pid;
}
Expand All @@ -79,7 +80,7 @@ sub check_running {
select undef, undef, undef, 0.1;
my @ps = parrot_pids;
my $thread = pop @ps;
if ( $thread =~ /^\s*(\d+)/ && $1 == $pid ) {
if ( $thread and $thread =~ /^\s*(\d+)/ and $1 == $pid ) {
ok( 0, "parrot $pid still running" );
}
else {
Expand All @@ -89,7 +90,7 @@ sub check_running {

send_SIGHUP;

pasm_output_is( <<'CODE', <<'OUTPUT', "SIGHUP event - sleep" );
pasm_output_is( <<'CODE', <<'OUTPUT', "SIGHUP event - sleep", todo => 'instable signal tests');
print "start\n"
# no exception handler - parrot should die silently
sleep 2
Expand All @@ -99,12 +100,12 @@ CODE
start
OUTPUT

# check_running;
check_running;

send_SIGHUP;

pasm_output_is( <<'CODE', <<'OUTPUT', "SIGHUP event - loop" );
bounds 1 # no JIT
pasm_output_is( <<'CODE', <<'OUTPUT', "SIGHUP event - loop", todo => 'instable signal tests');
# bounds 1 # no JIT
print "start\n"
# no exception handler - parrot should die silently
Expand All @@ -117,13 +118,13 @@ CODE
start
OUTPUT

# check_running;
check_running;

SKIP: {
skip( "works standalone but not in test", 1 );
skip( "works standalone but not in test", 1 ) if 0;
send_SIGHUP;

pasm_output_is( <<'CODE', <<'OUTPUT', "SIGHUP event - sleep, catch" );
pasm_output_is( <<'CODE', <<'OUTPUT', "SIGHUP event - sleep, catch", todo => 'instable signal tests' );
push_eh _handler
print "start\n"
sleep 2
Expand All @@ -149,7 +150,7 @@ start
catched SIGHUP
OUTPUT

# check_running;
check_running;
}

# Local Variables:
Expand Down

0 comments on commit dc51163

Please sign in to comment.