Bug 217084

Summary: lib/msun: clang 4.0 fails to ignore some tests
Product: Base System Reporter: Jan Beich <jbeich>
Component: testsAssignee: freebsd-testing (Nobody) <testing>
Status: Closed FIXED    
Severity: Affects Only Me CC: arichardson, dim, ngie
Priority: --- Keywords: patch, regression
Version: CURRENT   
Hardware: Any   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=208703
Bug Depends on:    
Bug Blocks: 216008    
Attachments:
Description Flags
v0 none

Description Jan Beich freebsd_committer freebsd_triage 2017-02-13 20:44:06 UTC
Created attachment 179962 [details]
v0

$ pkg install kyua
$ kyua test -k /usr/tests/lib/msun/Kyuafile | fgrep fail
fmaxmin_test:main  ->  failed: 4 of 12 tests failed  [0.001s]
361/363 passed (2 failed)
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2017-02-13 21:04:08 UTC
Strange, in r297952 ngie committed a change which disabled the tests for clang 3.8.0 only, but later in r298434 it was commented out again, and reinstated again in r303841.  Finally, in r312213, this was replaced by "a compile-time check of the clang version".

Not sure what the story is here, I have very little experience with the test framework.
Comment 2 Dimitry Andric freebsd_committer freebsd_triage 2017-02-13 21:07:24 UTC
FWIW, if I manually build lib/msun/tests, and run the fmaxmin_test program, it seems to work just fine...
Comment 3 commit-hook freebsd_committer freebsd_triage 2017-02-14 00:55:33 UTC
A commit references this bug:

Author: ngie
Date: Tue Feb 14 00:54:48 UTC 2017
New revision: 313713
URL: https://svnweb.freebsd.org/changeset/base/313713

Log:
  Handle clang 4.x+ with the compile-time exception added in r312213

  It also fails the assertions noted in bug 208703

  PR:	208703
  PR:	217084
  Submitted by:	jbeich
  MFC after:	1 week
  Sponsored by:	Dell EMC Isilon

Changes:
  head/lib/msun/tests/fmaxmin_test.c
Comment 4 Enji Cooper freebsd_committer freebsd_triage 2017-02-14 01:53:31 UTC
(In reply to Dimitry Andric from comment #2)

Probably because you weren't running it with prove:

$ prove -v /usr/tests/lib/msun/fmaxmin_test
/usr/tests/lib/msun/fmaxmin_test ..
1..12
ok 1 - big = 1, small = 0
ok 2 - big = 42, small = 41.999996185302734375
ok 3 - big = 42.000003814697265625, small = 42
ok 4 - big = -5, small = -5
ok 5 - big = -3, small = -4
not ok 6 - big = 1, small = nan# TODO: testcase 6-7 fails invariant with clang 3.8+ (bug 208703)
not ok 7 - big = inf, small = nan# TODO: testcase 6-7 fails invariant with clang 3.8+ (bug 208703)
ok 8 - big = inf, small = 1
ok 9 - big = -3, small = -inf
ok 10 - big = 3, small = -inf
not ok 11 - big = nan, small = nan# TODO: testcase 11-12 fails invariant with clang 3.8+ (bug 208703)
not ok 12 - big = 0, small = -0# TODO: testcase 11-12 fails invariant with clang 3.8+ (bug 208703)
fmaxf(1, nan) raised 0x1
fmaxf(nan, 1) raised 0x1
fmax(1, nan) raised 0x1
fmax(nan, 1) raised 0x1
fminf(1, nan) raised 0x1
fminf(nan, 1) raised 0x1
fmin(1, nan) raised 0x1
fmin(nan, 1) raised 0x1
FAILURE in rounding mode 0
fmaxf(inf, nan) raised 0x1
fmaxf(nan, inf) raised 0x1
fmax(inf, nan) raised 0x1
fmax(nan, inf) raised 0x1
fminf(inf, nan) raised 0x1
fminf(nan, inf) raised 0x1
fmin(inf, nan) raised 0x1
fmin(nan, inf) raised 0x1
FAILURE in rounding mode 0
fmaxf(nan, nan) raised 0x1
fmaxf(nan, nan) raised 0x1
fmax(nan, nan) raised 0x1
fmax(nan, nan) raised 0x1
fminf(nan, nan) raised 0x1
fminf(nan, nan) raised 0x1
fmin(nan, nan) raised 0x1
fmin(nan, nan) raised 0x1
FAILURE in rounding mode 0
fmaxf(-0, 0) = -0, expected 0
fmax(-0, 0) = -0, expected 0
fminf(0, -0) = 0, expected -0
fmin(0, -0) = 0, expected -0
FAILURE in rounding mode 0
ok
All tests successful.
Files=1, Tests=12,  1 wallclock secs ( 0.06 usr  0.28 sys +  0.00 cusr  0.02 csys =  0.37 CPU)
Result: PASS

The check needed to be converted from a build time compiler check to a compile time check because unfortunately the build would break when building 11.x on a 10.3 system, for example.
Comment 5 commit-hook freebsd_committer freebsd_triage 2017-02-21 03:51:01 UTC
A commit references this bug:

Author: ngie
Date: Tue Feb 21 03:49:53 UTC 2017
New revision: 314022
URL: https://svnweb.freebsd.org/changeset/base/314022

Log:
  MFC r313713:

  Handle clang 4.x+ with the compile-time exception added in r312213

  It also fails the assertions noted in bug 208703

  PR:	208703
  PR:	217084

Changes:
_U  stable/11/
  stable/11/lib/msun/tests/fmaxmin_test.c
Comment 6 commit-hook freebsd_committer freebsd_triage 2017-02-21 03:52:08 UTC
A commit references this bug:

Author: ngie
Date: Tue Feb 21 03:50:57 UTC 2017
New revision: 314023
URL: https://svnweb.freebsd.org/changeset/base/314023

Log:
  MFC r312213,r313713:

  r312213:

  Turn COMPILER_VERSION/COMPILER_TYPE make check into a compile-time check
  of the clang version

  This works around breakage on ^/stable/10 when running installworld from
  a ^/stable/10 host where the test wouldn't be compiled on the first
  go-around and would be missing when make installworld is run.

  PR:		208703

  r313713:

  Handle clang 4.x+ with the compile-time exception added in r312213

  It also fails the assertions noted in bug 208703

  PR:	208703
  PR:	217084

Changes:
_U  stable/10/
  stable/10/lib/msun/tests/fmaxmin_test.c