Re: regression test filesystem assumptions
"Craig A. Berry" <[email protected]> Wed, 07 Aug 2013 22:03:17 -0500
| Newsgroups | gmane.comp.lang.perl.ports.vms |
|---|---|
| Message-ID | <[email protected]> |
On Aug 7, 2013, at 12:23 PM, Nicholas Clark <[email protected]> wrote: > I have this commit pushed to a smoke-me branch. It doesn't cause any = test > failures on the HP VMS testdrive system. Am I making bad assumptions? >=20 > Specifically, is it filesystem dependant whether this code as-is will = pass? >=20 > open(H,'run/fresh_perl.t'); # must be in the 't' directory > stat(H); > print "ok\n" if (-e _ and -f _ and -r _); >=20 I can't think of any reason that would be different on different = filesystems. > I infer that it must have failed 12 years ago, because the last line = was > "corrected" to >=20 > print "ok\n" if (-e _ and -f _); >=20 >=20 > But what changed to cause it to work now? >=20 There have been various fixes to stat as well as to Perl_cando_by_name = in vms/vms.c. None I've managed to stumble on in the archives pops out = as obviously "the one," and it would be arduous to do a manual bisect = without git. >=20 > Nicholas Clark >=20 >=20 > commit 219b23a016e4d19b9fc29d2cb6aad7c8f485e7bc > Author: Nicholas Clark <[email protected]> > Date: Wed Aug 7 11:57:09 2013 +0200 >=20 > Remove the two "VMS adjustments" from test.pl's _fresh_perl >=20 > These were added by commit ed6b3797850720f7 ("make t/op/misc.t work = on VMS") > in Jan 2001 back when the relevant code was in t/op/misc.t >=20 > The two adjustments each only applied to one test. >=20 > Was: system './perl -ne "print if eof" /dev/null' > Became: system './perl -ne "print if eof" NL:' >=20 > Was: print "ok\n" if (-e _ and -f _ and -r _); > Became: print "ok\n" if (-e _ and -f _); >=20 > The latter had the comment "VMS file locking". >=20 > It seems that neither is needed now. Perl will recognise = "/dev/null" as > the null device, and -r returns true on a file opened for reading. >=20 > The "adjustments", particularly the second, should have been done = all along > in the code for the test itself, not by complicating the test = runner. >=20 > diff --git a/t/test.pl b/t/test.pl > index 89c1d4d..3662aa6 100644 > --- a/t/test.pl > +++ b/t/test.pl > @@ -848,16 +848,6 @@ sub _fresh_perl { > $runperl_args->{stderr} =3D 1 unless exists = $runperl_args->{stderr}; >=20 > open TEST, ">$tmpfile" or die "Cannot open $tmpfile: $!"; > - > - # VMS adjustments > - if( $is_vms ) { > - $prog =3D~ s#/dev/null#NL:#; > - > - # VMS file locking > - $prog =3D~ s{if \(-e _ and -f _ and -r _\)} > - {if (-e _ and -f _)} > - } > - > print TEST $prog; > close TEST or die "Cannot close $tmpfile: $!"; >=20 I think these changes are sane. Once upon a time, the CRTL did not = support /dev/null as an alias for the native _NLA0:. I forget when = /dev/null became supported; possibly v7.0, which was about 1995 or so. = I remember Chuck Lane, who wrote the misc.t patch, saying at some point = that he was running v6.2, which was already somewhat old at the time. I = explicitly removed support for pre-7.0 VMS systems in Perl 5.16.x, so = the /dev/null workaround seems safe to remove. I think I disagree about whether these belonged in the test runner; that = actually was the general place to solve a general problem, even if there = weren't other extant tests that exercised the problem. But those = problems don't seem to be there now, so thanks for cleaning up after us. ________________________________________ Craig A. Berry mailto:[email protected] "... getting out of a sonnet is much more difficult than getting in." Brad Leithauser