1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00
wget/tests/run-px

111 lines
2.6 KiB
Plaintext
Raw Normal View History

#!/usr/bin/env perl
2008-11-07 16:06:38 -05:00
use 5.006;
2008-11-06 14:38:16 -05:00
use strict;
2008-11-12 16:54:49 -05:00
use warnings;
2008-11-07 16:06:38 -05:00
use Term::ANSIColor ':constants';
$Term::ANSIColor::AUTORESET = 1;
die "Please specify the top source directory.\n" if (!@ARGV);
my $top_srcdir = shift @ARGV;
my @tests = (
'Test-auth-basic.px',
'Test-auth-no-challenge.px',
'Test-auth-no-challenge-url.px',
'Test-proxy-auth-basic.px',
'Test-proxied-https-auth.px',
'Test-N-HTTP-Content-Disposition.px',
'Test--spider.px',
'Test-c-full.px',
'Test-c-partial.px',
2008-08-22 20:39:47 -04:00
'Test-c-shorter.px',
'Test-c.px',
'Test-E-k-K.px',
'Test-E-k.px',
'Test-ftp.px',
'Test-HTTP-Content-Disposition-1.px',
'Test-HTTP-Content-Disposition-2.px',
'Test-HTTP-Content-Disposition.px',
'Test-N-current.px',
2008-05-31 16:22:15 -04:00
'Test-N-smaller.px',
2008-05-31 16:31:05 -04:00
'Test-N-no-info.px',
'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',
2008-08-22 19:56:18 -04:00
'Test-O-nc.px',
'Test-Restrict-Lowercase.px',
'Test-Restrict-Uppercase.px',
'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',
);
2008-11-07 16:06:38 -05:00
my @tested;
2008-11-07 16:06:38 -05:00
foreach my $test (@tests) {
print "Running $test\n\n";
2008-11-06 18:01:25 -05:00
system("$^X $top_srcdir/tests/$test");
2008-11-07 16:06:38 -05:00
push @tested, { name => $test, result => $? };
}
2008-11-07 16:06:38 -05:00
print "\n";
foreach my $test (@tested) {
($test->{result} == 0)
? print GREEN 'pass: '
: print RED 'FAIL: ';
print $test->{name}, "\n";
}
2008-06-12 18:21:32 -04:00
2008-11-07 16:06:38 -05:00
my $count = sub
{
return {
pass => sub { scalar grep $_->{result} == 0, @tested },
fail => sub { scalar grep $_->{result} != 0, @tested },
}->{$_[0]}->();
};
my $summary = sub
{
my @lines = (
"${\scalar @tested} tests were run",
"${\$count->('pass')} PASS, ${\$count->('fail')} FAIL",
);
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";
print $count->('fail')
? RED $summary
: GREEN $summary;
2008-06-12 18:21:32 -04:00
print "\n";
2008-11-07 16:06:38 -05:00
exit $count->('fail');