2008-05-22 23:14:05 -07:00
|
|
|
#!/usr/bin/env perl
|
2008-11-07 22:06:38 +01:00
|
|
|
|
|
|
|
use 5.006;
|
2008-11-06 11:38:16 -08:00
|
|
|
use strict;
|
2008-11-12 22:54:49 +01:00
|
|
|
use warnings;
|
2008-05-22 23:14:05 -07:00
|
|
|
|
2009-09-05 22:54:05 +02:00
|
|
|
use Term::ANSIColor;
|
2008-11-07 22:06:38 +01:00
|
|
|
|
2008-05-22 23:14:05 -07:00
|
|
|
die "Please specify the top source directory.\n" if (!@ARGV);
|
|
|
|
my $top_srcdir = shift @ARGV;
|
|
|
|
|
|
|
|
my @tests = (
|
|
|
|
'Test-auth-basic.px',
|
2008-11-11 12:53:01 -08:00
|
|
|
'Test-auth-no-challenge.px',
|
|
|
|
'Test-auth-no-challenge-url.px',
|
2009-09-07 23:09:15 -07:00
|
|
|
'Test-auth-with-content-disposition.px',
|
2010-05-29 23:10:59 +02:00
|
|
|
'Test-auth-retcode.px',
|
2009-08-27 00:40:48 -07:00
|
|
|
'Test-cookies.px',
|
|
|
|
'Test-cookies-401.px',
|
2008-05-22 23:59:28 -07:00
|
|
|
'Test-proxy-auth-basic.px',
|
|
|
|
'Test-proxied-https-auth.px',
|
|
|
|
'Test-N-HTTP-Content-Disposition.px',
|
2008-05-23 00:04:09 -07:00
|
|
|
'Test--spider.px',
|
2008-05-22 23:14:05 -07:00
|
|
|
'Test-c-full.px',
|
|
|
|
'Test-c-partial.px',
|
2008-08-22 17:39:47 -07:00
|
|
|
'Test-c-shorter.px',
|
2008-05-22 23:14:05 -07:00
|
|
|
'Test-c.px',
|
|
|
|
'Test-E-k-K.px',
|
|
|
|
'Test-E-k.px',
|
|
|
|
'Test-ftp.px',
|
2009-09-06 13:04:22 -07:00
|
|
|
'Test-ftp-pasv-fail.px',
|
2009-09-07 22:40:25 -07:00
|
|
|
'Test-ftp-bad-list.px',
|
2009-09-05 23:08:55 -07:00
|
|
|
'Test-ftp-recursive.px',
|
2008-08-02 13:47:10 +02:00
|
|
|
'Test-ftp-iri.px',
|
|
|
|
'Test-ftp-iri-fallback.px',
|
2009-06-29 18:53:13 -07:00
|
|
|
'Test-ftp-iri-recursive.px',
|
2008-08-02 13:47:10 +02:00
|
|
|
'Test-ftp-iri-disabled.px',
|
2008-05-22 23:14:05 -07:00
|
|
|
'Test-HTTP-Content-Disposition-1.px',
|
|
|
|
'Test-HTTP-Content-Disposition-2.px',
|
|
|
|
'Test-HTTP-Content-Disposition.px',
|
2010-03-02 00:00:17 +01:00
|
|
|
'Test-i-ftp.px',
|
2010-02-26 23:07:51 +01:00
|
|
|
'Test-i-http.px',
|
2008-08-28 02:45:29 -07:00
|
|
|
'Test-idn-headers.px',
|
2008-08-28 12:47:17 -07:00
|
|
|
'Test-idn-meta.px',
|
2008-09-09 21:55:02 -07:00
|
|
|
'Test-idn-cmd.px',
|
2011-07-26 09:27:08 +02:00
|
|
|
'Test-idn-cmd-utf8.px',
|
2008-12-04 14:25:12 -08:00
|
|
|
'Test-idn-robots.px',
|
2011-07-26 09:27:08 +02:00
|
|
|
'Test-idn-robots-utf8.px',
|
2008-08-02 12:17:03 +02:00
|
|
|
'Test-iri.px',
|
2009-06-29 03:29:16 -07:00
|
|
|
'Test-iri-percent.px',
|
2008-08-02 12:17:03 +02:00
|
|
|
'Test-iri-disabled.px',
|
|
|
|
'Test-iri-forced-remote.px',
|
2008-08-14 18:26:53 +02:00
|
|
|
'Test-iri-list.px',
|
2009-08-29 23:24:49 +02:00
|
|
|
'Test-k.px',
|
2009-07-05 23:23:17 -07:00
|
|
|
'Test-meta-robots.px',
|
2008-05-22 23:14:05 -07:00
|
|
|
'Test-N-current.px',
|
2008-05-31 13:22:15 -07:00
|
|
|
'Test-N-smaller.px',
|
2008-05-31 13:31:05 -07:00
|
|
|
'Test-N-no-info.px',
|
2008-05-22 23:14:05 -07:00
|
|
|
'Test-N--no-content-disposition.px',
|
|
|
|
'Test-N--no-content-disposition-trivial.px',
|
|
|
|
'Test--no-content-disposition.px',
|
|
|
|
'Test--no-content-disposition-trivial.px',
|
|
|
|
'Test-N-old.px',
|
|
|
|
'Test-nonexisting-quiet.px',
|
|
|
|
'Test-noop.px',
|
|
|
|
'Test-np.px',
|
|
|
|
'Test-N.px',
|
|
|
|
'Test-O-HTTP-Content-Disposition.px',
|
|
|
|
'Test-O--no-content-disposition.px',
|
|
|
|
'Test-O--no-content-disposition-trivial.px',
|
|
|
|
'Test-O-nonexisting.px',
|
|
|
|
'Test-O.px',
|
2013-03-12 12:21:07 +05:30
|
|
|
'Test--post-file.px',
|
2008-08-22 16:56:18 -07:00
|
|
|
'Test-O-nc.px',
|
2009-07-27 23:41:26 -07:00
|
|
|
'Test-restrict-ascii.px',
|
2008-05-22 23:14:05 -07:00
|
|
|
'Test-Restrict-Lowercase.px',
|
|
|
|
'Test-Restrict-Uppercase.px',
|
2012-06-16 13:05:03 +02:00
|
|
|
'Test-stdouterr.px',
|
2008-05-22 23:14:05 -07:00
|
|
|
'Test--spider-fail.px',
|
|
|
|
'Test--spider-r-HTTP-Content-Disposition.px',
|
|
|
|
'Test--spider-r--no-content-disposition.px',
|
|
|
|
'Test--spider-r--no-content-disposition-trivial.px',
|
|
|
|
'Test--spider-r.px',
|
|
|
|
);
|
|
|
|
|
2009-04-11 21:59:55 +02:00
|
|
|
foreach my $var (qw(SYSTEM_WGETRC WGETRC)) {
|
|
|
|
$ENV{$var} = '/dev/null';
|
|
|
|
}
|
|
|
|
|
2008-11-07 22:06:38 +01:00
|
|
|
my @tested;
|
2008-05-22 23:14:05 -07:00
|
|
|
|
2008-11-07 22:06:38 +01:00
|
|
|
foreach my $test (@tests) {
|
2008-05-22 23:14:05 -07:00
|
|
|
print "Running $test\n\n";
|
2009-06-12 00:06:10 -07:00
|
|
|
system("$^X -I$top_srcdir/tests $top_srcdir/tests/$test $top_srcdir");
|
2009-09-05 22:54:05 +02:00
|
|
|
push @tested, { name => $test, result => $? >> 8 };
|
2008-05-22 23:14:05 -07:00
|
|
|
}
|
|
|
|
|
2009-04-11 21:59:55 +02:00
|
|
|
foreach my $var (qw(SYSTEM_WGETRC WGETRC)) {
|
|
|
|
delete $ENV{$var};
|
|
|
|
}
|
|
|
|
|
2009-09-05 22:54:05 +02:00
|
|
|
my %exit = (
|
|
|
|
pass => 0,
|
|
|
|
fail => 1,
|
|
|
|
skip => 2,
|
|
|
|
unknown => 3, # or greater
|
|
|
|
);
|
|
|
|
|
|
|
|
my %colors = (
|
|
|
|
$exit{pass} => colored('pass:', 'green' ),
|
|
|
|
$exit{fail} => colored('FAIL:', 'red' ),
|
|
|
|
$exit{skip} => colored('Skip:', 'yellow' ),
|
|
|
|
$exit{unknown} => colored('Unknown:', 'magenta'),
|
|
|
|
);
|
|
|
|
|
2008-11-07 22:06:38 +01:00
|
|
|
print "\n";
|
|
|
|
foreach my $test (@tested) {
|
2009-09-05 22:54:05 +02:00
|
|
|
my $colored = exists $colors{$test->{result}}
|
|
|
|
? $colors{$test->{result}}
|
|
|
|
: $colors{$exit{unknown}};
|
|
|
|
print "$colored $test->{name}\n";
|
2008-05-22 23:14:05 -07:00
|
|
|
}
|
2008-06-12 15:21:32 -07:00
|
|
|
|
2008-11-07 22:06:38 +01:00
|
|
|
my $count = sub
|
|
|
|
{
|
|
|
|
return {
|
2009-09-05 22:54:05 +02:00
|
|
|
pass => sub { scalar grep $_->{result} == $exit{pass}, @tested },
|
|
|
|
fail => sub { scalar grep $_->{result} == $exit{fail}, @tested },
|
|
|
|
skip => sub { scalar grep $_->{result} == $exit{skip}, @tested },
|
|
|
|
unknown => sub { scalar grep $_->{result} >= $exit{unknown}, @tested },
|
2008-11-07 22:06:38 +01:00
|
|
|
}->{$_[0]}->();
|
|
|
|
};
|
|
|
|
|
|
|
|
my $summary = sub
|
|
|
|
{
|
|
|
|
my @lines = (
|
|
|
|
"${\scalar @tested} tests were run",
|
|
|
|
"${\$count->('pass')} PASS, ${\$count->('fail')} FAIL",
|
2009-09-05 22:54:05 +02:00
|
|
|
"${\$count->('skip')} SKIP, ${\$count->('unknown')} UNKNOWN",
|
2008-11-07 22:06:38 +01:00
|
|
|
);
|
|
|
|
my $len_longest = sub
|
|
|
|
{
|
|
|
|
local $_ = 0;
|
|
|
|
foreach my $line (@lines) {
|
|
|
|
if (length $line > $_) {
|
|
|
|
$_ = length $line;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $_;
|
|
|
|
}->();
|
|
|
|
return join "\n",
|
|
|
|
'=' x $len_longest,
|
|
|
|
@lines,
|
|
|
|
'=' x $len_longest;
|
|
|
|
}->();
|
|
|
|
|
|
|
|
print "\n";
|
2009-09-07 23:11:48 -07:00
|
|
|
print $count->('fail') || $count->('unknown')
|
2009-09-05 22:54:05 +02:00
|
|
|
? colored($summary, 'red')
|
|
|
|
: colored($summary, 'green');
|
2008-06-12 15:21:32 -07:00
|
|
|
print "\n";
|
|
|
|
|
2009-09-07 23:11:48 -07:00
|
|
|
exit $count->('fail') + $count->('unknown');
|