Bug 240219 - Flakey test case: sys.sys.qmath_test.qdivq_s64q
Summary: Flakey test case: sys.sys.qmath_test.qdivq_s64q
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: tests (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Edward Tomasz Napierala
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-30 20:02 UTC by Li-Wen Hsu
Modified: 2024-05-27 19:15 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Li-Wen Hsu freebsd_committer freebsd_triage 2019-08-30 20:02:26 UTC
sys.sys.qmath_test.qdivq_s64q is unstable:

https://ci.freebsd.org/job/FreeBSD-head-amd64-test/12369/testReport/junit/sys.sys/qmath_test/qdivq_s64q/
https://ci.freebsd.org/job/FreeBSD-head-amd64-test/12387/testReport/junit/sys.sys/qmath_test/qdivq_s64q/
https://ci.freebsd.org/job/FreeBSD-head-amd64-test/12392/testReport/junit/sys.sys/qmath_test/qdivq_s64q/

*** Check failed: /usr/src/tests/sys/sys/qmath_test.c:308: 	QDIVQ(-10002376169421.736328 / -15034320172614.007812): | 98.402039 -   0.665303| =  97.736736 (max err 64.000000)

Also on i386:
https://ci.freebsd.org/job/FreeBSD-head-i386-test/6533/testReport/sys.sys/qmath_test/qdivq_s64q/
https://ci.freebsd.org/job/FreeBSD-head-i386-test/6519/testReport/sys.sys/qmath_test/qdivq_s64q/
https://ci.freebsd.org/job/FreeBSD-head-i386-test/6515/testReport/sys.sys/qmath_test/qdivq_s64q/

*** Check failed: /usr/src/tests/sys/sys/qmath_test.c:308: 	QDIVQ(-62708492.456048 / -164807648.004718): | 96.661085 -   0.380495| =  96.280590 (max err 64.000000)
Comment 1 Li-Wen Hsu freebsd_committer freebsd_triage 2019-08-30 20:03:45 UTC
trasz: can you help check this?
Comment 2 commit-hook freebsd_committer freebsd_triage 2019-09-03 10:49:33 UTC
A commit references this bug:

Author: lwhsu
Date: Tue Sep  3 10:49:13 UTC 2019
New revision: 351739
URL: https://svnweb.freebsd.org/changeset/base/351739

Log:
  Temporarily skip sys.sys.qmath_test.qdivq_s64q in CI because it is unstable

  PR:		240219
  Discussed with:	trasz
  Sponsored by:	The FreeBSD Foundation

Changes:
  head/tests/sys/sys/qmath_test.c
Comment 3 Ryan Libby freebsd_committer freebsd_triage 2020-12-11 23:14:50 UTC
I've seen this running kyua for dev testing too.  It repros very
regularly with:

% kyua debug -k /usr/tests/sys/sys/Kyuafile qmath_test:qdivq_s64q

*** Check failed: /usr/src/freebsd/tests/sys/sys/qmath_test.c:312: 	QDIVQ(-3223.957586 /  -4.348088): | -0.000000 - 741.465557| = 741.465557 (max err 64.000000)
*** Check failed: /usr/src/freebsd/tests/sys/sys/qmath_test.c:312: 	QDIVQ( -0.666057 /  -0.006838): | -0.000000 -  97.403647| =  97.403647 (max err 64.000000)
*** Check failed: /usr/src/freebsd/tests/sys/sys/qmath_test.c:312: 	QDIVQ(-12136258505124932.000000 / -37248647815101.328125): |  6.546875 - 325.817425| = 319.270550 (max err 64.000000)
*** Check failed: /usr/src/freebsd/tests/sys/sys/qmath_test.c:312: 	QDIVQ(-119840516.277450 / -1321356.097985): |  2.831561 -  90.695095| =  87.863533 (max err 64.000000)

It seems in all repros so far both the numerator and denominator are
negative.
Comment 4 Ryan Libby freebsd_committer freebsd_triage 2024-05-27 19:15:06 UTC
Okay, actually reading Q_QDIVQ, I believe it is just completely
incorrect.  Like 1/1 != 1.

It is so wrong that I wonder if it should either just always set the
result as zero, or an error of EOPNOTSUP, or be removed.  I do not see
any uses of Q_QDIVQ in the tree except for this test.

If someone does want to fix it, the cases for types of no more than 32
bits are trivially addressed.  64 bits is a little harder to make fast
without assuming compiler support for large ints, but if we are willing
to sacrifice a little accuracy (and why not, considering the current
code is catastrophically wrong), it's possible to get a reasonably close
result.