Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dist/Carp/t/arg_string.t: Test fails in blead #15682

Closed
p5pRT opened this issue Oct 24, 2016 · 8 comments
Closed

dist/Carp/t/arg_string.t: Test fails in blead #15682

p5pRT opened this issue Oct 24, 2016 · 8 comments

Comments

@p5pRT
Copy link

p5pRT commented Oct 24, 2016

Migrated from rt.perl.org#129954 (status was 'resolved')

Searchable as RT129954$

@p5pRT
Copy link
Author

p5pRT commented Oct 24, 2016

From @dcollinsn

Hello!

Starting somewhere between v5.25.6-35-ge7619cc and v5.25.6-47-g69c5d0e, I
began seeing the following test failures on linux with -Dusequadmath (
http​://perl.develop-help.com/raw/?id=196087
http​://perl.develop-help.com/raw/?id=196097) and on Windows with all
configurations (http​://perl5.test-smoke.org/report/50770)

The Windows issue is the following test​:

  like lm(-3.5e30), qr/main​::lm\(-3\.5[eE]\+?30\)/;

The test expects numbers to be printed like "-3.5e30" or "-3.5e+30". Both
reasonable choices. Windows and quadruple precision floats are here to make
your life more interesting.

On Windows, I get "030" for the exponent, instead of "30". I can include a
log of this when I get home, I just can't see it from here.

The Linux issue is the same test​:

  like lm(-3.5e30), qr/main​::lm\(-3\.5[eE]\+?30\)/;

Under Quadmath, we get the following output​:

  main​::lm(-3500000000000000000000000000000)

Not sure if the behavior is wrong or if the test is, but I remember Jarkko
fighting to get the same sort of thing - printf number formats - to test
cleanly while he was working on the hexfp stuff a few months ago.

I'll bisect the Linux issue.

@p5pRT
Copy link
Author

p5pRT commented Oct 24, 2016

From @dcollinsn

Here is the bisect​:

HEAD is now at 0e25d86 vax-netbsd​: do not tempt fp overflow, which will SIGFPE
bad - non-zero exit from sh -c cd t && ./perl TEST \.\.\/dist\/Carp\/t\/arg_string\.t
0e25d86 is the first bad commit
commit 0e25d86
Author​: Jarkko Hietaniemi <jhi@​iki.fi>
Date​: Fri Oct 21 09​:05​:25 2016 -0400

  vax-netbsd​: do not tempt fp overflow, which will SIGFPE

  The 3e100 seems to have no special meaning, except being in floating point.

:040000 040000 f9f6d9eb328f42f4573a324789155e44f5f23e6e 5585ec7f232fb5471a6de76756fd3588dbcdd489 M dist
bisect run success
That took 424 seconds.

Which modified the above test to change from a 3-digit exponent to a 2-digit exponent, and to significantly shorten it. I'd be happy to provide a patch to add an optional leading zero to the test, but I don't know how to handle the issue of Linux trying to print the value as a 37 digit integer. What's the correct behavior here?

--
Respectfully,
Dan Collins

@p5pRT
Copy link
Author

p5pRT commented Oct 24, 2016

From [Unknown Contact. See original ticket]

Here is the bisect​:

HEAD is now at 0e25d86 vax-netbsd​: do not tempt fp overflow, which will SIGFPE
bad - non-zero exit from sh -c cd t && ./perl TEST \.\.\/dist\/Carp\/t\/arg_string\.t
0e25d86 is the first bad commit
commit 0e25d86
Author​: Jarkko Hietaniemi <jhi@​iki.fi>
Date​: Fri Oct 21 09​:05​:25 2016 -0400

  vax-netbsd​: do not tempt fp overflow, which will SIGFPE

  The 3e100 seems to have no special meaning, except being in floating point.

:040000 040000 f9f6d9eb328f42f4573a324789155e44f5f23e6e 5585ec7f232fb5471a6de76756fd3588dbcdd489 M dist
bisect run success
That took 424 seconds.

Which modified the above test to change from a 3-digit exponent to a 2-digit exponent, and to significantly shorten it. I'd be happy to provide a patch to add an optional leading zero to the test, but I don't know how to handle the issue of Linux trying to print the value as a 37 digit integer. What's the correct behavior here?

--
Respectfully,
Dan Collins

@p5pRT
Copy link
Author

p5pRT commented Oct 25, 2016

From @jkeenan

On Mon Oct 24 06​:13​:24 2016, dcollinsn@​gmail.com wrote​:

Hello!

Starting somewhere between v5.25.6-35-ge7619cc and v5.25.6-47-g69c5d0e, I
began seeing the following test failures on linux with -Dusequadmath (
http​://perl.develop-help.com/raw/?id=196087
http​://perl.develop-help.com/raw/?id=196097) and on Windows with all
configurations (http​://perl5.test-smoke.org/report/50770)

The Windows issue is the following test​:

like lm\(\-3\.5e30\)\, qr/main&#8203;::lm\\\(\-3\\\.5\[eE\]\\\+?30\\\)/;

The test expects numbers to be printed like "-3.5e30" or "-3.5e+30". Both
reasonable choices. Windows and quadruple precision floats are here to make
your life more interesting.

On Windows, I get "030" for the exponent, instead of "30". I can include a
log of this when I get home, I just can't see it from here.

The Linux issue is the same test​:

like lm\(\-3\.5e30\)\, qr/main&#8203;::lm\\\(\-3\\\.5\[eE\]\\\+?30\\\)/;

Under Quadmath, we get the following output​:

main&#8203;::lm\(\-3500000000000000000000000000000\)

Not sure if the behavior is wrong or if the test is, but I remember Jarkko
fighting to get the same sort of thing - printf number formats - to test
cleanly while he was working on the hexfp stuff a few months ago.

I'll bisect the Linux issue.

Confirmation of test failure​:

#####
$ cd t; ./perl harness -v ../dist/Carp/t/arg_string.t; cd -

ok 1
ok 2
ok 3
ok 4

not ok 5
# Failed test at t/arg_string.t line 25.
# 'x at t/arg_string.t line 9.
# main​::lm(-3500000000000000000000000000000) called at t/arg_string.t line 25
# '
# doesn't match '(?^​:main​::lm\(-3\.5[eE]\+?30\))'
#####

#####
$ ./perl -Ilib -V
Summary of my perl5 (revision 5 version 25 subversion 7) configuration​:
  Commit id​: a1b60c8
  Platform​:
  osname=linux
  osvers=4.4.0-45-generic
  archname=x86_64-linux-quadmath
  uname='linux zareason 4.4.0-45-generic #66-ubuntu smp wed oct 19 14​:12​:37 utc 2016 x86_64 x86_64 x86_64 gnulinux '
  config_args='-des -Dusedevel -DDEBUGGING -Dusequadmath'
  hint=recommended
  useposix=true
  d_sigaction=define
  useithreads=undef
  usemultiplicity=undef
  use64bitint=define
  use64bitall=define
  uselongdouble=undef
  usemymalloc=n
  bincompat5005=undef
  Compiler​:
  cc='cc'
  ccflags ='-fwrapv -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
  optimize='-O2 -g'
  cppflags='-fwrapv -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
  ccversion=''
  gccversion='5.4.0 20160609'
  gccosandvers=''
  intsize=4
  longsize=8
  ptrsize=8
  doublesize=8
  byteorder=12345678
  doublekind=3
  d_longlong=define
  longlongsize=8
  d_longdbl=define
  longdblsize=16
  longdblkind=3
  ivtype='long'
  ivsize=8
  nvtype='__float128'
  nvsize=16
  Off_t='off_t'
  lseeksize=8
  alignbytes=16
  prototype=define
  Linker and Libraries​:
  ld='cc'
  ldflags =' -fstack-protector-strong -L/usr/local/lib'
  libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed /usr/include/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib /lib64 /usr/lib64
  libs=-lpthread -lnsl -ldb -ldl -lm -lcrypt -lutil -lc -lquadmath
  perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc -lquadmath
  libc=libc-2.23.so
  so=so
  useshrplib=false
  libperl=libperl.a
  gnulibc_version='2.23'
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs
  dlext=so
  d_dlsymun=undef
  ccdlflags='-Wl,-E'
  cccdlflags='-fPIC'
  lddlflags='-shared -O2 -g -L/usr/local/lib -fstack-protector-strong'

Characteristics of this binary (from libperl)​:
  Compile-time options​:
  DEBUGGING
  HAS_TIMES
  PERLIO_LAYERS
  PERL_COPY_ON_WRITE
  PERL_DONT_CREATE_GVSV
  PERL_HASH_FUNC_ONE_AT_A_TIME_HARD
  PERL_MALLOC_WRAP
  PERL_OP_PARENT
  PERL_PRESERVE_IVUV
  PERL_USE_DEVEL
  USE_64_BIT_ALL
  USE_64_BIT_INT
  USE_LARGE_FILES
  USE_LOCALE
  USE_LOCALE_COLLATE
  USE_LOCALE_CTYPE
  USE_LOCALE_NUMERIC
  USE_LOCALE_TIME
  USE_PERLIO
  USE_PERL_ATOF
  USE_QUADMATH
  Built under linux
#####
--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Oct 25, 2016

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Oct 27, 2016

From @iabyn

On Mon, Oct 24, 2016 at 06​:26​:43AM -0700, Dan Collins via RT wrote​:

Here is the bisect​:

HEAD is now at 0e25d86 vax-netbsd​: do not tempt fp overflow, which will SIGFPE
bad - non-zero exit from sh -c cd t && ./perl TEST \.\.\/dist\/Carp\/t\/arg_string\.t
0e25d86 is the first bad commit
commit 0e25d86
Author​: Jarkko Hietaniemi <jhi@​iki.fi>
Date​: Fri Oct 21 09​:05​:25 2016 -0400

vax\-netbsd&#8203;: do not tempt fp overflow\, which will SIGFPE

The 3e100 seems to have no special meaning\, except being in floating point\.

:040000 040000 f9f6d9eb328f42f4573a324789155e44f5f23e6e 5585ec7f232fb5471a6de76756fd3588dbcdd489 M dist
bisect run success
That took 424 seconds.

Which modified the above test to change from a 3-digit exponent to a 2-digit exponent, and to significantly shorten it. I'd be happy to provide a patch to add an optional leading zero to the test, but I don't know how to handle the issue of Linux trying to print the value as a 37 digit integer. What's the correct behavior here?

I think the test was being overly picky.

I've just pushed the following​:

commit 13596ab
Author​: David Mitchell <davem@​iabyn.com>
AuthorDate​: Thu Oct 27 09​:09​:24 2016 +0100
Commit​: David Mitchell <davem@​iabyn.com>
CommitDate​: Thu Oct 27 09​:09​:24 2016 +0100

  Carp/t/arg_string.t​: be liberal in f/p formats
 
  [perl #129954] dist/Carp/t/arg_string.t​: Test fails
 
  This test script checks that args are displayed sensibly in longmess()
  output, but floating-point numbers can be displayed in various formats
  depending on platform, so make the regex more forgiving.
 
  Also add a comment to the top of the script explaining its purpose.

Affected files ...
  M dist/Carp/t/arg_string.t

Differences ...

Inline Patch
diff --git a/dist/Carp/t/arg_string.t b/dist/Carp/t/arg_string.t
index c94ec48..4c754c5 100644
--- a/dist/Carp/t/arg_string.t
+++ b/dist/Carp/t/arg_string.t
@@ -1,6 +1,8 @@
 use warnings;
 use strict;
 
+# confirm that stack args are displayed correctly by longmess()
+
 use Test::More tests => 32;
 
 use Carp ();
@@ -22,7 +24,11 @@ like lm(3), qr/main::lm\(3\)/;
 like lm(substr("3\x{2603}", 0, 1)), qr/main::lm\(3\)/;
 like lm(-3), qr/main::lm\(-3\)/;
 like lm(-3.5), qr/main::lm\(-3\.5\)/;
-like lm(-3.5e30), qr/main::lm\(-3\.5[eE]\+?30\)/;
+like lm(-3.5e30),
+            qr/main::lm\(
+                -3500000000000000000000000000000
+              | -3\.5[eE]\+?0?30\)
+            /x;
 like lm(""), qr/main::lm\(""\)/;
 like lm("foo"), qr/main::lm\("foo"\)/;
 like lm("a\$b\@c\\d\"e"), qr/main::lm\("a\\\$b\\\@c\\\\d\\\"e"\)/;


-- 

I thought I was wrong once, but I was mistaken.

@p5pRT
Copy link
Author

p5pRT commented Oct 27, 2016

@iabyn - Status changed from 'open' to 'resolved'

@p5pRT p5pRT closed this as completed Oct 27, 2016
@p5pRT
Copy link
Author

p5pRT commented Oct 27, 2016

From @iabyn

On Thu, Oct 27, 2016 at 09​:19​:02AM +0100, Dave Mitchell wrote​:

I think the test was being overly picky.

I've just pushed the following​:

And that was being underly picky, so I just pushed the following too​:

commit fd609c8
Author​: David Mitchell <davem@​iabyn.com>
AuthorDate​: Thu Oct 27 09​:29​:33 2016 +0100
Commit​: David Mitchell <davem@​iabyn.com>
CommitDate​: Thu Oct 27 09​:32​:48 2016 +0100

  Carp/t/arg_string.t​: fixup to previous fixup
 
  I added alternates to a regex for matching a f/p number, but forgot
  to put parentheses around them. So it was being ridiculously over-liberal

Affected files ...
  M dist/Carp/t/arg_string.t

Differences ...

Inline Patch
diff --git a/dist/Carp/t/arg_string.t b/dist/Carp/t/arg_string.t
index 4c754c5..dc70f43 100644
--- a/dist/Carp/t/arg_string.t
+++ b/dist/Carp/t/arg_string.t
@@ -26,9 +26,11 @@ like lm(-3), qr/main::lm\(-3\)/;
 like lm(-3.5), qr/main::lm\(-3\.5\)/;
 like lm(-3.5e30),
             qr/main::lm\(
+              (
                 -3500000000000000000000000000000
-              | -3\.5[eE]\+?0?30\)
-            /x;
+              | -3\.5[eE]\+?0?30
+              )
+              \) /x;
 like lm(""), qr/main::lm\(""\)/;
 like lm("foo"), qr/main::lm\("foo"\)/;
 like lm("a\$b\@c\\d\"e"), qr/main::lm\("a\\\$b\\\@c\\\\d\\\"e"\)/;


-- 

All wight. I will give you one more chance. This time, I want to hear
no Wubens. No Weginalds. No Wudolf the wed-nosed weindeers.
  -- Life of Brian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant