use Config;
BEGIN {
- if (!$Config{useithreads}) {
- print "1..0 # Skip: no ithreads\n";
- exit;
- }
- if (!$Config{d_getppid}) {
- print "1..0 # Skip: no getppid\n";
- exit;
- }
+ skip_all_without_config($_) foreach qw(useithreads d_getppid);
if ($ENV{PERL_CORE_MINITEST}) {
print "1..0 # Skip: no dynamic loading on miniperl, no threads\n";
exit 0;
}
use strict;
-use Config;
BEGIN {
- for my $syscall (qw(pipe fork waitpid getppid)) {
- if (!$Config{"d_$syscall"}) {
- print "1..0 # Skip: no $syscall\n";
- exit;
- }
- }
require './test.pl';
+ skip_all_without_config($_) foreach qw(d_pipe d_fork d_waitpid d_getppid);
plan (8);
}
$| = 1;
require Config;
- if (!$Config::Config{useithreads}) {
- print "1..0 # Skip: no ithreads\n";
- exit 0;
- }
+ skip_all_without_config('useithreads');
skip_all_if_miniperl("no dynamic loading on miniperl, no threads");
plan(6);
require './test.pl';
$| = 1;
- require Config;
- if (!$Config::Config{useithreads}) {
- print "1..0 # Skip: no ithreads\n";
- exit 0;
- }
+ skip_all_without_config('useithreads');
skip_all_if_miniperl("no dynamic loading on miniperl, no threads");
plan(24);
BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
- require Config;
- if (!$Config::Config{'d_fcntl'}) {
- print("1..0 # Skip: fcntl() is not available\n");
- exit(0);
- }
require './test.pl';
+ skip_all_without_config('d_fcntl');
}
use strict;
chdir 't' if -d 't';
@INC = '../lib';
require Config; import Config;
- unless ($Config{'d_fork'}) {
- print "1..0 # Skip: no fork\n";
- exit 0;
- }
- require './test.pl'
+ require './test.pl';
+ skip_all_without_config('d_fork');
}
plan tests => 84;
skip_all('no PerlIO') unless PerlIO::Layer->find('perlio');
}
+sub skip_all_without_config {
+ my ($key, $reason) = @_;
+ unless (eval 'require Config; 1') {
+ warn "test.pl had problems loading Config: $@";
+ return;
+ }
+ return if $Config::Config{$key};
+ unless (defined $reason) {
+ $key =~ s/^use//;
+ $key =~ s/^d_//;
+ $reason = "no $key";
+ }
+ skip_all($reason);
+}
+
sub _ok {
my ($pass, $where, $name, @mess) = @_;
# Do not try to microoptimize by factoring out the "not ".