diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2017-02-28 14:45:29 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2017-02-28 15:27:33 +1000 |
commit | 72fb6d304eec6eeeac6b42963c2729134d56de57 (patch) | |
tree | 77c6c4e875b4f50fec200a94122034dfcb702a30 | |
parent | aae2c8ad9a9f1712149c93d50284ddb5f37e4cbd (diff) | |
download | xorg-driver-xf86-input-libinput-72fb6d304eec6eeeac6b42963c2729134d56de57.tar.gz |
test: fix a test failure on ppc64(le) and aarch64
Caused by different results in -O0 vs -O2. The resulting array differs only
slightly but the initial sequence has one extra zero. That triggers our
assert, no other compiler flag seem to be affecting this.
Compiled with -O0:
Breakpoint 1, test_nonzero_x_linear () at test-bezier.c:157
157 assert(bezier[x] > bezier[x-1]);
(gdb) p bezier
$6 = {0 <repeats 409 times>, 1, 2, 4, 5, 7, 9, 10, 12, 14, 15, 17, 19, 21, 22,
Compiled with -O2:
(gdb) p bezier
$1 = {0 <repeats 410 times>, 1, 3, 5, 7, 9, 10, 12, 14, 15, 17, 19, 20, 22,
Printing of the temporary numbers in the decasteljau function shows that a few
of them are off by one, e.g.
408.530612/0.836735 with O0, but
409.510204/0.836735 with O2
Note: these are not rounding errors caused by the code, the cast to int
happens afterwards.
Hack around this by allowing for one extra zero before we check that the rest
of the curve is ascending again.
https://bugs.freedesktop.org/show_bug.cgi?id=99992
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | test/test-bezier.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/test-bezier.c b/test/test-bezier.c index 1b290a4..9a6e59e 100644 --- a/test/test-bezier.c +++ b/test/test-bezier.c @@ -153,6 +153,13 @@ test_nonzero_x_linear(void) assert(bezier[x] == 0); } while (++x < size * 0.2 - 1); + /* ppc64le, ppc64, aarch64 have different math results at -O2, + resulting in one extra zero at the beginning of the array. + some other numbers are different too but within the error + margin (#99992) */ + if (bezier[x] == 0) + x++; + do { assert(bezier[x] > bezier[x-1]); } while (++x < size * 0.8 - 1); |