Change 32685 by [EMAIL PROTECTED] on 2007/12/21 08:58:42
Subject: [PATCH] Fix remaining skips for Test::Harness
From: Andy Armstrong <[EMAIL PROTECTED]>
Message-Id: <[EMAIL PROTECTED]>
Date: Thu, 20 Dec 2007 23:16:01 +0000
(except for test-harness-compat.t which failed unthreaded under harness
and except for reverting the defined $ENV{PERL_UNICODE})
Affected files ...
... //depot/perl/lib/Test/Harness/t/harness.t#4 edit
... //depot/perl/lib/Test/Harness/t/nofork.t#2 edit
... //depot/perl/lib/Test/Harness/t/prove.t#2 edit
... //depot/perl/lib/Test/Harness/t/proverc.t#2 edit
... //depot/perl/lib/Test/Harness/t/proverun.t#2 edit
... //depot/perl/lib/Test/Harness/t/source.t#2 edit
... //depot/perl/lib/Test/Harness/t/spool.t#2 edit
... //depot/perl/lib/Test/Harness/t/taint.t#2 edit
... //depot/perl/lib/Test/Harness/t/unicode.t#4 edit
... //depot/perl/t/lib/source_tests/source#2 edit
Differences ...
==== //depot/perl/lib/Test/Harness/t/harness.t#4 (text) ====
Index: perl/lib/Test/Harness/t/harness.t
--- perl/lib/Test/Harness/t/harness.t#3~32673~ 2007-12-20 10:25:46.000000000
-0800
+++ perl/lib/Test/Harness/t/harness.t 2007-12-21 00:58:42.000000000 -0800
@@ -1,20 +1,12 @@
#!/usr/bin/perl -w
BEGIN {
- if( $ENV{PERL_CORE} ) {
+ if ( $ENV{PERL_CORE} ) {
chdir 't';
- @INC = ('../lib', 'lib');
+ @INC = ( '../lib', 'lib' );
}
else {
- use lib 't/lib';
- }
-}
-
-BEGIN {
- if ($ENV{PERL_CORE}) {
- # FIXME
- print "1..0 # Skip pending resolution of a clean way to record the
change in location of the sample tests\n";
- exit 0;
+ unshift @INC, 't/lib';
}
}
@@ -27,6 +19,9 @@
my $HARNESS = 'TAP::Harness';
+my $source_tests = $ENV{PERL_CORE} ? 'lib/source_tests' : 't/source_tests';
+my $sample_tests = $ENV{PERL_CORE} ? 'lib/sample-tests' : 't/sample-tests';
+
plan tests => 106;
# note that this test will always pass when run through 'prove'
@@ -108,7 +103,7 @@
# normal tests in verbose mode
- ok my $aggregate = _runtests( $harness, 't/source_tests/harness' ),
+ ok my $aggregate = _runtests( $harness, "$source_tests/harness" ),
'... runtests returns the aggregate';
isa_ok $aggregate, 'TAP::Parser::Aggregator';
@@ -116,7 +111,7 @@
chomp(@output);
my @expected = (
- 't/source_tests/harness....',
+ "$source_tests/harness....",
'1..1',
'[[reset]]',
'ok 1 - this is a test',
@@ -139,7 +134,7 @@
@output = ();
ok $aggregate
- = _runtests( $harness, [ 't/source_tests/harness', 'My Nice Test' ] ),
+ = _runtests( $harness, [ "$source_tests/harness", 'My Nice Test' ] ),
'... runtests returns the aggregate';
isa_ok $aggregate, 'TAP::Parser::Aggregator';
@@ -169,9 +164,10 @@
# run same test twice
@output = ();
- ok $aggregate
- = _runtests( $harness, [ 't/source_tests/harness', 'My Nice Test' ],
- [ 't/source_tests/harness', 'My Nice Test Again' ] ),
+ ok $aggregate = _runtests(
+ $harness, [ "$source_tests/harness", 'My Nice Test' ],
+ [ "$source_tests/harness", 'My Nice Test Again' ]
+ ),
'... runtests returns the aggregate';
isa_ok $aggregate, 'TAP::Parser::Aggregator';
@@ -207,11 +203,11 @@
# normal tests in quiet mode
@output = ();
- _runtests( $harness_whisper, 't/source_tests/harness' );
+ _runtests( $harness_whisper, "$source_tests/harness" );
chomp(@output);
@expected = (
- 't/source_tests/harness....',
+ "$source_tests/harness....",
'ok',
'All tests successful.',
);
@@ -230,7 +226,7 @@
# normal tests in really_quiet mode
@output = ();
- _runtests( $harness_mute, 't/source_tests/harness' );
+ _runtests( $harness_mute, "$source_tests/harness" );
chomp(@output);
@expected = (
@@ -251,7 +247,7 @@
# normal tests with failures
@output = ();
- _runtests( $harness, 't/source_tests/harness_failure' );
+ _runtests( $harness, "$source_tests/harness_failure" );
$status = pop @output;
$summary = pop @output;
@@ -263,7 +259,7 @@
@output = @output[ 0 .. 9 ];
@expected = (
- 't/source_tests/harness_failure....',
+ "$source_tests/harness_failure....",
'1..2',
'[[reset]]',
'ok 1 - this is a test',
@@ -283,7 +279,7 @@
'Test Summary Report',
'-------------------',
'[[red]]',
- 't/source_tests/harness_failure (Wstat: 0 Tests: 2 Failed: 1)',
+ "$source_tests/harness_failure (Wstat: 0 Tests: 2 Failed: 1)",
'[[reset]]',
'[[red]]',
'Failed test:',
@@ -299,16 +295,16 @@
# quiet tests with failures
@output = ();
- _runtests( $harness_whisper, 't/source_tests/harness_failure' );
+ _runtests( $harness_whisper, "$source_tests/harness_failure" );
$status = pop @output;
$summary = pop @output;
@expected = (
- 't/source_tests/harness_failure....',
+ "$source_tests/harness_failure....",
'Failed 1/2 subtests',
'Test Summary Report',
'-------------------',
- 't/source_tests/harness_failure (Wstat: 0 Tests: 2 Failed: 1)',
+ "$source_tests/harness_failure (Wstat: 0 Tests: 2 Failed: 1)",
'Failed test:',
'2',
);
@@ -322,14 +318,14 @@
# really quiet tests with failures
@output = ();
- _runtests( $harness_mute, 't/source_tests/harness_failure' );
+ _runtests( $harness_mute, "$source_tests/harness_failure" );
$status = pop @output;
$summary = pop @output;
@expected = (
'Test Summary Report',
'-------------------',
- 't/source_tests/harness_failure (Wstat: 0 Tests: 2 Failed: 1)',
+ "$source_tests/harness_failure (Wstat: 0 Tests: 2 Failed: 1)",
'Failed test:',
'2',
);
@@ -345,13 +341,13 @@
@output = ();
_runtests(
$harness_directives,
- 't/source_tests/harness_directives'
+ "$source_tests/harness_directives"
);
chomp(@output);
@expected = (
- 't/source_tests/harness_directives....',
+ "$source_tests/harness_directives....",
'not ok 2 - we have a something # TODO some output',
"ok 3 houston, we don't have liftoff # SKIP no funding",
'ok',
@@ -360,7 +356,7 @@
# ~TODO {{{ this should be an option
#'Test Summary Report',
#'-------------------',
- #'t/source_tests/harness_directives (Wstat: 0 Tests: 3 Failed: 0)',
+ #"$source_tests/harness_directives (Wstat: 0 Tests: 3 Failed: 0)",
#'Tests skipped:',
#'3',
# }}}
@@ -401,7 +397,7 @@
);
@output = ();
- _runtests( $harness, 't/source_tests/harness_badtap' );
+ _runtests( $harness, "$source_tests/harness_badtap" );
chomp(@output);
@output = map { trim($_) } @output;
@@ -409,7 +405,7 @@
@summary = @output[ 12 .. ( $#output - 1 ) ];
@output = @output[ 0 .. 11 ];
@expected = (
- 't/source_tests/harness_badtap....',
+ "$source_tests/harness_badtap....",
'1..2',
'[[reset]]',
'ok 1 - this is a test',
@@ -431,7 +427,7 @@
'Test Summary Report',
'-------------------',
'[[red]]',
- 't/source_tests/harness_badtap (Wstat: 0 Tests: 2 Failed: 1)',
+ "$source_tests/harness_badtap (Wstat: 0 Tests: 2 Failed: 1)",
'[[reset]]',
'[[red]]',
'Failed test:',
@@ -458,17 +454,17 @@
# only show failures
@output = ();
- _runtests( $harness_failures, 't/source_tests/harness_failure' );
+ _runtests( $harness_failures, "$source_tests/harness_failure" );
chomp(@output);
@expected = (
- 't/source_tests/harness_failure....',
+ "$source_tests/harness_failure....",
'not ok 2 - this is another test',
'Failed 1/2 subtests',
'Test Summary Report',
'-------------------',
- 't/source_tests/harness_failure (Wstat: 0 Tests: 2 Failed: 1)',
+ "$source_tests/harness_failure (Wstat: 0 Tests: 2 Failed: 1)",
'Failed test:',
'2',
);
@@ -484,16 +480,16 @@
# check the status output for no tests
@output = ();
- _runtests( $harness_failures, 't/sample-tests/no_output' );
+ _runtests( $harness_failures, "$sample_tests/no_output" );
chomp(@output);
@expected = (
- 't/sample-tests/no_output....',
+ "$sample_tests/no_output....",
'No subtests run',
'Test Summary Report',
'-------------------',
- 't/sample-tests/no_output (Wstat: 0 Tests: 0 Failed: 0)',
+ "$sample_tests/no_output (Wstat: 0 Tests: 0 Failed: 0)",
'Parse errors: No plan found in TAP output',
);
@@ -524,7 +520,12 @@
}
);
- eval { _runtests( $harness, 't/data/catme.1' ) };
+ eval {
+ _runtests(
+ $harness,
+ $ENV{PERL_CORE} ? 'lib/data/catme.1' : 't/data/catme.1'
+ );
+ };
my @output = tied($$capture)->dump;
my $status = pop @output;
@@ -547,9 +548,9 @@
_runtests(
$harness,
- 't/source_tests/harness_complain'
+ "$source_tests/harness_complain"
, # will get mad if run with args
- 't/source_tests/harness',
+ "$source_tests/harness",
);
my @output = tied($$capture)->dump;
@@ -788,7 +789,8 @@
# coverage tests for the basically untested T::H::_open_spool
- $ENV{PERL_TEST_HARNESS_DUMP_TAP} = File::Spec->catfile(qw(t spool));
+ my @spool = ( $ENV{PERL_CORE} ? ('spool') : ( 't', 'spool' ) );
+ $ENV{PERL_TEST_HARNESS_DUMP_TAP} = File::Spec->catfile(@spool);
# now given that we're going to be writing stuff to the file system, make sure
we have
# a cleanup hook
@@ -807,14 +809,14 @@
# normal tests in verbose mode
- my $parser = $harness->runtests(
- File::Spec->catfile(qw (t source_tests harness )) );
+ my $parser
+ = $harness->runtests( File::Spec->catfile( $source_tests, 'harness' ) );
isa_ok $parser, 'TAP::Parser::Aggregator',
'... runtests returns the aggregate';
ok -e File::Spec->catfile(
$ENV{PERL_TEST_HARNESS_DUMP_TAP},
- qw( t source_tests harness )
+ $source_tests, 'harness'
);
}
==== //depot/perl/lib/Test/Harness/t/nofork.t#2 (xtext) ====
Index: perl/lib/Test/Harness/t/nofork.t
--- perl/lib/Test/Harness/t/nofork.t#1~32659~ 2007-12-19 10:18:04.000000000
-0800
+++ perl/lib/Test/Harness/t/nofork.t 2007-12-21 00:58:42.000000000 -0800
@@ -4,20 +4,12 @@
# NOTE maybe a good candidate for xt/author or something.
BEGIN {
- if( $ENV{PERL_CORE} ) {
+ if ( $ENV{PERL_CORE} ) {
chdir 't';
- @INC = ('../lib', 'lib');
+ @INC = ( '../lib', 'lib' );
}
else {
- use lib 't/lib';
- }
-}
-
-BEGIN {
- if ($ENV{PERL_CORE}) {
- # FIXME
- print "1..0 # Skip pending resolution of how to set the library with
-I\n";
- exit 0;
+ use lib 't/lib';
}
}
@@ -39,7 +31,8 @@
util::stdout_of( sub { system(@args) and die "error $?" } );
}
-my @perl = ( $^X, '-Ilib', '-It/lib' );
+my @libs = map "-I$_", @INC;
+my @perl = ( $^X, @libs );
my $mod = 'TAP::Parser::Iterator::Process';
{ # just check the introspective method to start...
@@ -60,14 +53,15 @@
local *STDERR;
my $harness = TAP::Harness->new(
{ verbosity => -2,
- switches => [ '-It/lib', "-MNoFork" ],
+ switches => [ @libs, "-MNoFork" ],
stdout => $capture,
}
);
- $harness->runtests(($ENV{PERL_CORE} ? 'lib' : 't') .
'/sample-tests/simple');
+ $harness->runtests(
+ ( $ENV{PERL_CORE} ? 'lib' : 't' ) . '/sample-tests/simple' );
my @output = tied($$capture)->dump;
is pop @output, "Result: PASS\n", 'status OK';
- pop @output; # get rid of summary line
+ pop @output; # get rid of summary line
is( $output[-1], "All tests successful.\n", 'ran with no fork' );
}
==== //depot/perl/lib/Test/Harness/t/prove.t#2 (text) ====
Index: perl/lib/Test/Harness/t/prove.t
--- perl/lib/Test/Harness/t/prove.t#1~32659~ 2007-12-19 10:18:04.000000000
-0800
+++ perl/lib/Test/Harness/t/prove.t 2007-12-21 00:58:42.000000000 -0800
@@ -1,15 +1,16 @@
#!/usr/bin/perl -w
BEGIN {
- if ($ENV{PERL_CORE}) {
- # FIXME
- print "1..0 # Skip, needs fixing. Probably an -I issue\n";
- exit 0;
+ if ( $ENV{PERL_CORE} ) {
+ chdir 't';
+ @INC = ( '../lib', 'lib' );
+ }
+ else {
+ unshift @INC, 't/lib';
}
}
use strict;
-use lib 't/lib';
use Test::More;
use File::Spec;
==== //depot/perl/lib/Test/Harness/t/proverc.t#2 (text) ====
Index: perl/lib/Test/Harness/t/proverc.t
--- perl/lib/Test/Harness/t/proverc.t#1~32659~ 2007-12-19 10:18:04.000000000
-0800
+++ perl/lib/Test/Harness/t/proverc.t 2007-12-21 00:58:42.000000000 -0800
@@ -1,10 +1,12 @@
#!/usr/bin/perl -w
BEGIN {
- if ($ENV{PERL_CORE}) {
- # FIXME
- print "1..0 # Skip, needs fixing. Probably an -I issue\n";
- exit 0;
+ if ( $ENV{PERL_CORE} ) {
+ chdir 't';
+ @INC = ( '../lib', 'lib' );
+ }
+ else {
+ unshift @INC, 't/lib';
}
}
@@ -16,10 +18,15 @@
my $prove = App::Prove->new;
-$prove->add_rc_file( File::Spec->catfile( 't', 'data', 'proverc' ) );
+$prove->add_rc_file(
+ File::Spec->catfile(
+ ( $ENV{PERL_CORE} ? 'lib' : 't' ), 'data', 'proverc'
+ )
+);
is_deeply $prove->{rc_opts},
[ '--should', 'be', '--split', 'correctly', 'Can', 'quote things',
- 'using single or', 'double quotes', '--this', 'is', 'OK?' ],
+ 'using single or', 'double quotes', '--this', 'is', 'OK?'
+ ],
'options parsed';
==== //depot/perl/lib/Test/Harness/t/proverun.t#2 (text) ====
Index: perl/lib/Test/Harness/t/proverun.t
--- perl/lib/Test/Harness/t/proverun.t#1~32659~ 2007-12-19 10:18:04.000000000
-0800
+++ perl/lib/Test/Harness/t/proverun.t 2007-12-21 00:58:42.000000000 -0800
@@ -1,17 +1,16 @@
#!/usr/bin/perl -w
BEGIN {
- if ($ENV{PERL_CORE}) {
- # FIXME
- print "1..0 # Skip, needs fixing. Probably an -I issue\n";
- exit 0;
+ if ( $ENV{PERL_CORE} ) {
+ chdir 't';
+ @INC = ( '../lib', 'lib' );
+ }
+ else {
+ unshift @INC, 't/lib';
}
}
use strict;
-
-use lib 't/lib';
-
use Test::More;
use File::Spec;
use App::Prove;
@@ -20,8 +19,10 @@
BEGIN {
- my $sample_test
- = File::Spec->catfile( split /\//, 't/sample-tests/simple' );
+ my $sample_test = File::Spec->catfile(
+ split /\//,
+ ( $ENV{PERL_CORE} ? 'lib' : 't' ) . '/sample-tests/simple'
+ );
@SCHEDULE = (
{ name => 'Create empty',
==== //depot/perl/lib/Test/Harness/t/source.t#2 (text) ====
Index: perl/lib/Test/Harness/t/source.t
--- perl/lib/Test/Harness/t/source.t#1~32659~ 2007-12-19 10:18:04.000000000
-0800
+++ perl/lib/Test/Harness/t/source.t 2007-12-21 00:58:42.000000000 -0800
@@ -1,15 +1,16 @@
#!/usr/bin/perl -w
BEGIN {
- if ($ENV{PERL_CORE}) {
- # FIXME
- print "1..0 # Skip pending resolution of how to set the library with
-I\n";
- exit 0;
+ if ( $ENV{PERL_CORE} ) {
+ chdir 't';
+ @INC = ( '../lib', 'lib' );
+ }
+ else {
+ unshift @INC, 't/lib';
}
}
use strict;
-use lib 't/lib';
use Test::More tests => 30;
@@ -18,8 +19,10 @@
use TAP::Parser::Source;
use TAP::Parser::Source::Perl;
-my $test = File::Spec->catfile( $ENV{PERL_CORE} ? 'lib' : 't', 'source_tests',
- 'source' );
+my $test = File::Spec->catfile(
+ ( $ENV{PERL_CORE} ? 'lib' : 't' ), 'source_tests',
+ 'source'
+);
my $perl = $^X;
==== //depot/perl/lib/Test/Harness/t/spool.t#2 (text) ====
Index: perl/lib/Test/Harness/t/spool.t
--- perl/lib/Test/Harness/t/spool.t#1~32659~ 2007-12-19 10:18:04.000000000
-0800
+++ perl/lib/Test/Harness/t/spool.t 2007-12-21 00:58:42.000000000 -0800
@@ -1,10 +1,12 @@
#!/usr/bin/perl -w
BEGIN {
- if ($ENV{PERL_CORE}) {
- # FIXME
- print "1..0 # Skip pending resolution of how to avoid creating a
directory t in the core\n";
- exit 0;
+ if ( $ENV{PERL_CORE} ) {
+ chdir 't';
+ @INC = ( '../lib', 'lib' );
+ }
+ else {
+ unshift @INC, 't/lib';
}
}
@@ -13,8 +15,6 @@
# nearly everything
use strict;
-use lib 't/lib';
-
use Test::More;
my $useOrigOpen;
@@ -66,7 +66,8 @@
# coverage tests for the basically untested T::H::_open_spool
- $ENV{PERL_TEST_HARNESS_DUMP_TAP} = File::Spec->catfile(qw(t spool));
+ my @spool = ( $ENV{PERL_CORE} ? ('spool') : ( 't', 'spool' ) );
+ $ENV{PERL_TEST_HARNESS_DUMP_TAP} = File::Spec->catfile(@spool);
# now given that we're going to be writing stuff to the file system, make sure
we have
# a cleanup hook
@@ -98,11 +99,10 @@
is @die, 1, 'open failed, die as expected';
- my $spoolDir
- = quotemeta( File::Spec->catfile(qw( t spool source_tests harness )) );
+ my $spoolDir = quotemeta(
+ File::Spec->catfile( @spool, qw( source_tests harness ) ) );
- like pop @die, qr/ Can't write $spoolDir [(] /,
- '...with expected message';
+ like pop @die, qr/ Can't write $spoolDir \( /, '...with expected message';
# now make close fail
==== //depot/perl/lib/Test/Harness/t/taint.t#2 (text) ====
Index: perl/lib/Test/Harness/t/taint.t
--- perl/lib/Test/Harness/t/taint.t#1~32659~ 2007-12-19 10:18:04.000000000
-0800
+++ perl/lib/Test/Harness/t/taint.t 2007-12-21 00:58:42.000000000 -0800
@@ -1,10 +1,12 @@
#!/usr/bin/perl -w
BEGIN {
- if ($ENV{PERL_CORE}) {
- # FIXME
- print "1..0 # Skip pending resolution of how to set the library with
-I\n";
- exit 0;
+ if ( $ENV{PERL_CORE} ) {
+ chdir 't';
+ @INC = ( '../lib', 'lib' );
+ }
+ else {
+ unshift @INC, 't/lib';
}
}
@@ -12,17 +14,17 @@
# tests
use strict;
-use lib 't/lib';
-
use Test::More ( $^O eq 'VMS' ? ( skip_all => 'VMS' ) : ( tests => 3 ) );
use Config;
use TAP::Parser;
+my $lib_path = join( ', ', map "'$_'", grep !ref, grep defined, @INC );
+
sub run_test_file {
my ( $test_template, @args ) = @_;
- my $test_file = 't/temp_test.tmp';
+ my $test_file = 'temp_test.tmp';
open TEST, ">$test_file" or die $!;
printf TEST $test_template, @args;
@@ -38,13 +40,13 @@
{
local $ENV{PERL5LIB} = join $Config{path_sep}, grep defined, 'wibble',
$ENV{PERL5LIB};
- run_test_file(<<'END');
+ run_test_file( <<'END', $lib_path );
#!/usr/bin/perl -T
-use lib 't/lib';
+BEGIN { unshift @INC, ( %s ); }
use Test::More tests => 1;
-is( $INC[1], 'wibble' ) or diag join "\n", @INC;
+ok grep(/^wibble$/, @INC) or diag join "\n", @INC;
END
}
@@ -53,17 +55,18 @@
local $ENV{PERL5LIB};
local $ENV{PERLLIB} = join $Config{path_sep}, grep defined, 'wibble',
$perl5lib;
- run_test_file(<<'END');
+ run_test_file( <<'END', $lib_path );
#!/usr/bin/perl -T
-use lib 't/lib';
+BEGIN { unshift @INC, ( %s ); }
use Test::More tests => 1;
-is( $INC[1], 'wibble' ) or diag join "\n", @INC;
+ok grep(/^wibble$/, @INC) or diag join "\n", @INC;
END
}
{
+ local $ENV{PERL5LIB} = join $Config{path_sep}, @INC;
local $ENV{PERL5OPT} = '-Mstrict';
run_test_file(<<'END');
#!/usr/bin/perl -T
==== //depot/perl/lib/Test/Harness/t/unicode.t#4 (text) ====
Index: perl/lib/Test/Harness/t/unicode.t
--- perl/lib/Test/Harness/t/unicode.t#3~32674~ 2007-12-20 10:48:09.000000000
-0800
+++ perl/lib/Test/Harness/t/unicode.t 2007-12-21 00:58:42.000000000 -0800
@@ -9,7 +9,8 @@
my %make_test;
BEGIN {
- plan skip_all => "unicode on Perl < 5.8.0"
+ # TODO: Investigate failure on 5.8.0
+ plan skip_all => "unicode on Perl <= 5.8.0"
unless $] > 5.008;
plan skip_all => "PERL_UNICODE set"
==== //depot/perl/t/lib/source_tests/source#2 (text) ====
Index: perl/t/lib/source_tests/source
--- perl/t/lib/source_tests/source#1~32659~ 2007-12-19 10:18:04.000000000
-0800
+++ perl/t/lib/source_tests/source 2007-12-21 00:58:42.000000000 -0800
@@ -1,6 +1,15 @@
#!/usr/bin/perl -wT
-use lib 't/lib';
+BEGIN {
+ if ( $ENV{PERL_CORE} ) {
+ chdir 't';
+ @INC = ( '../lib', 'lib' );
+ }
+ else {
+ unshift @INC, 't/lib';
+ }
+}
+
use Test::More tests => 1;
ok 1;
End of Patch.