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-ftp-list-Multinet.px',
39 'Test-ftp-list-Unknown.px',
40 'Test-ftp-list-Unknown-a.px',
41 'Test-ftp-list-Unknown-hidden.px',
42 'Test-ftp-list-Unknown-list-a-fails.px',
43 'Test-ftp-list-UNIX-hidden.px',
44 'Test-HTTP-Content-Disposition-1.px',
45 'Test-HTTP-Content-Disposition-2.px',
46 'Test-HTTP-Content-Disposition.px',
49 'Test-idn-headers.px',
52 'Test-idn-cmd-utf8.px',
54 'Test-idn-robots-utf8.px',
56 'Test-iri-percent.px',
57 'Test-iri-disabled.px',
58 'Test-iri-forced-remote.px',
61 'Test-meta-robots.px',
65 'Test-N--no-content-disposition.px',
66 'Test-N--no-content-disposition-trivial.px',
67 'Test--no-content-disposition.px',
68 'Test--no-content-disposition-trivial.px',
70 'Test-nonexisting-quiet.px',
74 'Test-O-HTTP-Content-Disposition.px',
75 'Test-O--no-content-disposition.px',
76 'Test-O--no-content-disposition-trivial.px',
77 'Test-O-nonexisting.px',
81 'Test-restrict-ascii.px',
82 'Test-Restrict-Lowercase.px',
83 'Test-Restrict-Uppercase.px',
85 'Test--spider-fail.px',
86 'Test--spider-r-HTTP-Content-Disposition.px',
87 'Test--spider-r--no-content-disposition.px',
88 'Test--spider-r--no-content-disposition-trivial.px',
90 'Test--httpsonly-r.px',
92 'Test-ftp--start-pos.px',
93 'Test--start-pos--continue.px',
97 foreach my $var (qw(SYSTEM_WGETRC WGETRC)) {
98 $ENV{$var} = '/dev/null';
103 foreach my $test (@tests) {
104 print "Running $test\n\n";
105 system("$^X -I$top_srcdir/tests $top_srcdir/tests/$test $top_srcdir");
106 push @tested, { name => $test, result => $? >> 8 };
109 foreach my $var (qw(SYSTEM_WGETRC WGETRC)) {
117 unknown => 3, # or greater
121 $exit{pass} => colored('pass:', 'green' ),
122 $exit{fail} => colored('FAIL:', 'red' ),
123 $exit{skip} => colored('Skip:', 'yellow' ),
124 $exit{unknown} => colored('Unknown:', 'magenta'),
128 foreach my $test (@tested) {
129 my $colored = exists $colors{$test->{result}}
130 ? $colors{$test->{result}}
131 : $colors{$exit{unknown}};
132 print "$colored $test->{name}\n";
138 pass => sub { scalar grep $_->{result} == $exit{pass}, @tested },
139 fail => sub { scalar grep $_->{result} == $exit{fail}, @tested },
140 skip => sub { scalar grep $_->{result} == $exit{skip}, @tested },
141 unknown => sub { scalar grep $_->{result} >= $exit{unknown}, @tested },
148 "${\scalar @tested} tests were run",
149 "${\$count->('pass')} PASS, ${\$count->('fail')} FAIL",
150 "${\$count->('skip')} SKIP, ${\$count->('unknown')} UNKNOWN",
152 my $len_longest = sub
155 foreach my $line (@lines) {
156 if (length $line > $_) {
169 print $count->('fail') || $count->('unknown')
170 ? colored($summary, 'red')
171 : colored($summary, 'green');
174 exit $count->('fail') + $count->('unknown');