Skip Menu |

This queue is for tickets about the File-Slurp CPAN distribution.

Report information
The Basics
Id: 88968
Status: resolved
Priority: 0/
Queue: File-Slurp

People
Owner: cwhitener [...] gmail.com
Requestors: ribasushi [...] leporine.io
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: Tests are not parallel-safe ( random failures under HARNESS_OPTIONS=j{x>1} )
Random example: Running make test PERL_DL_NONLAZY=1 /home/travis/perl5/perlbrew/perls/5.12.4/bin/perl "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/pod.t ............... skipped: Test::Pod 1.14 required for testing POD t/append_null.t ....... ok t/chomp.t ............. ok t/binmode.t ........... ok t/data_list.t ......... ok t/data_scalar.t ....... ok t/inode.t ............. ok read_file 'edit_file_data' - sysopen: No such file or directory at t/edit_file.t line 83. # Looks like you planned 5 tests but ran 3. # Looks like your test exited with 2 just after 3. t/edit_file.t ......... Dubious, test returned 2 (wstat 512, 0x200) Failed 2/5 subtests t/file_object.t ....... ok t/no_clobber.t ........ ok t/pod_coverage.t ...... skipped: Test::Pod::Coverage 1.04 required for testing POD coverage t/error_mode.t ........ ok t/newline.t ........... ok t/error.t ............. ok t/original.t .......... ok t/perms.t ............. ok t/prepend_file.t ...... ok t/pseudo.t ............ ok t/read_dir.t .......... ok t/slurp.t ............. ok t/write_file_win32.t .. ok t/handle.t ............ ok t/paragraph.t ......... ok t/stdin.t ............. ok t/stringify.t ......... ok t/tainted.t ........... ok t/large.t ............. ok t/signal.t ............ ok
If this distribution is intended to still be in common use, this needs to get fixed. It is getting in the way of many automatic installation systems, requiring manual intervention.
I believe the problem is that two tests try to access a temporary file of the same name. For example, tests chomp.t and edit_file.t both access a temporary file named "edit_file_data". Both tests create this file, read it, then delete it. If these two tests are run in parallel, it is possible that one test deletes the temporary file just before the other test tries to read it, resulting in the reported error message. Other tests also access common temporary files ("xxx" and "slurp.data"). The solution is to make sure all tests create uniquely named temporary files. Patches are included for these four test files: chomp.t no_clobber.t paragraph.t slurp.t
Subject: diff-chomp.txt
--- t/chomp.t 2015-09-11 10:41:18.616762000 -0400 +++ ../File-Slurp-9999.19.orig/t/chomp.t 2011-05-05 01:29:39.000000000 -0400 @@ -9,7 +9,7 @@ use TestDriver ; -my $file = 'chomp_file_data' ; +my $file = 'edit_file_data' ; my $existing_data = <<PRE ; line 1
Subject: diff-noc.txt
--- t/no_clobber.t 2015-09-11 10:44:08.105884000 -0400 +++ ../File-Slurp-9999.19.orig/t/no_clobber.t 2009-04-30 20:15:00.000000000 -0400 @@ -11,7 +11,7 @@ more text TEXT -my $file = 'xxx2' ; +my $file = 'xxx' ; unlink $file ;
Subject: diff-par.txt
--- t/paragraph.t 2015-09-11 10:42:05.192249000 -0400 +++ ../File-Slurp-9999.19.orig/t/paragraph.t 2009-04-30 20:15:16.000000000 -0400 @@ -7,7 +7,7 @@ use Carp ; -my $file = 'paragraph_file_data' ; +my $file = 'slurp.data' ; unlink $file ; my @text_data = (
Subject: diff-slurp.txt
--- t/slurp.t 2015-09-11 10:43:58.553982000 -0400 +++ ../File-Slurp-9999.19.orig/t/slurp.t 2011-03-27 00:45:18.000000000 -0400 @@ -10,7 +10,7 @@ more text TEXT -my $file = 'xxx3' ; +my $file = 'xxx' ; write_file( $file, $data ) ; my $read_buf = slurp( $file ) ;
On 2015-09-11 10:57:56, GSULLIVAN wrote: Show quoted text
> I believe the problem is that two tests try to access a temporary file > of the > same name. For example, tests chomp.t and edit_file.t both access > a temporary file named "edit_file_data". Both tests create this file, > read it, then delete it. If these two tests are run in parallel, > it is possible that one test deletes the temporary file just before > the > other test tries to read it, resulting in the reported error message. > > Other tests also access common temporary files ("xxx" and > "slurp.data"). > > The solution is to make sure all tests create uniquely named temporary > files. > Patches are included for these four test files: > > chomp.t > no_clobber.t > paragraph.t > slurp.t
It looks like the patch is reversed.
Yep, I botched the file order, but the changes are trivial for whoever will make them (it may even be me, if granted comaint).
Hi Everyone, We've completely overhauled the test suite and it should now be parallel-safe as it uses proper temp files and we have our CI running tests in parallel (and passing). Version 9999.20_02 is out there. Please let us know if any further issues crop up. Thanks again! Chase