This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Optimize 2>&1 in commands
[perl5.git] / t / harness
CommitLineData
a5f75d66
AD
1#!./perl
2
3# We suppose that perl _mostly_ works at this moment, so may use
4# sophisticated testing.
5
aa689395
PP
6BEGIN {
7 chdir 't' if -d 't';
93430cb4 8 unshift @INC, '../lib';
ef712cf7 9 $ENV{PERL5LIB} = '../lib'; # so children will see it too
aa689395 10}
a5f75d66 11use lib '../lib';
aa689395 12
a5f75d66
AD
13use Test::Harness;
14
ef712cf7 15$Test::Harness::switches = ""; # Too much noise otherwise
90ce63d5 16$Test::Harness::verbose = shift if @ARGV && $ARGV[0] eq '-v';
a5f75d66
AD
17
18@tests = @ARGV;
68dc0745 19@tests = <base/*.t comp/*.t cmd/*.t io/*.t op/*.t pragma/*.t lib/*.t> unless @tests;
52cebf5e 20
a5f75d66 21Test::Harness::runtests @tests;
56eca212
GS
22exit(0) unless -e "../testcompile";
23
56eca212 24#fudge DATA for now.
ef712cf7
EP
25%infinite = qw (
26 op/bop.t 1
27 lib/hostname.t 1
28 );
29
56eca212 30%datahandle = qw(
ef712cf7
EP
31 lib/bigint.t 1
32 lib/bigintpm.t 1
33 lib/bigfloat.t 1
34 lib/bigfloatpm.t 1
35 );
56eca212
GS
36
37my $dhwrapper = <<'EOT';
38open DATA,"<".__FILE__;
39until (($_=<DATA>) =~ /^__END__/) {};
40EOT
52cebf5e
EP
41
42@tests = grep (!$infinite{$_}, @tests);
56eca212 43@tests = map {
ef712cf7
EP
44 my $new = $_;
45 if ($datahandle{$_}) {
46 $new .= '.t';
47 local(*F, *T);
48 open(F,"<$_") or die "Can't open $_: $!";
49 open(T,">$new") or die "Can't open $new: $!";
50 print T $dhwrapper, <F>;
51 close F;
52 close T;
53 }
54 $new;
55 } @tests;
56
57print "The tests ", join(' ', keys(%infinite)),
58 " generate infinite loops! Skipping!\n";
59
60$ENV{'COMPILE_TEST'} = 1;
61$ENV{'COMPILE_TIMEOUT'} = 120 unless $ENV{'COMPILE_TIMEOUT'};
62
63Test::Harness::runtests @tests;
56eca212
GS
64foreach (keys %datahandle) {
65 unlink "$_.t";
52cebf5e 66}