Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

regression test filesystem assumptions

0 views
Skip to first unread message

Nicholas Clark

unread,
Aug 7, 2013, 1:23:00 PM8/7/13
to vms...@perl.org
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?

Specifically, is it filesystem dependant whether this code as-is will pass?

open(H,'run/fresh_perl.t'); # must be in the 't' directory
stat(H);
print "ok\n" if (-e _ and -f _ and -r _);

I infer that it must have failed 12 years ago, because the last line was
"corrected" to

print "ok\n" if (-e _ and -f _);


But what changed to cause it to work now?


Nicholas Clark


commit 219b23a016e4d19b9fc29d2cb6aad7c8f485e7bc
Author: Nicholas Clark <ni...@ccl4.org>
Date: Wed Aug 7 11:57:09 2013 +0200

Remove the two "VMS adjustments" from test.pl's _fresh_perl

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

The two adjustments each only applied to one test.

Was: system './perl -ne "print if eof" /dev/null'
Became: system './perl -ne "print if eof" NL:'

Was: print "ok\n" if (-e _ and -f _ and -r _);
Became: print "ok\n" if (-e _ and -f _);

The latter had the comment "VMS file locking".

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.

The "adjustments", particularly the second, should have been done all along
in the code for the test itself, not by complicating the test runner.

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} = 1 unless exists $runperl_args->{stderr};

open TEST, ">$tmpfile" or die "Cannot open $tmpfile: $!";
-
- # VMS adjustments
- if( $is_vms ) {
- $prog =~ s#/dev/null#NL:#;
-
- # VMS file locking
- $prog =~ s{if \(-e _ and -f _ and -r _\)}
- {if (-e _ and -f _)}
- }
-
print TEST $prog;
close TEST or die "Cannot close $tmpfile: $!";

John E. Malmberg

unread,
Aug 7, 2013, 9:01:30 PM8/7/13
to Nicholas Clark, vms...@perl.org
On 8/7/2013 12:23 PM, Nicholas Clark 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?
>
> Specifically, is it filesystem dependant whether this code as-is will pass?
>
> open(H,'run/fresh_perl.t'); # must be in the 't' directory
> stat(H);
> print "ok\n" if (-e _ and -f _ and -r _);
>
> I infer that it must have failed 12 years ago, because the last line was
> "corrected" to
>
> print "ok\n" if (-e _ and -f _);
>
> But what changed to cause it to work now?

Don't know why it ever failed on VMS unless there was a bug in the
stat() routine for the version of VMS that the change was made on.

Regards,
-John

Craig A. Berry

unread,
Aug 7, 2013, 11:03:17 PM8/7/13
to Nicholas Clark, vms...@perl.org

On Aug 7, 2013, at 12:23 PM, Nicholas Clark <ni...@ccl4.org> 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?
>
> Specifically, is it filesystem dependant whether this code as-is will pass?
>
> open(H,'run/fresh_perl.t'); # must be in the 't' directory
> stat(H);
> print "ok\n" if (-e _ and -f _ and -r _);
>

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
>
> print "ok\n" if (-e _ and -f _);
>
>
> But what changed to cause it to work now?
>

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.
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:craig...@mac.com

"... getting out of a sonnet is much more
difficult than getting in."
Brad Leithauser

Nicholas Clark

unread,
Aug 8, 2013, 3:31:16 AM8/8/13
to Craig A. Berry, vms...@perl.org
On Wed, Aug 07, 2013 at 10:03:17PM -0500, Craig A. Berry wrote:
>
> On Aug 7, 2013, at 12:23 PM, Nicholas Clark <ni...@ccl4.org> 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?
> >
> > Specifically, is it filesystem dependant whether this code as-is will pass?
> >
> > open(H,'run/fresh_perl.t'); # must be in the 't' directory
> > stat(H);
> > print "ok\n" if (-e _ and -f _ and -r _);
> >
>
> I can't think of any reason that would be different on different filesystems.

OK, good. I wasn't totally sure, and wanted to avoid making a mistake that
caused someone else more work.

> > I infer that it must have failed 12 years ago, because the last line was
> > "corrected" to
> >
> > print "ok\n" if (-e _ and -f _);
> >
> >
> > But what changed to cause it to work now?
> >
>
> 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.

OK. I was curious if it was obvious to someone else, and it's not.

> > commit 219b23a016e4d19b9fc29d2cb6aad7c8f485e7bc
> > Author: Nicholas Clark <ni...@ccl4.org>
> > Date: Wed Aug 7 11:57:09 2013 +0200

> > open TEST, ">$tmpfile" or die "Cannot open $tmpfile: $!";
> > -
> > - # VMS adjustments
> > - if( $is_vms ) {
> > - $prog =~ s#/dev/null#NL:#;
> > -
> > - # VMS file locking
> > - $prog =~ s{if \(-e _ and -f _ and -r _\)}
> > - {if (-e _ and -f _)}
> > - }
> > -
> > print TEST $prog;
> > close TEST or die "Cannot close $tmpfile: $!";
> >
>
> 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.

Yes, to be fair I'm in two minds about the /dev/null one, as it might show
up in other places. But it was bugging me that it's only VMS - surely other
platforms need similar fixes? But as George Greer observed, Win32 has a
special case:

DllExport FILE *
win32_freopen(const char *path, const char *mode, FILE *stream)
{
dTHXa(NULL);
if (stricmp(path, "/dev/null")==0)
path = "NUL";

aTHXa(PERL_GET_THX);
return freopen(PerlDir_mapA(path), mode, stream);
}


(and similar code in 2 other places)

But I think that the pattern match for qr/if \(-e _ and -f _ and -r _\)/ was
so specific that it was only ever going to match one test.

Nicholas Clark

John E. Malmberg

unread,
Aug 8, 2013, 8:25:37 AM8/8/13
to Nicholas Clark, Craig A. Berry, vms...@perl.org
On 8/8/2013 2:31 AM, Nicholas Clark wrote:
>>
>> 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 would have to build up a VMS 5.5-2 system on a SimH emulator to be
sure of the behavior back at the beginning of the current CRTL image.

There have been some features of the CRTL that have apparently been
there since then, but only got documented recently.

The /dev/null being used for NLA0: is one of them.

Another is that /tmp is mapped to SYS$SCRATCH: if the logical name TMP:
does not exist.

Regards,
-John

0 new messages