This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Sort the ext/ and lib/ tests when running under t/harness
authorSteve Hay <SteveHay@planit.com>
Wed, 8 Mar 2006 15:20:28 +0000 (15:20 +0000)
committerSteve Hay <SteveHay@planit.com>
Wed, 8 Mar 2006 15:20:28 +0000 (15:20 +0000)
Unless they are sorted then they are run in the same order in which
they are listed in MANIFEST, which is not always ideal. In particular,
the ext/Compress/IO/Zlib/t/*.t tests are not run in the correct order,
which causes some files to be left behind afterwards.

ExtUtils::Command::MM::test_harness() sorts test files, so it seems
sensible for t/harness to do likewise, rather than relying on the
ordering in MANIFEST.

p4raw-id: //depot/perl@27420

t/harness

index b5e3e87..f52c441 100644 (file)
--- a/t/harness
+++ b/t/harness
@@ -96,6 +96,7 @@ if (@ARGV) {
        my $updir = File::Spec->updir;
        my $mani  = File::Spec->catfile(File::Spec->updir, "MANIFEST");
        if (open(MANI, $mani)) {
+           my @manitests = ();
            while (<MANI>) { # similar code in t/TEST
                if (m!^(ext/(\S+)/+(?:[^/\s]+\.t|test\.pl)|lib/\S+?(?:\.t|test\.pl))\s!) {
                    my ($test, $extension) = ($1, $2);
@@ -104,10 +105,13 @@ if (@ARGV) {
                        # XXX Do I want to warn that I'm skipping these?
                        next if $skip{$extension};
                    }
-                   push @tests, File::Spec->catfile($updir, $test);
+                   push @manitests, File::Spec->catfile($updir, $test);
                }
            }
            close MANI;
+           # Sort the list of test files read from MANIFEST into a sensible
+           # order instead of using the order in which they are listed there
+           push @tests, sort { lc $a cmp lc $b } @manitests;
        } else {
            warn "$0: cannot open $mani: $!\n";
        }