Gentoo Archives: gentoo-commits

From: Mart Raudsepp <leio@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/orc/, dev-lang/orc/files/
Date: Fri, 09 Aug 2019 07:08:21
Message-Id: 1565333147.91c13cd00de06d52ab502a5074100b6ab8bf5ded.leio@gentoo
1 commit: 91c13cd00de06d52ab502a5074100b6ab8bf5ded
2 Author: Mart Raudsepp <leio <AT> gentoo <DOT> org>
3 AuthorDate: Fri Aug 9 06:45:29 2019 +0000
4 Commit: Mart Raudsepp <leio <AT> gentoo <DOT> org>
5 CommitDate: Fri Aug 9 06:45:47 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=91c13cd0
7
8 dev-lang/orc: fix tests on some platforms (Phenom, ARM)
9
10 ARM may have other tests, but this fixes some.
11 Fixes tests for Phenom 32bit builds.
12
13 Closes: https://bugs.gentoo.org/596128
14 Package-Manager: Portage-2.3.62, Repoman-2.3.12
15 Signed-off-by: Mart Raudsepp <leio <AT> gentoo.org>
16
17 dev-lang/orc/files/0.4.29-test-rounding.patch | 73 +++++++++++++++++++++++++++
18 dev-lang/orc/orc-0.4.29.ebuild | 6 +++
19 2 files changed, 79 insertions(+)
20
21 diff --git a/dev-lang/orc/files/0.4.29-test-rounding.patch b/dev-lang/orc/files/0.4.29-test-rounding.patch
22 new file mode 100644
23 index 00000000000..653132fcb8e
24 --- /dev/null
25 +++ b/dev-lang/orc/files/0.4.29-test-rounding.patch
26 @@ -0,0 +1,73 @@
27 +From 73986d82e1ae60b224b401143cd4ce2c452bf326 Mon Sep 17 00:00:00 2001
28 +From: Doug Nazar <nazard@×××××.ca>
29 +Date: Wed, 7 Aug 2019 00:11:35 -0400
30 +Subject: [PATCH] orctest: Switch nearby float comparison to ULP method
31 +
32 +---
33 + orc-test/orcarray.c | 7 ++-----
34 + orc-test/orctest.c | 8 ++++----
35 + 2 files changed, 6 insertions(+), 9 deletions(-)
36 +
37 +diff --git a/orc-test/orcarray.c b/orc-test/orcarray.c
38 +index c0666c5..b27a1f9 100644
39 +--- a/orc-test/orcarray.c
40 ++++ b/orc-test/orcarray.c
41 +@@ -211,9 +211,6 @@ orc_array_set_pattern_2 (OrcArray *array, OrcRandomContext *context,
42 + }
43 + }
44 +
45 +-#define MIN_NONDENORMAL (1.1754944909521339405e-38)
46 +-#define MIN_NONDENORMAL_D (2.2250738585072014e-308)
47 +-
48 + int
49 + orc_array_compare (OrcArray *array1, OrcArray *array2, int flags)
50 + {
51 +@@ -230,7 +227,7 @@ orc_array_compare (OrcArray *array1, OrcArray *array2, int flags)
52 + for (i=0;i<array1->n;i++){
53 + if (isnan(a[i]) && isnan(b[i])) continue;
54 + if (a[i] == b[i]) continue;
55 +- if (fabs(a[i] - b[i]) < MIN_NONDENORMAL) continue;
56 ++ if ((a[i] < 0.0) == (b[i] < 0.0) && abs(*(orc_uint32 *)&a[i] - *(orc_uint32 *)&b[i]) <= 2) continue;
57 + return FALSE;
58 + }
59 + }
60 +@@ -247,7 +244,7 @@ orc_array_compare (OrcArray *array1, OrcArray *array2, int flags)
61 + for (i=0;i<array1->n;i++){
62 + if (isnan(a[i]) && isnan(b[i])) continue;
63 + if (a[i] == b[i]) continue;
64 +- if (fabs(a[i] - b[i]) < MIN_NONDENORMAL_D) continue;
65 ++ if ((a[i] < 0.0) == (b[i] < 0.0) && abs(*(orc_uint64 *)&a[i] - *(orc_uint64 *)&b[i]) <= 2) continue;
66 + return FALSE;
67 + }
68 + }
69 +diff --git a/orc-test/orctest.c b/orc-test/orctest.c
70 +index 9f0e942..54658bc 100644
71 +--- a/orc-test/orctest.c
72 ++++ b/orc-test/orctest.c
73 +@@ -44,8 +44,6 @@
74 + #define snprintf _snprintf
75 + #endif
76 +
77 +-#define MIN_NONDENORMAL (1.1754944909521339405e-38)
78 +-
79 + void _orc_profile_init(void);
80 +
81 + OrcRandomContext rand_context;
82 +@@ -527,10 +525,12 @@ float_compare (OrcArray *array1, OrcArray *array2, int i, int j)
83 + case 4:
84 + if (isnan(*(float *)ptr1) && isnan(*(float *)ptr2)) return TRUE;
85 + if (*(float *)ptr1 == *(float *)ptr2) return TRUE;
86 +- if (fabs(*(float *)ptr1 - *(float *)ptr2) < MIN_NONDENORMAL) return TRUE;
87 ++ if ((*(float *)ptr1 < 0.0) == (*(float *)ptr2 < 0.0) && abs(*(orc_uint32 *)ptr1 - *(orc_uint32 *)ptr2) <= 2) return TRUE;
88 + return FALSE;
89 + case 8:
90 +- /* FIXME */
91 ++ if (isnan(*(double *)ptr1) && isnan(*(double *)ptr2)) return TRUE;
92 ++ if (*(double *)ptr1 == *(double *)ptr2) return TRUE;
93 ++ if ((*(double *)ptr1 < 0.0) == (*(double *)ptr2 < 0.0) && abs(*(orc_uint64 *)ptr1 - *(orc_uint64 *)ptr2) <= 2) return TRUE;
94 + return FALSE;
95 + }
96 + return FALSE;
97 +--
98 +2.21.0
99 +
100
101 diff --git a/dev-lang/orc/orc-0.4.29.ebuild b/dev-lang/orc/orc-0.4.29.ebuild
102 index 974ea15e13d..7c92dcb5075 100644
103 --- a/dev-lang/orc/orc-0.4.29.ebuild
104 +++ b/dev-lang/orc/orc-0.4.29.ebuild
105 @@ -22,6 +22,12 @@ DEPEND="${RDEPEND}
106
107 DOCS=( README RELEASE )
108
109 +PATCHES=(
110 + # Fixes some tests on various platforms (AMD Phenom, ARM, etc) with more suitable
111 + # float comparison - https://gitlab.freedesktop.org/gstreamer/orc/issues/18
112 + "${FILESDIR}"/${PV}-test-rounding.patch
113 +)
114 +
115 src_prepare() {
116 default