diff options
author | David Mitchell <davem@iabyn.com> | 2014-12-03 10:53:00 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2014-12-03 10:53:00 +0000 |
commit | c6eacdc3acc965cb069ded02e066d3c00e9385df (patch) | |
tree | 2f87a4ef60b8759702678d6cb5c3654f228a62a6 /dist/Thread-Queue | |
parent | 1037353b7e5ab2b2522d601c33d3c548ab4cd100 (diff) | |
download | perl-c6eacdc3acc965cb069ded02e066d3c00e9385df.tar.gz |
Stop test suite filling /tmp
Some test files use File::Temp in such a way that the temporary files and
directories under /tmp aren't deleted at the end. On a smoker system, this
can gradually accumulate thousands of entries under /tmp.
The general culprits fixed by this commit are:
1) using tempfile() without the UNLINK => 1 argument;
2) Using Test::More (which uses Test::Stream), which creates a test
directory in such a way that only the original parent thread will
remove it; for some reason I still don't fully understand, detaching a
thread rather than joining it stops this clean up happening. In the
affected test files, I replaced the ->detach() with a ->join() just
before exit, and the problem went away.
Some tests under cpan/ are still leaky; these will be addressed upstream.
Diffstat (limited to 'dist/Thread-Queue')
-rw-r--r-- | dist/Thread-Queue/t/07_lock.t | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/dist/Thread-Queue/t/07_lock.t b/dist/Thread-Queue/t/07_lock.t index f9e258e092..0af2db1629 100644 --- a/dist/Thread-Queue/t/07_lock.t +++ b/dist/Thread-Queue/t/07_lock.t @@ -29,7 +29,7 @@ ok($q, 'New queue'); my $sm = Thread::Semaphore->new(0); my $st = Thread::Semaphore->new(0); -threads->create(sub { +my $thread = threads->create(sub { { lock($q); $sm->up(); @@ -39,7 +39,7 @@ threads->create(sub { my @x = $q->extract(5,2); is_deeply(\@x, [6,7], 'Thread dequeues under lock'); } -})->detach(); +}); $sm->down(); $st->up(); @@ -47,6 +47,8 @@ my @x = $q->dequeue_nb(100); is_deeply(\@x, [1..5,8..10], 'Main dequeues'); threads::yield(); +$thread->join; + exit(0); # EOF |