From 43651d81392f71a2868d35b75782d354b0139c90 Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Tue, 2 Mar 2004 22:02:36 +0000 Subject: [PATCH] Work on eliminating systematic failures on make minitest: make minitest passes a -minitest flag to t/TEST t/TEST sees this and sets $ENV{PERL_CORE_MINITEST} Tests can choose to skip based on this. (Other tactic is to make loading of Errno by %! happen at run time.) p4raw-id: //depot/perl@22423 --- Makefile.SH | 2 +- t/TEST | 1 + t/io/binmode.t | 6 ++++-- t/io/crlf.t | 6 +++--- t/io/layers.t | 2 ++ t/io/open.t | 8 ++++++-- t/io/print.t | 5 ++++- t/io/read.t | 3 ++- t/op/magic.t | 38 ++++++++++++++++++++++---------------- 9 files changed, 45 insertions(+), 26 deletions(-) diff --git a/Makefile.SH b/Makefile.SH index bc5a497..811512d 100644 --- a/Makefile.SH +++ b/Makefile.SH @@ -1159,7 +1159,7 @@ minitest: miniperl$(EXE_EXT) lib/re.pm @echo "to build lib/Config.pm or lib/lib.pm." @echo " " - cd t && (rm -f perl$(EXE_EXT); $(LNS) ../miniperl$(EXE_EXT) perl$(EXE_EXT)) \ - && $(LDLIBPTH) ./perl TEST base/*.t comp/*.t cmd/*.t run/*.t io/*.t op/*.t uni/*.t = 0) { $bytecompile = 1 if $1 eq 'bytecompile'; $compile = 1 if $1 eq 'compile'; $taintwarn = 1 if $1 eq 'taintwarn'; + $ENV{PERL_CORE_MINITEST} = 1 if $1 eq 'minitest'; if ($1 =~ /^deparse(,.+)?$/) { $deparse = 1; $deparse_opts = $1; diff --git a/t/io/binmode.t b/t/io/binmode.t index f50d0f7..be198ae 100644 --- a/t/io/binmode.t +++ b/t/io/binmode.t @@ -7,8 +7,9 @@ BEGIN { } use Config; -use Errno; - +BEGIN { + eval {require Errno; Errno->import;}; +} plan(tests => 9); ok( binmode(STDERR), 'STDERR made binary' ); @@ -31,6 +32,7 @@ ok( binmode(STDOUT, ":raw"), ' raw' ); ok( binmode(STDOUT, ":crlf"), ' and crlf' ); SKIP: { + skip "minitest", 1 if $ENV{PERL_CORE_MINITEST}; skip "no EBADF", 1 if (!exists &Errno::EBADF); no warnings 'io'; diff --git a/t/io/crlf.t b/t/io/crlf.t index 2ee7b83..d6f3fc3 100644 --- a/t/io/crlf.t +++ b/t/io/crlf.t @@ -32,9 +32,9 @@ if (find PerlIO::Layer 'perlio') { SKIP: { - eval 'use PerlIO::scalar'; - skip(q/miniperl cannnot load PerlIO::scalar/) - if $@ =~ /dynamic loading not available/; + skip("miniperl can't rely on loading PerlIO::scalar") + if $ENV{PERL_CORE_MINITEST}; + eval 'PerlIO::scalar'; my $fcontents = join "", map {"$_\015\012"} "a".."zzz"; open my $fh, "<:crlf", \$fcontents; local $/ = "xxx"; diff --git a/t/io/layers.t b/t/io/layers.t index 904ef93..d0e37a3 100644 --- a/t/io/layers.t +++ b/t/io/layers.t @@ -44,8 +44,10 @@ print <<__EOH__; __EOH__ SKIP: { + # FIXME - more of these could be tested without Encode or full perl skip("This perl does not have Encode", $NTEST) unless " $Config{extensions} " =~ / Encode /; + skip("miniperl does not have Encode", $NTEST) if $ENV{PERL_CORE_MINITEST}; sub check { my ($result, $expected, $id) = @_; diff --git a/t/io/open.t b/t/io/open.t index e71d2ec..82ac2f3 100755 --- a/t/io/open.t +++ b/t/io/open.t @@ -239,10 +239,14 @@ like( $@, qr/Bad filehandle:\s+afile/, ' right error' ); SKIP: { skip "This perl uses perlio", 1 if $Config{useperlio}; - skip "This system doesn't understand EINVAL", 1 unless exists $!{EINVAL}; + skip "miniperl cannot be relied on to load %Errno" + if $ENV{PERL_CORE_MINITEST}; + # Force the reference to %! to be run time by writing ! as {"!"} + skip "This system doesn't understand EINVAL", 1 + unless exists ${"!"}{EINVAL}; no warnings 'io'; - ok( !open(F,'>',\my $s) && $!{EINVAL}, 'open(reference) raises EINVAL' ); + ok(!open(F,'>',\my $s) && ${"!"}{EINVAL}, 'open(reference) raises EINVAL'); } { diff --git a/t/io/print.t b/t/io/print.t index f33aa66..31d559a 100755 --- a/t/io/print.t +++ b/t/io/print.t @@ -6,7 +6,8 @@ BEGIN { } use strict 'vars'; -use Errno; +eval 'use Errno'; +die $@ if $@ and !$ENV{PERL_CORE_MINITEST}; print "1..19\n"; @@ -41,6 +42,8 @@ print @x,"14\nok",@y; print ""; } +$\ = ''; + if (!exists &Errno::EBADF) { print "ok 19 # skipped: no EBADF\n"; } else { diff --git a/t/io/read.t b/t/io/read.t index ea2672d..63ffee1 100755 --- a/t/io/read.t +++ b/t/io/read.t @@ -9,7 +9,8 @@ BEGIN { } use strict; -use Errno; +eval 'use Errno'; +die $@ if $@ and !$ENV{PERL_CORE_MINITEST}; plan tests => 2; diff --git a/t/op/magic.t b/t/op/magic.t index 7a93281..04cf718 100755 --- a/t/op/magic.t +++ b/t/op/magic.t @@ -38,14 +38,15 @@ sub skip { print "1..53\n"; -$Is_MSWin32 = $^O eq 'MSWin32'; -$Is_NetWare = $^O eq 'NetWare'; -$Is_VMS = $^O eq 'VMS'; -$Is_Dos = $^O eq 'dos'; -$Is_os2 = $^O eq 'os2'; -$Is_Cygwin = $^O eq 'cygwin'; -$Is_MacOS = $^O eq 'MacOS'; -$Is_MPE = $^O eq 'mpeix'; +$Is_MSWin32 = $^O eq 'MSWin32'; +$Is_NetWare = $^O eq 'NetWare'; +$Is_VMS = $^O eq 'VMS'; +$Is_Dos = $^O eq 'dos'; +$Is_os2 = $^O eq 'os2'; +$Is_Cygwin = $^O eq 'cygwin'; +$Is_MacOS = $^O eq 'MacOS'; +$Is_MPE = $^O eq 'mpeix'; +$Is_miniperl = $ENV{PERL_CORE_MINITEST}; $PERL = ($Is_NetWare ? 'perl' : ($Is_MacOS || $Is_VMS) ? $^X : @@ -347,7 +348,9 @@ else { skip('no caseless %ENV support') for 1..4; } -{ +if ($Is_miniperl) { + skip ("miniperl can't rely on loading %Errno"); +} else { no warnings 'void'; # Make sure Errno hasn't been prematurely autoloaded @@ -362,15 +365,18 @@ else { }, $@; } +if ($Is_miniperl) { + skip ("miniperl can't rely on loading %Errno"); +} else { + # Make sure that Errno loading doesn't clobber $! -# Make sure that Errno loading doesn't clobber $! - -undef %Errno::; -delete $INC{"Errno.pm"}; + undef %Errno::; + delete $INC{"Errno.pm"}; -open(FOO, "nonesuch"); # Generate ENOENT -my %errs = %{"!"}; # Cause Errno.pm to be loaded at run-time -ok ${"!"}{ENOENT}; + open(FOO, "nonesuch"); # Generate ENOENT + my %errs = %{"!"}; # Cause Errno.pm to be loaded at run-time + ok ${"!"}{ENOENT}; +} ok $^S == 0 && defined $^S; eval { ok $^S == 1 }; -- 2.7.4