$te = $test;
chop($te);
if ($^O eq 'VMS') { $te =~ s/^.*\.t\./[.t./; }
+ my $blank = (' ' x 77);
my $leader = "$te" . '.' x (20 - length($te));
my $ml = "";
- $ml = "\r$leader" if -t STDOUT and not $ENV{HARNESS_NOTTY};
+ $ml = "\r$blank\r$leader" if -t STDOUT and not $ENV{HARNESS_NOTTY};
print $leader;
my $fh = new FileHandle;
$fh->open($test) or print "can't open $test. $!\n";
$totmax += $max;
$files++;
$next = 1;
- } elsif (/^1\.\.([0-9]+)/) {
+ } elsif (/^1\.\.([0-9]+)(\s*\#\s*[Ss]kip\S*(?>\s+)(.+))?/) {
$max = $1;
$totmax += $max;
$files++;
$next = 1;
+ $skip_reason = $3 if not $max and defined $3;
} elsif ($max && /^(not\s+)?ok\b/) {
my $this = $next;
if (/^not ok\s*(\d*)/){
$this = $1 if $1 > 0;
- print "${ml}NOK $this \n" if $ml;
+ print "${ml}NOK $this\n" if $ml;
if (!$todo{$this}) {
push @failed, $this;
} else {
}
} elsif (/^ok\s*(\d*)(\s*\#\s*[Ss]kip\S*(?:(?>\s+)(.+))?)?/) {
$this = $1 if $1 > 0;
- print "${ml}ok $this " if $ml;
+ print "${ml}ok $this/$max" if $ml;
$ok++;
$totok++;
$skipped++ if defined $2;
} elsif ($ok == $max && $next == $max+1) {
if ($max and $skipped + $bonus) {
my @msg;
- push(@msg, "$skipped/$max subtest".($skipped>1?'s':'')." skipped: $skip_reason")
+ push(@msg, "$skipped/$max skipped: $skip_reason")
if $skipped;
- push(@msg, "$bonus subtest".($bonus>1?'s':'').
- " unexpectedly succeeded")
+ push(@msg, "$bonus/$max unexpectedly succeeded")
if $bonus;
- print "${ml}ok, ".join(', ', @msg)." \n";
+ print "${ml}ok, ".join(', ', @msg)."\n";
} elsif ($max) {
- print "${ml}ok \n";
+ print "${ml}ok\n";
+ } elsif (defined $skip_reason) {
+ print "skipped: $skip_reason\n";
+ $tests_skipped++;
} else {
- print "skipping test on this platform\n";
+ print "skipped test on this platform\n";
$tests_skipped++;
}
$good++;
counted as a skipped test. If the whole testscript succeeds, the
count of skipped tests is included in the generated output.
+C<Test::Harness> reports the text after C< # Skip(whatever)> as a
+reason for skipping. Similarly, one can include a similar explanation
+in a C<1..0> line emitted if the test is skipped completely:
+
+ 1..0 # Skipped: no leverage found
+
=head1 EXPORT
C<&runtests> is exported by Test::Harness per default.
if ( $^O eq 'MSWin32' or
($Config{'cppstdin'} =~ /\bcppstdin\b/) and
( ! -x $Config{'binexp'} . "/cppstdin") ) {
- print "1..0\n";
+ print "1..0 # Skip: \$Config{cppstdin} unavailable\n";
exit; # Cannot test till after install, alas.
}
unshift @INC, '../lib';
require Config; import Config;
unless ($Config{'d_fork'}) {
- print "1..0\n";
+ print "1..0 # Skip: no fork\n";
exit 0;
}
}
unshift @INC, '../lib' if -d '../lib' ;
require Config; import Config;
if ($Config{'extensions'} !~ /\bDB_File\b/) {
- print "1..0\n";
+ print "1..0 # Skip: DB_File was not built\n";
exit 0;
}
}
unshift @INC, '../lib' if -d '../lib' ;
require Config; import Config;
if ($Config{'extensions'} !~ /\bDB_File\b/) {
- print "1..0\n";
+ print "1..0 # Skip: DB_File was not built\n";
exit 0;
}
}
unshift @INC, '../lib' if -d '../lib' ;
require Config; import Config;
if ($Config{'extensions'} !~ /\bDB_File\b/) {
- print "1..0\n";
+ print "1..0 # Skip: DB_File was not built\n";
exit 0;
}
}
unshift @INC, '../lib';
require Config; import Config;
if ($Config{'extensions'} !~ /\bGDBM_File\b/) {
- print "1..0\n";
+ print "1..0 # Skip: GDBM_File was not built\n";
exit 0;
}
}
BEGIN {
if(-d "lib" && -f "TEST") {
- if (!$Config{'d_fork'} ||
- (($Config{'extensions'} !~ /\bSocket\b/ ||
- $Config{'extensions'} !~ /\bIO\b/) &&
- !(($^O eq 'VMS') && $Config{d_socket}))) {
- print "1..0\n";
+ my $reason;
+ if (! $Config{'d_fork'}) {
+ $reason = 'no fork';
+ }
+ elsif ($Config{'extensions'} !~ /\bSocket\b/) {
+ $reason = 'Socket extension unavailable';
+ }
+ elsif ($Config{'extensions'} !~ /\bIO\b/) {
+ $reason = 'IO extension unavailable';
+ }
+ undef $reason if $^O eq 'VMS' and $Config{d_socket};
+ if ($reason) {
+ print "1..0 # Skip: $reason\n";
exit 0;
}
}
BEGIN {
if(-d "lib" && -f "TEST") {
- if (! $Config{'d_fork'} ||
- ($Config{'extensions'} !~ /\bIO\b/ && $^O ne 'VMS'))
- {
- print "1..0\n";
+ my $reason;
+ if (! $Config{'d_fork'}) {
+ $reason = 'no fork';
+ }
+ elsif ($Config{'extensions'} !~ /\bIO\b/) {
+ $reason = 'IO extension unavailable';
+ }
+ undef $reason if $^O eq 'VMS';
+ if ($reason) {
+ print "1..0 # Skip: $reason\n";
exit 0;
}
}
BEGIN {
if (-d "lib" && -f "TEST") {
- if (!$Config{'d_fork'} ||
- (($Config{'extensions'} !~ /\bSocket\b/ ||
- $Config{'extensions'} !~ /\bIO\b/) &&
- !(($^O eq 'VMS') && $Config{d_socket}))) {
- print "1..0\n";
+ my $reason;
+ if (! $Config{'d_fork'}) {
+ $reason = 'no fork';
+ }
+ elsif ($Config{'extensions'} !~ /\bSocket\b/) {
+ $reason = 'Socket extension unavailable';
+ }
+ elsif ($Config{'extensions'} !~ /\bIO\b/) {
+ $reason = 'IO extension unavailable';
+ }
+ undef $reason if $^O eq 'VMS' and $Config{d_socket};
+ if ($reason) {
+ print "1..0 # Skip: $reason\n";
exit 0;
}
}
BEGIN {
if(-d "lib" && -f "TEST") {
- if ( ($Config{'extensions'} !~ /\bSocket\b/ ||
- $Config{'extensions'} !~ /\bIO\b/ ||
- ($^O eq 'os2') || $^O eq 'apollo') &&
- !(($^O eq 'VMS') && $Config{d_socket})) {
- print "1..0\n";
+ my $reason;
+
+ if ($Config{'extensions'} !~ /\bSocket\b/) {
+ $reason = 'Socket was not built';
+ }
+ elsif ($Config{'extensions'} !~ /\bIO\b/) {
+ $reason = 'IO was not built';
+ }
+ elsif ($^O eq 'os2') {
+ $reason = "blocks on OS/2, not debugged yet";
+ }
+ elsif ($^O eq 'apollo') {
+ $reason = "unknown *FIXME*";
+ }
+ undef $reason if $^O eq 'VMS' and $Config{d_socket};
+ if ($reason) {
+ print "1..0 # Skip: $reason\n";
exit 0;
- }
+ }
}
}
use Config;
BEGIN {
- if (!$Config{d_fork}) {
- print "1..0\n";
- exit 0;
- }
-
if(-d "lib" && -f "TEST") {
- if ( ($Config{'extensions'} !~ /\bSocket\b/ ||
- $Config{'extensions'} !~ /\bIO\b/) &&
- !(($^O eq 'VMS') && $Config{d_socket})) {
- print "1..0\n";
- exit 0;
+ my $reason;
+ if (! $Config{'d_fork'}) {
+ $reason = 'no fork';
+ }
+ elsif ($Config{'extensions'} !~ /\bSocket\b/) {
+ $reason = 'Socket extension unavailable';
+ }
+ elsif ($Config{'extensions'} !~ /\bIO\b/) {
+ $reason = 'IO extension unavailable';
+ }
+ undef $reason if $^O eq 'VMS' and $Config{d_socket};
+ if ($reason) {
+ print "1..0 # Skip: $reason\n";
+ exit 0;
}
}
}
require Config; import Config;
- unless ($Config{'d_msg'} eq 'define' &&
- $Config{'d_sem'} eq 'define') {
- print "1..0\n";
- exit;
+ my $reason;
+
+ if ($Config{'d_sem'} ne 'define') {
+ $reason = '$Config{d_sem} undefined';
+ } elsif ($Config{'d_msg'} ne 'define') {
+ $reason = '$Config{d_msg} undefined';
+ }
+ if ($reason) {
+ print "1..0 # Skip: $reason\n";
+ exit 0;
}
}
unshift @INC, '../lib';
require Config; import Config;
if ($Config{'extensions'} !~ /\bNDBM_File\b/) {
- print "1..0\n";
+ print "1..0 # Skip: NDBM_File was not built\n";
exit 0;
}
}
unshift @INC, '../lib';
require Config; import Config;
if ($Config{'extensions'} !~ /\bODBM_File\b/) {
- print "1..0\n";
+ print "1..0 # Skip: ODBM_File was not built\n";
exit 0;
}
}
unshift @INC, '../lib';
require Config; import Config;
if (! $Config{'usethreads'}) {
- print "1..0\n";
+ print "1..0 # Skip: this perl is not threaded\n";
exit 0;
}
#!./perl
-# $RCSfile: exec.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:49 $
-
$| = 1; # flush stdout
if ($^O eq 'MSWin32') {
- print "# exec is unsupported on Win32\n";
# XXX the system tests could be written to use ./perl and so work on Win32
- print "1..0\n";
+ print "1..0 # Skip: shh, win32\n";
exit(0);
}
unshift @INC, '../lib';
require Config; import Config;
unless ($Config{'d_fork'}) {
- print "1..0\n";
+ print "1..0 # Skip: no fork\n";
exit 0;
}
}
chdir 't' if -d 't';
unshift @INC, "../lib" if -d "../lib";
eval { require Config; import Config; };
-
- unless (defined $Config{'i_grp'} &&
- $Config{'i_grp'} eq 'define' &&
- -f "/etc/group" ) { # Play safe.
- print "1..0\n";
- exit 0;
+ my $reason;
+ if ($Config{'i_grp'} ne 'define') {
+ $reason = '$Config{i_grp} not defined';
+ }
+ elsif (not -f "/etc/group" ) { # Play safe.
+ $reason = 'no /etc/group file';
}
if (not defined $where) { # Try NIS.
open(GR, "$ypcat group 2>/dev/null |") &&
defined(<GR>)) {
$where = "NIS group";
+ undef $reason;
last;
}
}
open(GR, "$nidump group . 2>/dev/null |") &&
defined(<GR>)) {
$where = "NetInfo group";
+ undef $reason;
last;
}
}
if (not defined $where) { # Try local.
my $GR = "/etc/group";
if (-f $GR && open(GR, $GR) && defined(<GR>)) {
+ undef $reason;
$where = $GR;
}
}
-
- if (not defined $where) { # Give up.
- print "1..0\n";
+ if ($reason) {
+ print "1..0 # Skip: $reason\n";
exit 0;
}
}
$ENV{LANGUAGE} = 'C'; # GNU locale extension
sub quit {
- print "1..0\n";
+ print "1..0 # Skip: no `id` or `groups`\n";
exit 0;
}
import Config;
if ($Config{'usethreads'})
{
- print "1..0\n";
+ print "1..0 # Skip: this perl is threaded\n";
exit 0;
}
}
use strict 'vars';
-my $max_chain = $ENV{PERL_TEST_NUMCONVERTS};
-unless (defined $max_chain) {
- my $is_debug;
- eval <<'EOE';
- use Config;
- $is_debug = 1 if $Config{ccflags} =~ /-DDEBUGGING\b/;
-EOE
- $max_chain = $is_debug ? 3 : 2;
-}
+my $max_chain = $ENV{PERL_TEST_NUMCONVERTS} || 2;
# Bulk out if unsigned type is hopelessly wrong:
my $max_uv1 = ~0;
chdir 't' if -d 't';
unshift @INC, "../lib" if -d "../lib";
eval { require Config; import Config; };
-
- unless (defined $Config{'i_pwd'} &&
- $Config{'i_pwd'} eq 'define' &&
- -f "/etc/passwd" ) { # Play safe.
- print "1..0\n";
- exit 0;
+ my $reason;
+ if ($Config{'i_pwd'} ne 'define') {
+ $reason = '$Config{i_pwd} undefined';
+ }
+ elsif (not -f "/etc/passwd" ) { # Play safe.
+ $reason = 'no /etc/passwd file';
}
if (not defined $where) { # Try NIS.
open(PW, "$ypcat passwd 2>/dev/null |") &&
defined(<PW>)) {
$where = "NIS passwd";
+ undef $reason;
last;
}
}
open(PW, "$nidump passwd . 2>/dev/null |") &&
defined(<PW>)) {
$where = "NetInfo passwd";
+ undef $reason;
last;
}
}
my $PW = "/etc/passwd";
if (-f $PW && open(PW, $PW) && defined(<PW>)) {
$where = $PW;
+ undef $reason;
}
}
- if (not defined $where) { # Give up.
- print "1..0\n";
+ if ($reason) { # Give up.
+ print "1..0 # Skip: $reason\n";
exit 0;
}
}