Commit ae2c838b12 for perl
commit ae2c838b1201fd3b5367169eef54f085f06af78f
Author: James E Keenan <jamesekeenan@yahoo.com>
Date: Thu Oct 8 09:12:39 2026 -0400
Corrections to t/TEST only
Leaving t/harness unchanged.
In t/harness, to change @manifested_tests (back) to @tests (making
similar changes to dump_manifested_tests) causes test failures in
t/porting/test_testlist.t.
So this commit makes changes in t/TEST suggested during code review but,
for the time being, leaves t/harness untouched.
On the one hand, that enables t/porting/test_testlist.t to PASS. It
also keeps the generated tests from running when you are running
t/porting/test_testlist.t
On the other hand, it means that certain identifiers within t/harness
are misleadingly named. As Tony pointed out in code review, the list of
tests accumulated during t/harness are not gleaned from the MANIFEST
and, hence, do not really qualify as "manifested" tests.
During development of GH #24918 I was trying to leave
t/porting/test_testlist.t as untouched as possible. That was because
that test program, introduced in 2023, had as its objective:
# Test that t/TEST and t/harness test the same files, and that all the
# test files (.t files) listed in MANIFEST are tested by both.
To achieve that objective, test_testlist.t relies on the assumption that
each of t/TEST and t/harness have a command-line switch named
`-dumptests` that will produced the same results.
diff --git a/t/TEST b/t/TEST
index 3b26adbd5b..d94fa4a992 100755
--- a/t/TEST
+++ b/t/TEST
@@ -220,7 +220,7 @@ sub _find_files {
push @found, $fullpath;
}
}
- closedir $DIRH, $dir or die "Trouble closing $dir: $!";
+ closedir $DIRH or die "Trouble closing $dir: $!";
}
return @found;
}
@@ -450,7 +450,7 @@ sub _tests_from_manifest {
my %non_ext;
push @results, \%non_ext if $all;
my $mani = '../MANIFEST';
- if (open($MANI, '<', $mani)) {
+ if (open(my $MANI, '<', $mani)) {
while (<$MANI>) {
chomp;
my ($file)= split /\t/, $_;
@@ -587,8 +587,8 @@ unless (@XARGV) {
my $configsh = '../config.sh';
my ($extensions, $known_extensions);
if (-f $configsh) {
- open FH, $configsh or die "Can't open $configsh: $!";
- while (<FH>) {
+ open my $FH, '<', $configsh or die "Can't open $configsh: $!";
+ while (<$FH>) {
if (/^extensions=['"](.*)['"]$/) {
$extensions = $1;
}
@@ -596,6 +596,7 @@ unless (@XARGV) {
$known_extensions = $1;
}
}
+ close $FH or die;
if (!defined $known_extensions) {
warn "No known_extensions line found in $configsh";
}
@@ -668,25 +669,25 @@ elsif ($::with_utf16) {
for my $e (0, 1) {
for my $b (0, 1) {
print STDERR "# ENDIAN $e BOM $b\n";
- my @UZZZZ;
+ my @UARGV;
for my $a (@XARGV) {
my $u = $a . "." . ($e ? "l" : "b") . "e" . ($b ? "b" : "");
my $f = $e ? "v" : "n";
- push @UZZZZ, $u;
+ push @UARGV, $u;
unlink($u);
- if (open(A, $a)) {
- if (open(U, ">$u")) {
- print U pack("$f", 0xFEFF) if $b;
- while (<A>) {
- print U pack("$f*", unpack("C*", $_));
+ if (open(my $A, '<', $a)) {
+ if (open(my $U, '>', $u)) {
+ print $U pack("$f", 0xFEFF) if $b;
+ while (<$A>) {
+ print $U pack("$f*", unpack("C*", $_));
}
- close(U);
+ close($U);
}
- close(A);
+ close($A);
}
}
- _testprogs('perl', '', @UZZZZ);
- unlink(@UZZZZ);
+ _testprogs('perl', '', @UARGV);
+ unlink(@UARGV);
}
}
}
@@ -1029,7 +1030,7 @@ sub gather_conf_platform_info {
$conf{$_} = $Config::Config{$_} for
grep /cc|git|config_arg\d+/, keys %Config::Config;
if (-f '/proc/cpuinfo') {
- open my $fh, '/proc/cpuinfo' or warn "$!: /proc/cpuinfo\n";
+ open my $fh, '<', '/proc/cpuinfo' or warn "$!: /proc/cpuinfo\n";
@platform = grep /name|cpu/, <$fh>;
chomp $_ for @platform;
}
@@ -1056,9 +1057,9 @@ sub _check_valgrind {
$$toolnm =~ s|.*/||; # keep basename
my @valgrind; # gets content of file
if (-e $Valgrind_Log) {
- if (open(V, $Valgrind_Log)) {
- @valgrind = <V>;
- close V;
+ if (open(my $V, '<', $Valgrind_Log)) {
+ @valgrind = <$V>;
+ close $V;
}
else {
warn "$0: Failed to open '$Valgrind_Log': $!\n";