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)
trasz: can you help check this?
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
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.
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.
Lawrence, would you be able to take a look at this? Like Ryan, I occasionally hit this failure in my test runs and it'd be nice to either fix this macro or remove it.
ACK. This issue was supposed to be cleaned up as part of upstreaming, but it looks like it needs further TLC.
^Triage: committer's bit was taken in for safekeeping.