Commit e5965669fe for perl
commit e5965669fe01ea7a35d4cc5ebdad73901f985224
Author: James E Keenan <jamesekeenan@yahoo.com>
Date: Thu Oct 8 20:54:49 2026 -0400
Reactivate (simpler) t/porting/test_testlist.t
At this point, we're comparing the manifested tests found by t/TEST to
match all the tests found by t/harness. We have not yet implemented
testing of generated tests in t/harness, so we're not yet concerned with
the number or identity of generated tests found by t/TEST.
diff --git a/t/harness b/t/harness
index 0cde318d7f..b469cb63a1 100644
--- a/t/harness
+++ b/t/harness
@@ -423,6 +423,12 @@ for (@tests) {
}
# dump_tests() is defined in t/TEST
+# Assuming that no individual tests have been passed on the command-line as
+# arguments to t/harness, the number of tests dumped below via
+# ./perl -lib t/harness -dump_tests
+# should be equal to the number of "manifested tests" dumped via
+# ./perl -Ilib t/TEST -dump_manifested_tests
+
dump_tests(\@tests) if $dump_tests;
# filter_taint_tests() is defined in t/TEST
diff --git a/t/porting/test_testlist.t b/t/porting/test_testlist.t
index ae6859a59d..d99675f8f2 100644
--- a/t/porting/test_testlist.t
+++ b/t/porting/test_testlist.t
@@ -15,81 +15,146 @@ use warnings;
# tell us if one of the files does not know about it.
#plan tests => 3;
-plan skip_all => "pending revision of t/harness";
+#plan skip_all => "pending revision of t/harness";
my (%th, %tt, %all);
$ENV{PERL_TORTURE_TEST} = 1;
$ENV{PERL_TEST_MEMORY} = 1;
$ENV{PERL_BENCHMARK} = 1;
-for my $file (`"$^X" t/harness -dump_manifested_tests`) {
+# ./perl -lib t/harness -dump_tests
+# should be equal to the number of "manifested tests" dumped via
+# ./perl -Ilib t/TEST -dump_manifested_tests
+
+#for my $file (`"$^X" t/TEST -dump_manifested_tests`) {
+# chomp $file;
+# $all{$file}++;
+# delete $th{$file} or $tt{$file}++;
+#}
+#
+#for my $file (`"$^X" t/harness -dump_tests`) {
+# chomp $file;
+# $all{$file}++;
+# $th{$file}++;
+#}
+#
+#is(0+keys(%th), 0, "t/harness will not test anything that t/TEST does not")
+# or print STDERR map { "# t/harness: $_\n" } sort keys %th;
+#is(0+keys(%tt), 0, "t/TEST will not test anything that t/harness does not")
+# or print STDERR map { "# t/TEST: $_\n" } sort keys %tt;
+
+for my $file (`"$^X" t/TEST -dump_manifested_tests`) {
chomp $file;
$all{$file}++;
- $th{$file}++;
+ $tt{$file}++;
}
-for my $file (`"$^X" t/TEST -dump_manifested_tests`) {
+for my $file (`"$^X" t/harness -dump_tests`) {
chomp $file;
$all{$file}++;
- delete $th{$file} or $tt{$file}++;
+ $th{$file}++;
}
-is(0+keys(%th), 0, "t/harness will not test anything that t/TEST does not")
- or print STDERR map { "# t/harness: $_\n" } sort keys %th;
-is(0+keys(%tt), 0, "t/TEST will not test anything that t/harness does not")
- or print STDERR map { "# t/TEST: $_\n" } sort keys %tt;
-
-sub get_extensions {
- my %extensions;
- open my $ifh, "<", "config.sh"
- or die "Failed to open 'config.sh': $!";
- while (<$ifh>) {
- if (/^extensions='([^']+)'/) {
- my $list = $1;
- NAME:
- foreach my $name (split /\s+/, $list) {
- $name = "PathTools" if $name eq "Cwd";
- $name = "Scalar/List/Utils" if $name eq "List/Util";
- my $sub_dir = $name;
- $sub_dir =~ s!/!-!g unless $sub_dir =~ /^Encode/;
- foreach my $dir (qw(cpan dist ext)) {
- if (-e "$dir/$sub_dir") {
- $extensions{"$dir/$sub_dir"} = $name;
- next NAME;
- }
- }
- die "Could not find '$name'\n";
- }
- last;
- }
+cmp_ok(scalar keys %tt, '==', scalar keys %th,
+ "Count of manifested test files found by t/TEST matches count of test files found by t/harness");
+my (@missing_from_th, @missing_from_tt);
+for my $k (keys %th) {
+ unless ($tt{$k}) {
+ push @missing_from_tt, $k;
}
- close $ifh;
- return \%extensions;
}
+is(scalar @missing_from_th, 0,
+ "No files found by t/TEST missing from t/harness");
-sub find_in_manifest_but_missing {
- my $extension = get_extensions();
- my %missing;
- my $is_os2 = $^O eq "os2";
- my $is_win32 = $^O eq "MSWin32";
- open my $ifh, "<", "MANIFEST"
- or die "Failed to open 'MANIFEST' for read: $!";
- while (<$ifh>) {
- chomp;
- my ($file, $descr) = split /\t+/, $_;
- next if $file eq "t/test.pl"
- or $file!~m!(?:\.t|/test\.pl)\z!
- or (!$is_os2 and $file=~m!^(?:t/)?os2/!)
- or (!$is_win32 and $file=~m!^(?:t/)?win32/!);
- if ($file=~m!^(cpan|dist|ext/[^/]+)!) {
- my $path = $1;
- next unless $extension->{$path};
- }
- $missing{$file}++ unless $all{$file};
+for my $k (keys %tt) {
+ unless ($th{$k}) {
+ push @missing_from_th, $k;
}
- close $ifh;
- return \%missing;
}
-my $missing = find_in_manifest_but_missing();
-is(0+keys(%$missing), 0, "Nothing in manifest that we wouldn't test")
- or print STDERR map { "# $_\n" } sort keys %$missing;
+is(scalar @missing_from_tt, 0,
+ "No files found by t/harness missing from t/TEST");
+
+
+#use Data::Dumper;
+#print STDERR Dumper [ sort keys %tt ]; print "\n";
+#print STDERR scalar keys %tt, "\n";
+#print STDERR Dumper [ sort keys %th ]; print "\n";
+#print STDERR scalar keys %th, "\n";
+
+#my (%ttonly, %thonly, %both);
+#%ttonly = map { ! $th{$_} } keys %tt;
+#for my $k (keys %tt) {
+# $ttonly{$k}++ unless $th{$k};
+#}
+#print STDERR "TT only: ", scalar keys %ttonly, "\n";
+#print STDERR Dumper \%ttonly;
+#
+#for my $k (keys %th) {
+# $thonly{$k}++ unless $tt{$k};
+#}
+#print STDERR "TH only: ", scalar keys %thonly, "\n";
+#print STDERR Dumper \%thonly;
+#
+##%both = map { ! $th{$_} and ! $tt{$_} } keys %both;
+##print STDERR "BOTH: ", scalar keys %both, "\n";
+
+#my $missing = find_in_manifest_but_missing();
+#is(0+keys(%$missing), 0, "Nothing in manifest that we wouldn't test")
+# or print STDERR map { "# $_\n" } sort keys %$missing;
+
+done_testing();
+
+##### SUBROUTINES #####
+
+#sub get_extensions {
+# my %extensions;
+# open my $ifh, "<", "config.sh"
+# or die "Failed to open 'config.sh': $!";
+# while (<$ifh>) {
+# if (/^extensions='([^']+)'/) {
+# my $list = $1;
+# NAME:
+# foreach my $name (split /\s+/, $list) {
+# $name = "PathTools" if $name eq "Cwd";
+# $name = "Scalar/List/Utils" if $name eq "List/Util";
+# my $sub_dir = $name;
+# $sub_dir =~ s!/!-!g unless $sub_dir =~ /^Encode/;
+# foreach my $dir (qw(cpan dist ext)) {
+# if (-e "$dir/$sub_dir") {
+# $extensions{"$dir/$sub_dir"} = $name;
+# next NAME;
+# }
+# }
+# die "Could not find '$name'\n";
+# }
+# last;
+# }
+# }
+# close $ifh;
+# return \%extensions;
+#}
+#
+#sub find_in_manifest_but_missing {
+# my $extension = get_extensions();
+# my %missing;
+# my $is_os2 = $^O eq "os2";
+# my $is_win32 = $^O eq "MSWin32";
+# open my $ifh, "<", "MANIFEST"
+# or die "Failed to open 'MANIFEST' for read: $!";
+# while (<$ifh>) {
+# chomp;
+# my ($file, $descr) = split /\t+/, $_;
+# next if $file eq "t/test.pl"
+# or $file!~m!(?:\.t|/test\.pl)\z!
+# or (!$is_os2 and $file=~m!^(?:t/)?os2/!)
+# or (!$is_win32 and $file=~m!^(?:t/)?win32/!);
+# if ($file=~m!^(cpan|dist|ext/[^/]+)!) {
+# my $path = $1;
+# next unless $extension->{$path};
+# }
+# $missing{$file}++ unless $all{$file};
+# }
+# close $ifh;
+# return \%missing;
+#}
+