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',
16 'Test-auth-with-content-disposition.px',
17 'Test-auth-retcode.px',
19 'Test-cookies-401.px',
20 'Test-proxy-auth-basic.px',
21 'Test-proxied-https-auth.px',
22 'Test-N-HTTP-Content-Disposition.px',
31 'Test-ftp-pasv-fail.px',
32 'Test-ftp-bad-list.px',
33 'Test-ftp-recursive.px',
35 'Test-ftp-iri-fallback.px',
36 'Test-ftp-iri-recursive.px',
37 'Test-ftp-iri-disabled.px',
38 'Test-HTTP-Content-Disposition-1.px',
39 'Test-HTTP-Content-Disposition-2.px',
40 'Test-HTTP-Content-Disposition.px',
43 'Test-idn-headers.px',
46 'Test-idn-cmd-utf8.px',
48 'Test-idn-robots-utf8.px',
50 'Test-iri-percent.px',
51 'Test-iri-disabled.px',
52 'Test-iri-forced-remote.px',
55 'Test-meta-robots.px',
59 'Test-N--no-content-disposition.px',
60 'Test-N--no-content-disposition-trivial.px',
61 'Test--no-content-disposition.px',
62 'Test--no-content-disposition-trivial.px',
64 'Test-nonexisting-quiet.px',
68 'Test-O-HTTP-Content-Disposition.px',
69 'Test-O--no-content-disposition.px',
70 'Test-O--no-content-disposition-trivial.px',
71 'Test-O-nonexisting.px',
74 'Test-restrict-ascii.px',
75 'Test-Restrict-Lowercase.px',
76 'Test-Restrict-Uppercase.px',
77 'Test--spider-fail.px',
78 'Test--spider-r-HTTP-Content-Disposition.px',
79 'Test--spider-r--no-content-disposition.px',
80 'Test--spider-r--no-content-disposition-trivial.px',
84 foreach my $var (qw(SYSTEM_WGETRC WGETRC)) {
85 $ENV{$var} = '/dev/null';
90 foreach my $test (@tests) {
91 print "Running $test\n\n";
92 system("$^X -I$top_srcdir/tests $top_srcdir/tests/$test $top_srcdir");
93 push @tested, { name => $test, result => $? >> 8 };
96 foreach my $var (qw(SYSTEM_WGETRC WGETRC)) {
104 unknown => 3, # or greater
108 $exit{pass} => colored('pass:', 'green' ),
109 $exit{fail} => colored('FAIL:', 'red' ),
110 $exit{skip} => colored('Skip:', 'yellow' ),
111 $exit{unknown} => colored('Unknown:', 'magenta'),
115 foreach my $test (@tested) {
116 my $colored = exists $colors{$test->{result}}
117 ? $colors{$test->{result}}
118 : $colors{$exit{unknown}};
119 print "$colored $test->{name}\n";
125 pass => sub { scalar grep $_->{result} == $exit{pass}, @tested },
126 fail => sub { scalar grep $_->{result} == $exit{fail}, @tested },
127 skip => sub { scalar grep $_->{result} == $exit{skip}, @tested },
128 unknown => sub { scalar grep $_->{result} >= $exit{unknown}, @tested },
135 "${\scalar @tested} tests were run",
136 "${\$count->('pass')} PASS, ${\$count->('fail')} FAIL",
137 "${\$count->('skip')} SKIP, ${\$count->('unknown')} UNKNOWN",
139 my $len_longest = sub
142 foreach my $line (@lines) {
143 if (length $line > $_) {
156 print $count->('fail') || $count->('unknown')
157 ? colored($summary, 'red')
158 : colored($summary, 'green');
161 exit $count->('fail') + $count->('unknown');