Skip to content

Commit

Permalink
use File::Temp not rely on END block
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed Nov 19, 2024
1 parent 77ee0f5 commit bedcea3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Basic/t/ppt-11_memory_mapped.t
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;

0 comments on commit bedcea3

Please sign in to comment.