From: Steve Hay <SteveHay@planit.com>
Date: Wed, 8 Mar 2006 15:20:28 +0000 (+0000)
Subject: Sort the ext/ and lib/ tests when running under t/harness
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b1d1c89dd4add0044d7fe8a24cce57e62c9c1d5c;p=p5sagit%2Fp5-mst-13.2.git

Sort the ext/ and lib/ tests when running under t/harness

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
---

diff --git a/t/harness b/t/harness
index b5e3e87..f52c441 100644
--- 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";
 	}