]> sjero.net Git - wget/blobdiff - tests/run-px
--restrict-file-names=ascii
[wget] / tests / run-px
index 05f6eda65de2d7555fcd9bef6f41738cf5bd9e70..17a52cdffc9b088008e616c12110c3f7822a602a 100755 (executable)
@@ -1,12 +1,19 @@
 #!/usr/bin/env perl
-use warnings;
+
+use 5.006;
 use strict;
+use warnings;
+
+use Term::ANSIColor ':constants';
+$Term::ANSIColor::AUTORESET = 1;
 
 die "Please specify the top source directory.\n" if (!@ARGV);
 my $top_srcdir = shift @ARGV;
 
 my @tests = (
     'Test-auth-basic.px',
+    'Test-auth-no-challenge.px',
+    'Test-auth-no-challenge-url.px',
     'Test-proxy-auth-basic.px',
     'Test-proxied-https-auth.px',
     'Test-N-HTTP-Content-Disposition.px',
@@ -18,9 +25,23 @@ my @tests = (
     'Test-E-k-K.px',
     'Test-E-k.px',
     'Test-ftp.px',
+    'Test-ftp-iri.px',
+    'Test-ftp-iri-fallback.px',
+    'Test-ftp-iri-recursive.px',
+    'Test-ftp-iri-disabled.px',
     'Test-HTTP-Content-Disposition-1.px',
     'Test-HTTP-Content-Disposition-2.px',
     'Test-HTTP-Content-Disposition.px',
+    'Test-idn-headers.px',
+    'Test-idn-meta.px',
+    'Test-idn-cmd.px',
+    'Test-idn-robots.px',
+    'Test-iri.px',
+    'Test-iri-percent.px',
+    'Test-iri-disabled.px',
+    'Test-iri-forced-remote.px',
+    'Test-iri-list.px',
+    'Test-meta-robots.px',
     'Test-N-current.px',
     'Test-N-smaller.px',
     'Test-N-no-info.px',
@@ -39,6 +60,7 @@ my @tests = (
     'Test-O-nonexisting.px',
     'Test-O.px',
     'Test-O-nc.px',
+    'Test-restrict-ascii.px',
     'Test-Restrict-Lowercase.px',
     'Test-Restrict-Uppercase.px',
     'Test--spider-fail.px',
@@ -48,26 +70,64 @@ my @tests = (
     'Test--spider-r.px',
 );
 
-my @results;
+foreach my $var (qw(SYSTEM_WGETRC WGETRC)) {
+    $ENV{$var} = '/dev/null';
+}
+
+my @tested;
 
-for my $test (@tests) {
+foreach my $test (@tests) {
     print "Running $test\n\n";
-    system("$top_srcdir/tests/$test");
-    push @results, $?;
+    system("$^X -I$top_srcdir/tests $top_srcdir/tests/$test $top_srcdir");
+    push @tested, { name => $test, result => $? };
 }
 
-for (my $i=0; $i != @tests; ++$i) {
-    if ($results[$i] == 0) {
-        print "pass: ";
-    } else {
-        print "FAIL: ";
-    }
-    print "$tests[$i]\n";
+foreach my $var (qw(SYSTEM_WGETRC WGETRC)) {
+    delete $ENV{$var};
 }
 
 print "\n";
-print scalar(@results) . " tests were run\n";
-print scalar(grep $_ == 0, @results) . " PASS\n";
-print scalar(grep $_ != 0, @results) . " FAIL\n";
+foreach my $test (@tested) {
+    ($test->{result} == 0)
+      ? print GREEN 'pass: '
+      : print RED 'FAIL: ';
+   print $test->{name}, "\n";
+}
+
+my $count = sub
+{
+    return {
+      pass => sub { scalar grep $_->{result} == 0, @tested },
+      fail => sub { scalar grep $_->{result} != 0, @tested },
+    }->{$_[0]}->();
+};
+
+my $summary = sub
+{
+    my @lines = (
+        "${\scalar @tested} tests were run",
+        "${\$count->('pass')} PASS, ${\$count->('fail')} FAIL",
+    );
+    my $len_longest = sub
+    {
+        local $_ = 0;
+        foreach my $line (@lines) {
+            if (length $line > $_) {
+                $_ = length $line;
+            }
+        }
+        return $_;
+    }->();
+    return join "\n",
+      '=' x $len_longest,
+      @lines,
+      '=' x $len_longest;
+}->();
+
+print "\n";
+print $count->('fail')
+  ? RED $summary
+  : GREEN $summary;
+print "\n";
 
-exit scalar (grep $_ != 0, @results);
+exit $count->('fail');