Skip to content

Commit

Permalink
skip_all if WinXP as test hangs there
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed Dec 24, 2014
1 parent b227148 commit 256e470
Showing 1 changed file with 15 additions and 22 deletions.
37 changes: 15 additions & 22 deletions test/26fork.t
Expand Up @@ -5,33 +5,26 @@ use Test::More;
use Config;
use Inline Config => DIRECTORY => $TestInlineSetup::DIR;

if($^O =~ /MSWin32/i && $Config{useithreads} ne 'define') {
plan skip_all => 'fork() not implemented';
exit 0;
if($^O =~ /MSWin32/i) {
plan skip_all => 'fork() not implemented' if $Config{useithreads} ne 'define';
plan skip_all => 'Hangs on WinXP'
if eval { require Win32; Win32::GetOSName() =~ /^WinXP/ };
}

my $pid = fork;
eval { Inline->bind(C => 'int add(int x, int y) { return x + y; }'); };
exit 0 unless $pid;
my $pid = fork;
eval { Inline->bind(C => 'int add(int x, int y) { return x + y; }'); };
exit 0 unless $pid;

wait;
is($?, 0, 'child exited status 0');
wait;
is($?, 0, 'child exited status 0');

if($^O =~ /MSWin32/i){
TODO: {
local $TODO = "Generally fails on MS Windows";
is($@, '', 'bind was successful');
my $x = eval { add(7,3) };
is ($@, '', 'bound func no die()');
is($x, 10, 'bound func gave right result');
}
}

else {
is($@, '', 'bind was successful');
TODO: {
local $TODO;
$TODO = "Generally fails on MS Windows" if $^O =~ /MSWin32/i;
is $@, '', 'bind was successful';
my $x = eval { add(7,3) };
is ($@, '', 'bound func no die()');
is($x, 10, 'bound func gave right result');
is $@, '', 'bound func no die()';
is $x, 10, 'bound func gave right result';
}

done_testing;

0 comments on commit 256e470

Please sign in to comment.