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',
93 foreach my $var (qw(SYSTEM_WGETRC WGETRC)) {
94 $ENV{$var} = '/dev/null';
99 foreach my $test (@tests) {
100 print "Running $test\n\n";
101 system("$^X -I$top_srcdir/tests $top_srcdir/tests/$test $top_srcdir");
102 push @tested, { name => $test, result => $? >> 8 };
105 foreach my $var (qw(SYSTEM_WGETRC WGETRC)) {
113 unknown => 3, # or greater
117 $exit{pass} => colored('pass:', 'green' ),
118 $exit{fail} => colored('FAIL:', 'red' ),
119 $exit{skip} => colored('Skip:', 'yellow' ),
120 $exit{unknown} => colored('Unknown:', 'magenta'),
124 foreach my $test (@tested) {
125 my $colored = exists $colors{$test->{result}}
126 ? $colors{$test->{result}}
127 : $colors{$exit{unknown}};
128 print "$colored $test->{name}\n";
134 pass => sub { scalar grep $_->{result} == $exit{pass}, @tested },
135 fail => sub { scalar grep $_->{result} == $exit{fail}, @tested },
136 skip => sub { scalar grep $_->{result} == $exit{skip}, @tested },
137 unknown => sub { scalar grep $_->{result} >= $exit{unknown}, @tested },
144 "${\scalar @tested} tests were run",
145 "${\$count->('pass')} PASS, ${\$count->('fail')} FAIL",
146 "${\$count->('skip')} SKIP, ${\$count->('unknown')} UNKNOWN",
148 my $len_longest = sub
151 foreach my $line (@lines) {
152 if (length $line > $_) {
165 print $count->('fail') || $count->('unknown')
166 ? colored($summary, 'red')
167 : colored($summary, 'green');
170 exit $count->('fail') + $count->('unknown');