Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Test-Simple CPAN distribution.

Report information
The Basics
Id: 17298
Status: resolved
Priority: 0/
Queue: Test-Simple

People
Owner: Nobody in particular
Requestors: cpan [...] pjedwards.co.uk
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: 0.62
Fixed in: (no value)



Subject: Test::Simple 'reset.t' test case failures (2-14) on VMS, & patch.
Test::Simple 0.62 This is perl, v5.8.7 built for VMS_AXP Failed Test Stat Wstat Total Fail Failed List of Failed --------------------------------------------------------- t/reset.t 44 1024 14 26 185.71% 2-14 5 tests and 9 subtests skipped. Failed 1/63 test scripts, 98.41% okay. 13/478 subtests failed, 97.28% okay. t/reset................... Can't open test output log foo.tmp: file currently locked by another user at <removed>/TEST-SIMPLE-0_62/blib/lib/Test/Builder.pm line 1268. %SYSTEM-F-ABORT, abort dubious Test returned status 44 (wstat 1024, 0x400) (VMS status is 44) DIED. FAILED tests 2-14 Failed 13/14 tests, 7.14% okay Failures are due to VMS file system locking, when debugging these failures, VMS file system versioning can also come into play. Here are the lines I edited to fix these failures: ----- line 25 of reset.t (this is the cause of the failure) # These files were once one file, but due to OS's with file locking (VMS) I split them into 3 files. my $tmpfile_output = 'tmp_output.tmp'; my $tmpfile_failure_output = 'tmp_failure_output.tmp'; my $tmpfile_todo_output = 'tmp_todo_output.tmp'; $tb->output($tmpfile_output); $tb->failure_output($tmpfile_failure_output); $tb->todo_output($tmpfile_todo_output); END { 1 while unlink $tmpfile_output; 1 while unlink $tmpfile_failure_output; 1 while unlink $tmpfile_todo_output; } ----- line 40 of output.t (this change would help OS's with file versioning) change: END { unlink($tmpfile) } to: END { 1 while unlink $tmpfile } # Required for file systems with multiple versions, i.e. VMS ----- line 22 of is_fh.t (this change would help OS's with file versioning) change: END { close FILE; unlink 'foo' } to: END { close FILE; 1 while unlink 'foo' } # Required for file systems with multiple versions, i.e. VMS ----- Cheers, Peter (Stig) Edwards
On Thu Jan 26 12:38:11 2006, guest wrote: Show quoted text
> t/reset................... > Can't open test output log foo.tmp: file currently locked by another > user at <removed>/TEST-SIMPLE-0_62/blib/lib/Test/Builder.pm line 1268. > %SYSTEM-F-ABORT, abort > dubious
... Show quoted text
> Failures are due to VMS file system locking, when debugging these > failures, VMS file system versioning can also come into play.
Who's the "other user" that's locking that file? Not being able to send output to the same file is a problem. Does it fix the problem to just fix the tempfile cleanups so all versions get deleted?
From: cpan [...] pjedwards.co.uk
Show quoted text
> > > t/reset................... > > > Can't open test output log foo.tmp: file currently locked by another > > > user at <removed>/TEST-SIMPLE-0_62/blib/lib/Test/Builder.pm line 1268. > > > %SYSTEM-F-ABORT, abort > > > dubious
Show quoted text
> > Who's the "other user" that's locking that file?
Thanks for taking a look. There is no third man. It's a misleading message from Perl on VMS, it is the same user as the user running the test, the message in this case just means the OS can't create a file with the name foo.tmp in the 3rd call using this filename. These are the 3 calls. 1.) output(foo.tmp) 2.) failure_output(foo.tmp) 3.) todo_output(foo.tmp) The first call creates version 1 of the file foo.tmp, it's opened for write so on VMS this means a write lock is taken out by default until the FH is closed. From perlport - "Don't open the same file more than once at a time for writing, as some operating systems put mandatory locks on such files." The second call creates version 2 (because version 1 has a write lock) of the file foo.tmp, it's opened for write so on VMS this means a write lock is taken out by default until the file handle is closed. It's possible to set the default number of versions on a file and directory on the default VMS filesystem, for the Perl roots on our systems this is set to 2, this means that when a new file is created it has a max number of 2 versions, so... The third call attempts to create version 3 (because version 1 and 2 have yet to be closed and still have write locks) of the file foo.tmp, however because this file has a version limit of 2, it's this call that fails. Show quoted text
>> Not being able to send output to the same file is a problem.
If, instead of passing the filename in, a shared file handle was used then this would avoid the different versions of the file being created. I've tested the below, and it works: my $tmpfile = 'foo.tmp'; my $tmpfh; open $tmpfh, '>',$tmpfile or croak("Can't open test output log $tmpfile: $!"); $tb->output($tmpfh); $tb->failure_output($tmpfh); $tb->todo_output($tmpfh); END { 1 while unlink $tmpfile } Show quoted text
>> Does it >> fix the problem to just fix the tempfile cleanups so all versions get >> deleted?
No. Not cleaning up all the versions does not cause the problem, and cleaning up all the versions does not fix it. Cheers, Peter (Stig) Edwards In Italy under the Borgias they had 30 years of murder, bloodshed, warfare and produced indigestible pasta, boring operas, and the Fiat. In Switzerland, they had brotherly love, 500 years of democracy and peace, and what did they produce? The Swiss bank account, the best cheese in the world, and Heidi. (Pinky and the Brain - The Third Mouse)
I don't remember, did we fix this?
From: cpan [...] pjedwards.co.uk
It's not fixed in 0.74 (just looked at the code and tested). Here is the diff against 0.74 that I used to avoid the file lock. ==== t/reset.t#1 (xtext) - t/reset.t#2 (xtext) ==== content 27,29c27,32 < $tb->output($tmpfile); < $tb->failure_output($tmpfile); < $tb->todo_output($tmpfile); --- Show quoted text
> my $tmpfh; > open $tmpfh, '>',$tmpfile or croak("Can't open test output log
$tmpfile: $!"); Show quoted text
> > $tb->output($tmpfh); > $tb->failure_output($tmpfh); > $tb->todo_output($tmpfh);
On Fri Nov 30 04:14:44 2007, cpan@pjedwards.co.uk wrote: Show quoted text
> It's not fixed in 0.74 (just looked at the code and tested). > > Here is the diff against 0.74 that I used to avoid the file lock. > > ==== t/reset.t#1 (xtext) - t/reset.t#2 (xtext) ==== content > 27,29c27,32 > < $tb->output($tmpfile); > < $tb->failure_output($tmpfile); > < $tb->todo_output($tmpfile); > ---
> > my $tmpfh; > > open $tmpfh, '>',$tmpfile or croak("Can't open test output log
> $tmpfile: $!");
> > > > $tb->output($tmpfh); > > $tb->failure_output($tmpfh); > > $tb->todo_output($tmpfh);
I'm just in the process of upgrading to 0.86, I made the same changes as above to avoid the file lock on VMS: t/builder/reset.t 33,35c33,38 < $tb->output($tmpfile); < $tb->failure_output($tmpfile); < $tb->todo_output($tmpfile); --- Show quoted text
> my $tmpfh; > open $tmpfh, '>',$tmpfile or croak("Can't open test output log
$tmpfile: $!"); Show quoted text
> > $tb->output($tmpfh); > $tb->failure_output($tmpfh); > $tb->todo_output($tmpfh);
Ok, I've fixed it to just not use a temp file at all. You can give it a shot here. I expect no problems. http://github.com/schwern/test-more/tarball/master

Message body is not shown because it is too large.

Subject: Re: [rt.cpan.org #17298] Test::Simple 'reset.t' test case failures (2-14) on VMS, & patch.
Date: Thu, 02 Apr 2009 13:15:28 +0100
To: bug-Test-Simple [...] rt.cpan.org
From: Michael G Schwern <schwern [...] pobox.com>
Peter John Edwards via RT wrote: Show quoted text
> t/died.................................. > > # Failed test at t/died.t line 0. > # got: '# Looks like your test exited with 512 before it could > output anything. > # ' > # expected: '# Looks like your test exited with 250 before it could > output anything. > # ' > # Failed test 'exit code' > # at t/died.t line 0. > # got: '512' > # expected: '250' > %NONAME-E-NOMSG, Message number 00000002 > Dubious, test returned 2 (wstat 512, 0x200) > > Failed 2/3 subtests
Didn't touch that test at all, and it was introduced in 0.86. It's likely also broken in 0.86 and 0.87_01, could you check? Show quoted text
> t/exit.................................. > > # Failed test 'death.plx exited with 4 (expected 255)' > # at t/exit.t line 89. > # got: 4 > # expected: 255 > %SYSTEM-F-ABORT, abort > > # Failed test 'too_few.plx exited with 4 (expected 255)' > # at t/exit.t line 89. > # got: 4 > # expected: 255 > %SYSTEM-F-ABORT, abort
... Oh, I think I got the exit mapping logic backwards. Doesn't make any different on Unix because it's an identify function. Pull down the latest tarball please and see if that does it. Show quoted text
> t/pod-coverage.......................... > Subroutine Test::Builder::share redefined at <removed>TEST-SIMP > LE-0_87_01/blib/lib/test/builder.pm line 66. > Subroutine Test::Builder::lock redefined at <removed>TEST-SIMPL > E-0_87_01/blib/lib/test/builder.pm line 67.
Well that's awful. What's that all about? Do you get that from all Pod::Coverage tests on VMS?
Show quoted text
>> # Failed test 'exit code' >> # at t/died.t line 0. >> # got: '512' >> # expected: '250'
Show quoted text
> Didn't touch that test at all, and it was introduced in 0.86. It's
likely Show quoted text
> also broken in 0.86 and 0.87_01, could you check?
I can confirm the same behaviour in 0.86. Show quoted text
> Oh, I think I got the exit mapping logic backwards. Doesn't make any > different on Unix because it's an identify function.
After I posted I also noticed the exit mapping looked backwards, I swapped it, and it fixed some tests, but not all. I started to dig into it but got pulled onto something else. I also changed: << for my $exit (0..255) { << my $wait = system(qq[$Perl -e "exit $exit"]); << $Exit_Map{$exit} = exitstatus($wait); << } Show quoted text
>> for my $exit (0,1,2,5,255) { >> my $wait = system(qq[$Perl -e "exit $exit"]); >> my $os_exit = exitstatus($wait); >> $Exit_Map{$exit} = $os_exit; >> print "# $^O exit $exit returns $os_exit\n"; >> }
# Building up a map of exit codes. May take a while. # VMS exit 0 returns 0 # VMS exit 1 returns 4 # VMS exit 2 returns 2 # VMS exit 5 returns 0 # VMS exit 255 returns 0 # Done. to speed things up and help debug. Show quoted text
> Pull down the latest tarball please and see if that does it.
Just FYI, I have to pull the tarball down to linux and build the dist to ensure it does not contain a dir that is invalid on VMS ODS-3 (schwern-test-more-... exceeds 39 chars), so instead I'm GETing: http://github.com/schwern/test- more/raw/1c4bc8655fc5e4d20d55f9049414a3b6ed355df9/t/exit.t I think the expected exit code also needs to change, in is_num: << "(expected $exit_code)"); Show quoted text
>> "(expected ".$Exit_Map{exit_code}.")");
I also changed: << my $wait_stat = system(qq{$Perl -"I../blib/lib" -"I../lib" - "I../t/lib" $file}); Show quoted text
>> my $cmd = qq{$Perl -"I../blib/lib" -"I../lib" -"I../t/lib" $file}; >> print "# cmd = $cmd\n"; >> my $wait_stat = system($cmd);
everything was exiting with a 4, I think it might boil down to how assigning to $? behaves on VMS (in the context of -Mvmsish), vs calling exit. I've run out of time. Hopefully I'll find some more tonight. Show quoted text
> Well that's awful. What's that all about? Do you get that from all > Pod::Coverage tests on VMS?
Sorry, you can ignore the Pod::Coverage warnings.
Show quoted text
> I think it might boil down to how assigning > to $? behaves on VMS, vs calling exit.
The short version is, it's the difference between calling exit($n) and Assigning to $? in an END block (on VMS). These are the changes I made to get this to pass it's tests in a 'safe' and (hopefully) portable way. << for my $exit (0..255) { << my $wait = system(qq[$Perl -e "exit $exit"]); << $Exit_Map{$exit} = exitstatus($wait); << } Show quoted text
>> for my $exit (0,1,2,5,255) { >> my $q = ($^O eq 'VMS') ? q{"} : q{'}; >> my $cmd = $Perl . q[ -e ] . $q . q[use
English;END{$CHILD_ERROR=] . $exit . q[}] .$q; Show quoted text
>> my $wait = system($cmd); >> my $os_exit = exitstatus($wait); >> $Exit_Map{$exit} = $os_exit; >> print "# $^O exit=$exit wait=$wait os_exit=$os_exit\n"; >> }
I tested on Linux and VMS. I say 'safe' because it's staying within legacy POSIX emulation, just testing for successful completion, and not venturing into $?-on-VMS behaviour as outlined in: http://perldoc.perl.org/perlvms.html#Perl-variables There is also this change: << $TB->is_num( $actual_exit, $Exit_Map{$exit_code}, << "$test_name exited with $actual_exit ". << "(expected $exit_code)"); Show quoted text
>> $TB->is_num( $actual_exit, $Exit_Map{$exit_code}, >> "$test_name exited with $actual_exit ". >> "(expected ".$Exit_Map{$exit_code}.")");
Cheers.
Somehow wires got crossed. This is all part of #42148. Anyhow, can I get an executive summary of all that? Also, the Pod::Coverage warnings do concern me. I'd rather not have a huge stack of warnings being spewed out of my test. Is that a general Pod::Coverage problem on VMS? Has it been reported? Please reply on the 42148 ticket.
On Thu Apr 02 18:15:59 2009, MSCHWERN wrote: Show quoted text
> Somehow wires got crossed. This is all part of #42148. > > Anyhow, can I get an executive summary of all that? > > Also, the Pod::Coverage warnings do concern me. I'd rather not have a > huge stack of warnings being spewed out of my test. Is that a general > Pod::Coverage problem on VMS? Has it been reported? > > Please reply on the 42148 ticket.
Closing this ticket, last I heard vms passes fine on the latest versions.