develooper Front page | perl.perl5.porters | Postings from April 2019

[perl #134039] Skip t/io/perlio.t tests if /tmp does not exist

Thread Next
From:
Richard Leach
Date:
April 17, 2019 21:18
Subject:
[perl #134039] Skip t/io/perlio.t tests if /tmp does not exist
Message ID:
rt-4.0.24-4244-1555441272-864.134039-75-0@perl.org
# New Ticket Created by  Richard Leach 
# Please include the string:  [perl #134039]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=134039 >


Related to the efforts in RT#133787 to build Perl on Android 8.1
(Oreo) under the Termux app environment, there's a test failure in
t/io/perlio.t that arises because the test (and PerlIO) depend upon
/tmp existing, but it actually does not exist here.

The failing test outputs:

t/io/perlio .................... # Failed test 30 - TMPDIR honored by
magic temp file via 3 arg open with undef - works if TMPDIR points to
a non-existent dir at io/perlio.t line 105
Can't stat GLOB(0x71ccc941f8): Bad file descriptor at io/perlio.t line
145, <$x> line 1.
# Looks like you planned 48 tests but ran 30.
FAILED at test 30

Investigation shows that perlio.t clobbers $ENV{TMPDIR} and then
performs the following test:

  ok( open(my $x,"+<",undef), 'TMPDIR honored by magic temp file via 3
arg open with undef - works if TMPDIR points to a non-existent dir');

I think this is testing PerlIO_tmpfile(void) in perlio.c; if TMPDIR
doesn't exist, a hardcoded path under /tmp (the tempname scalar) is
tried. However, as mentioned, there is no /tmp under Termux.

AFAICT, the TMPDIR environment variable is always set on Termux, so
creation of unnamed temporary files will succeed despite there being
no /tmp directory. (The perlio.t tests for this scenario do succeed.)

Therefore the attached patch skips this test (and the subsequent 3
lines of cleanup, including an additional test) if /tmp is not
present. Hopefully this is safe to apply.

Regards,
Richard

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About