9 die "Please specify the top source directory.\n" if (!@ARGV);
10 my $top_srcdir = shift @ARGV;
14 'Test-auth-no-challenge.px',
15 'Test-auth-no-challenge-url.px',
17 'Test-cookies-401.px',
18 'Test-proxy-auth-basic.px',
19 'Test-proxied-https-auth.px',
20 'Test-N-HTTP-Content-Disposition.px',
29 'Test-ftp-pasv-fail.px',
30 'Test-ftp-recursive.px',
32 'Test-ftp-iri-fallback.px',
33 'Test-ftp-iri-recursive.px',
34 'Test-ftp-iri-disabled.px',
35 'Test-HTTP-Content-Disposition-1.px',
36 'Test-HTTP-Content-Disposition-2.px',
37 'Test-HTTP-Content-Disposition.px',
38 'Test-idn-headers.px',
43 'Test-iri-percent.px',
44 'Test-iri-disabled.px',
45 'Test-iri-forced-remote.px',
48 'Test-meta-robots.px',
52 'Test-N--no-content-disposition.px',
53 'Test-N--no-content-disposition-trivial.px',
54 'Test--no-content-disposition.px',
55 'Test--no-content-disposition-trivial.px',
57 'Test-nonexisting-quiet.px',
61 'Test-O-HTTP-Content-Disposition.px',
62 'Test-O--no-content-disposition.px',
63 'Test-O--no-content-disposition-trivial.px',
64 'Test-O-nonexisting.px',
67 'Test-restrict-ascii.px',
68 'Test-Restrict-Lowercase.px',
69 'Test-Restrict-Uppercase.px',
70 'Test--spider-fail.px',
71 'Test--spider-r-HTTP-Content-Disposition.px',
72 'Test--spider-r--no-content-disposition.px',
73 'Test--spider-r--no-content-disposition-trivial.px',
77 foreach my $var (qw(SYSTEM_WGETRC WGETRC)) {
78 $ENV{$var} = '/dev/null';
83 foreach my $test (@tests) {
84 print "Running $test\n\n";
85 system("$^X -I$top_srcdir/tests $top_srcdir/tests/$test $top_srcdir");
86 push @tested, { name => $test, result => $? >> 8 };
89 foreach my $var (qw(SYSTEM_WGETRC WGETRC)) {
97 unknown => 3, # or greater
101 $exit{pass} => colored('pass:', 'green' ),
102 $exit{fail} => colored('FAIL:', 'red' ),
103 $exit{skip} => colored('Skip:', 'yellow' ),
104 $exit{unknown} => colored('Unknown:', 'magenta'),
108 foreach my $test (@tested) {
109 my $colored = exists $colors{$test->{result}}
110 ? $colors{$test->{result}}
111 : $colors{$exit{unknown}};
112 print "$colored $test->{name}\n";
118 pass => sub { scalar grep $_->{result} == $exit{pass}, @tested },
119 fail => sub { scalar grep $_->{result} == $exit{fail}, @tested },
120 skip => sub { scalar grep $_->{result} == $exit{skip}, @tested },
121 unknown => sub { scalar grep $_->{result} >= $exit{unknown}, @tested },
128 "${\scalar @tested} tests were run",
129 "${\$count->('pass')} PASS, ${\$count->('fail')} FAIL",
130 "${\$count->('skip')} SKIP, ${\$count->('unknown')} UNKNOWN",
132 my $len_longest = sub
135 foreach my $line (@lines) {
136 if (length $line > $_) {
149 print $count->('fail')
150 ? colored($summary, 'red')
151 : colored($summary, 'green');
154 exit $count->('fail');