Skip to content

Commit

Permalink
Don't retain 'storable-testfile-*' after completion of testing
Browse files Browse the repository at this point in the history
When run in Perl core, make test was leaving 109 files in /tmp.  The two
changes in this patch cleaned up 103 and 6 files, respectively.

Account for test failure on Windows.

The 'unlink' statement at line 284 in blead dates from 2002 and was not
altered during recent refactoring of Storable.  CI testing suggests it
is now superflous and can be removed without causing test failures on
Linux or Windows.

For: GH #22502
  • Loading branch information
jkeenan committed Aug 12, 2024
1 parent 0c81a5c commit c2cb8f9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
4 changes: 2 additions & 2 deletions dist/Storable/t/lib/STTestLib.pm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ sub slurp {
sub write_and_retrieve {
my $data = shift;

my ($fh, $filename) = tempfile('storable-testfile-XXXXX', TMPDIR => 1);
my ($fh, $filename) = tempfile('storable-testfile-XXXXX', TMPDIR => 1, UNLINK => 1);
binmode $fh;
print $fh $data or die "Can't print to '$filename': $!";
close $fh or die "Can't close '$filename': $!";
Expand All @@ -32,7 +32,7 @@ sub write_and_retrieve {

sub tempfilename {
local $^W;
my (undef, $file) = tempfile('storable-testfile-XXXXX', TMPDIR => 1, UNLINK => 1, OPEN => 0);
my (undef, $file) = tempfile('storable-testfile-XXXXX', TMPDIR => 1, UNLINK => 1);
return $file;
}

Expand Down
3 changes: 0 additions & 3 deletions dist/Storable/t/malice.t
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,6 @@ test_things($contents, \&write_and_retrieve, 'file');
my $stored = freeze \%hash;
test_things($stored, sub { eval { thaw $_[0] } }, 'string');

# Network order.
unlink $file or die "Can't unlink '$file': $!";

ok (defined nstore(\%hash, $file), "nstore() returned defined value");

$expected = 20 + length ($file_magic_str) + $network_magic + $fancy;
Expand Down

0 comments on commit c2cb8f9

Please sign in to comment.