Skip to content

Commit

Permalink
Fixes for XSConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
rurban committed Apr 19, 2017
1 parent 7892e70 commit 14f8f52
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 5 deletions.
16 changes: 15 additions & 1 deletion t/lib/NoFork.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,21 @@ BEGIN {
*CORE::GLOBAL::fork = sub { die "you should not fork" };
}
use Config;
tied(%Config)->{d_fork} = 0; # blatant lie
if ($Config::Config{d_fork}) {
if (exists &Config::KEYS) { # compiled Config
*Config_FETCHorig = \&Config::FETCH;
no warnings 'redefine';
*Config::FETCH = sub {
if ($_[0] and $_[1] eq 'd_fork') {
return 0;
} else {
return Config_FETCHorig(@_);
}
}
} else {
tied(%Config)->{d_fork} = 0; # uncompiled Config
}
}

=begin TEST
Expand Down
4 changes: 4 additions & 0 deletions t/multiplexer.t
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@

use strict;
use warnings;
BEGIN {
chdir 'cpan/Test-Harness' unless -e 't/sample-tests/simple';
}
use lib 't/lib';

use Config ();
use Test::More qw( no_plan );

use File::Spec;
Expand Down
4 changes: 3 additions & 1 deletion t/nofork.t
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# NOTE maybe a good candidate for xt/author or something.

BEGIN {
chdir 'cpan/Test-Harness' unless -e 't/lib/NoFork.pm';
use lib 't/lib';
}

Expand All @@ -15,7 +16,8 @@ use Test::More (
$Config{d_fork}
? 'no_plan'
: ( 'skip_all' => 'your system already has no fork' )
);
);

use IO::c55Capture; # for util

use TAP::Harness;
Expand Down
5 changes: 4 additions & 1 deletion t/regression.t
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ BEGIN {
use strict;
use warnings;

use Config;
if ($Config::Config{usecperl}) {
use Test::More 'skip_all' => 'cperl bug CM-834';
}
use Test::More 'no_plan';

use File::Spec;
use Config;

use constant TRUE => "__TRUE__";
use constant FALSE => "__FALSE__";
Expand Down
2 changes: 1 addition & 1 deletion t/sample-tests/switches
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
print "1..1\n";
print $INC{'strict.pm'} ? "ok 1\n" : "not ok 1\n";
print $INC{'vars.pm'} ? "ok 1\n" : "not ok 1\n";
3 changes: 2 additions & 1 deletion t/source_handler.t
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,8 @@ sub test_handler {

SKIP:
{
%int::; # init the coretype if missing
no warnings 'void';
%int:: unless %int::; # init the coretype if missing
my int $planned = 1;
$planned += 1 + scalar @{ $test->{output} } if $test->{output};
skip "$test->{skip_reason}", $planned if $test->{skip};
Expand Down

0 comments on commit 14f8f52

Please sign in to comment.