X-Git-Url: http://sjero.net/git/?p=wget;a=blobdiff_plain;f=tests%2Frun-px;h=49dcb740a2c99601d0915e05a77844c4079a0099;hp=102c75dc41cbbe26e3307dd94b863e773ce84f53;hb=HEAD;hpb=1274565a64130012b40b053b989b7e2eaba1388f diff --git a/tests/run-px b/tests/run-px index 102c75dc..49dcb740 100755 --- a/tests/run-px +++ b/tests/run-px @@ -4,8 +4,7 @@ use 5.006; use strict; use warnings; -use Term::ANSIColor ':constants'; -$Term::ANSIColor::AUTORESET = 1; +use Term::ANSIColor; die "Please specify the top source directory.\n" if (!@ARGV); my $top_srcdir = shift @ARGV; @@ -14,6 +13,8 @@ my @tests = ( 'Test-auth-basic.px', 'Test-auth-no-challenge.px', 'Test-auth-no-challenge-url.px', + 'Test-auth-with-content-disposition.px', + 'Test-auth-retcode.px', 'Test-cookies.px', 'Test-cookies-401.px', 'Test-proxy-auth-basic.px', @@ -28,18 +29,29 @@ my @tests = ( 'Test-E-k.px', 'Test-ftp.px', 'Test-ftp-pasv-fail.px', + 'Test-ftp-bad-list.px', 'Test-ftp-recursive.px', 'Test-ftp-iri.px', 'Test-ftp-iri-fallback.px', 'Test-ftp-iri-recursive.px', 'Test-ftp-iri-disabled.px', + 'Test-ftp-list-Multinet.px', + 'Test-ftp-list-Unknown.px', + 'Test-ftp-list-Unknown-a.px', + 'Test-ftp-list-Unknown-hidden.px', + 'Test-ftp-list-Unknown-list-a-fails.px', + 'Test-ftp-list-UNIX-hidden.px', 'Test-HTTP-Content-Disposition-1.px', 'Test-HTTP-Content-Disposition-2.px', 'Test-HTTP-Content-Disposition.px', + 'Test-i-ftp.px', + 'Test-i-http.px', 'Test-idn-headers.px', 'Test-idn-meta.px', 'Test-idn-cmd.px', + 'Test-idn-cmd-utf8.px', 'Test-idn-robots.px', + 'Test-idn-robots-utf8.px', 'Test-iri.px', 'Test-iri-percent.px', 'Test-iri-disabled.px', @@ -64,15 +76,22 @@ my @tests = ( 'Test-O--no-content-disposition-trivial.px', 'Test-O-nonexisting.px', 'Test-O.px', + 'Test--post-file.px', 'Test-O-nc.px', 'Test-restrict-ascii.px', 'Test-Restrict-Lowercase.px', 'Test-Restrict-Uppercase.px', + 'Test-stdouterr.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', + 'Test--httpsonly-r.px', + 'Test--start-pos.px', + 'Test-ftp--start-pos.px', + 'Test--start-pos--continue.px', + 'Test-204.px', ); foreach my $var (qw(SYSTEM_WGETRC WGETRC)) { @@ -84,26 +103,42 @@ my @tested; foreach my $test (@tests) { print "Running $test\n\n"; system("$^X -I$top_srcdir/tests $top_srcdir/tests/$test $top_srcdir"); - push @tested, { name => $test, result => $? }; + push @tested, { name => $test, result => $? >> 8 }; } foreach my $var (qw(SYSTEM_WGETRC WGETRC)) { delete $ENV{$var}; } +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'), +); + print "\n"; foreach my $test (@tested) { - ($test->{result} == 0) - ? print GREEN 'pass: ' - : print RED 'FAIL: '; - print $test->{name}, "\n"; + my $colored = exists $colors{$test->{result}} + ? $colors{$test->{result}} + : $colors{$exit{unknown}}; + print "$colored $test->{name}\n"; } my $count = sub { return { - pass => sub { scalar grep $_->{result} == 0, @tested }, - fail => sub { scalar grep $_->{result} != 0, @tested }, + 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 }, }->{$_[0]}->(); }; @@ -112,6 +147,7 @@ my $summary = sub my @lines = ( "${\scalar @tested} tests were run", "${\$count->('pass')} PASS, ${\$count->('fail')} FAIL", + "${\$count->('skip')} SKIP, ${\$count->('unknown')} UNKNOWN", ); my $len_longest = sub { @@ -130,9 +166,9 @@ my $summary = sub }->(); print "\n"; -print $count->('fail') - ? RED $summary - : GREEN $summary; +print $count->('fail') || $count->('unknown') + ? colored($summary, 'red') + : colored($summary, 'green'); print "\n"; -exit $count->('fail'); +exit $count->('fail') + $count->('unknown');