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

Re: [perl #134038] ext/POSIX/t/posix.t patch to fix deficiency intest suite

Thread Previous | Thread Next
From:
sisyphus
Date:
April 17, 2019 01:26
Subject:
Re: [perl #134038] ext/POSIX/t/posix.t patch to fix deficiency intest suite
Message ID:
CADZSBj0TA5wSxGLDSFndzq5h0eV9Y5pYxwc736uG+zf0eGWuzA@mail.gmail.com
Yeah - so much for perl's claim that it's guided by the principle of "least
surprise" ;-)

Assuming you're running this test script on the current blead branch, I
believe the result is as expected.
The "got" and "expected" values are, in fact, different - but perl's
print() function rounds them to the same output.

IOW, perl is behaving exactly as I expect, and I therefore saw no need to
change anything.

I did consider rewriting the test as (untried):

cmp_ok(unpack("h*", pack("d", $n)),  'eq', unpack("h*", pack("d",
 8.87359152e-6)),  'strtod and perl agree');

because that would then show that "got" and "expected" were dfifferent, but
that just looked messy and unclear.

Anyway, if there's a view that the test needs to be rewritten, then I'll go
along with it ... albeit somewhat grumpily.
I'm not all that fussed about how this sort of thing is detected, but
clearly there needs to be something in the test suite that catches this
event that we've just experienced.

Cheers,
Rob



On Wed, Apr 17, 2019 at 9:49 AM James E Keenan via RT <
perlbug-followup@perl.org> wrote:

> On Tue, 16 Apr 2019 12:49:35 GMT, sisyphus359@gmail.com wrote:
> > Hi,
> > As discussed in recent postings to
> > https://rt.perl.org/Ticket/Display.html?id=133945, at some time in the
> last
> > few days blead stopped  using Perl_strtod to assign floating point values
> > and reverted to the using its buggy atof functionality instead.
> >
> > There is nothing in the test suite that detects such an occurrence,
> > The attached patch to posix.t remedies that by checking that  specific
> > 'double', 'long double' and '__float128' values (known to be assigned
> > incorrectly by perl's atof routines) are being assigned correctly.
> >
> > Cheers,
> > Rob
>
>
> I created a (local) branch from blead in which I applied this patch.  I
> then ran make test_harness and the result was FAIL.  The result is puzzling:
>
> #####
> $ cd t;./perl harness -v ../ext/POSIX/t/posix.t; cd -
>
> ok 1 - O_RDONLY with open
> ok 2 -     with read
> not ok 3 -     read to array element # TODO read to array element not
> working
> ok 4
> ok 5 - POSIX::pipe
> ...
> ok 16 - strtod works
> not ok 17 - strtod and perl agree
>
> #   Failed test 'strtod and perl agree'
> #   at t/posix.t line 180.
> #          got: 8.87359152e-06
> #     expected: 8.87359152e-06
> ok 18 - strtold works
> ...
> ok 96 - tmpnam advises File::Temp
> Failed 1/96 subtests
>         (less 2 skipped subtests: 93 okay)
>
> Test Summary Report
> -------------------
> ../ext/POSIX/t/posix.t (Wstat: 0 Tests: 96 Failed: 1)
>   Failed test:  17
> Files=1, Tests=96,  3 wallclock secs ( 0.02 usr  0.01 sys +  0.06 cusr
> 0.01 csys =  0.10 CPU)
> Result: FAIL
> #####
>
> --
> James E Keenan (jkeenan@cpan.org)
>
> ---
> via perlbug:  queue: perl5 status: new
> https://rt.perl.org/Ticket/Display.html?id=134038
>

Thread Previous | 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