From bedcea37ccf14885800686e4ae4a9ad652083076 Mon Sep 17 00:00:00 2001 From: Ed J Date: Tue, 19 Nov 2024 10:47:03 +0000 Subject: [PATCH] use File::Temp not rely on END block --- Basic/t/ppt-11_memory_mapped.t | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Basic/t/ppt-11_memory_mapped.t b/Basic/t/ppt-11_memory_mapped.t index 9c8eabddc..a58a37491 100644 --- a/Basic/t/ppt-11_memory_mapped.t +++ b/Basic/t/ppt-11_memory_mapped.t @@ -13,11 +13,16 @@ use threads; use PDL::LiteF; use PDL::Parallel::threads qw(retrieve_pdls); use PDL::IO::FastRaw; +use File::Temp qw(tempdir); +use File::Spec::Functions; use Test::More; +my $tmpdir = tempdir( CLEANUP=>1 ); +my $name = catfile($tmpdir, "foo.dat"); + my $N_threads = 10; -mapfraw('foo.dat', {Creat => 1, Dims => [$N_threads], Datatype => double}) +mapfraw($name, {Creat => 1, Dims => [$N_threads], Datatype => double}) ->share_as('workspace'); # Spawn a bunch of threads that do the work for us @@ -37,9 +42,4 @@ my $expected = (sequence($N_threads) + 1)->sqrt; my $workspace = retrieve_pdls('workspace'); ok(all($expected == $workspace), 'Sharing memory mapped ndarrays works'); -END { - # Clean up the testing files - unlink $_ for qw(foo.dat foo.dat.hdr); -} - done_testing;