diff options
author | Michael Orlitzky <mjo@gentoo.org> | 2024-06-30 20:19:53 -0400 |
---|---|---|
committer | Michael Orlitzky <mjo@gentoo.org> | 2024-06-30 20:22:25 -0400 |
commit | 711048ea5f88dac08d70ff8c28f825f9a8985c4b (patch) | |
tree | 152650f5b646ae0ebb86b2e0d8f58ad079a1bd9e /sci-libs | |
parent | kde-frameworks/kcontacts: Disable failing kcontacts-phonenumbertest (diff) | |
download | gentoo-711048ea5f88dac08d70ff8c28f825f9a8985c4b.tar.gz gentoo-711048ea5f88dac08d70ff8c28f825f9a8985c4b.tar.bz2 gentoo-711048ea5f88dac08d70ff8c28f825f9a8985c4b.zip |
sci-libs/gsl: fudge tolerance to fix a flaky test
Add a non-upstream patch to embiggen this tolerance.
Closes: https://bugs.gentoo.org/664936
Signed-off-by: Michael Orlitzky <mjo@gentoo.org>
Diffstat (limited to 'sci-libs')
-rw-r--r-- | sci-libs/gsl/files/gsl-2.7.1-test-tolerance.patch | 47 | ||||
-rw-r--r-- | sci-libs/gsl/gsl-2.7.1-r3.ebuild | 62 |
2 files changed, 109 insertions, 0 deletions
diff --git a/sci-libs/gsl/files/gsl-2.7.1-test-tolerance.patch b/sci-libs/gsl/files/gsl-2.7.1-test-tolerance.patch new file mode 100644 index 000000000000..8ddce4388e90 --- /dev/null +++ b/sci-libs/gsl/files/gsl-2.7.1-test-tolerance.patch @@ -0,0 +1,47 @@ +From 8306771281f9b2883c5200ee241b0c0767bfe1b4 Mon Sep 17 00:00:00 2001 +From: Michael Orlitzky <michael@orlitzky.com> +Date: Sun, 30 Jun 2024 19:45:45 -0400 +Subject: [PATCH 1/1] eigen/test.c: loosen tolerance in eigenvalue norm tests + +One test for the (unit) norm of a random hermitian matrix's +eigenvalues is victim to tolerance issues, e.g. + + FAIL: herm random, normalized(1), unsorted (0.999999999999999112 + observed vs 1 expected) [117761] + +The tolerance used is N*GSL_DBL_EPSILON, where N is the size of the +matrix. On my machine, the actual error is four times GSL_DBL_EPSILON, +which means that the tolernace is close but not quite right. Despite +having done a PhD in numerical analysis, I am choosing to fix this +with a shotgun: + + * By a factor of 10 + * Then also by a factor of N + +That's still extremely close, and hopefully will sweep the problem +under the rug whether it's off by a constant or off by a function +of N. + +Bug: https://bugs.gentoo.org/664936 +Bug: https://git.adelielinux.org/adelie/packages/-/issues/504 +Bug: https://savannah.gnu.org/bugs/?56843 +--- + eigen/test.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/eigen/test.c b/eigen/test.c +index b0bdcc7..2681721 100644 +--- a/eigen/test.c ++++ b/eigen/test.c +@@ -506,7 +506,7 @@ test_eigen_herm_results (const gsl_matrix_complex * A, + { + gsl_vector_complex_const_view vi = gsl_matrix_complex_const_column(evec, i); + double nrm_v = gsl_blas_dznrm2(&vi.vector); +- gsl_test_rel (nrm_v, 1.0, N * GSL_DBL_EPSILON, "%s, normalized(%d), %s", ++ gsl_test_rel (nrm_v, 1.0, N*N * 10.0 * GSL_DBL_EPSILON, "%s, normalized(%d), %s", + desc, i, desc2); + } + +-- +2.44.2 + diff --git a/sci-libs/gsl/gsl-2.7.1-r3.ebuild b/sci-libs/gsl/gsl-2.7.1-r3.ebuild new file mode 100644 index 000000000000..81205249e873 --- /dev/null +++ b/sci-libs/gsl/gsl-2.7.1-r3.ebuild @@ -0,0 +1,62 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit autotools flag-o-matic toolchain-funcs + +DESCRIPTION="The GNU Scientific Library" +HOMEPAGE="https://www.gnu.org/software/gsl/" +SRC_URI="mirror://gnu/${PN}/${P}.tar.gz + https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${PN}-2.7-cblas.patch.bz2" + +LICENSE="GPL-3+" +# Usually 0/${PV} but check +SLOT="0/27" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux" +IUSE="cblas-external +deprecated static-libs" + +RDEPEND="cblas-external? ( virtual/cblas:= )" +DEPEND="${RDEPEND}" +BDEPEND="virtual/pkgconfig" + +PATCHES=( + "${WORKDIR}"/${PN}-2.7-cblas.patch + "${FILESDIR}"/${PN}-2.7.1-configure-clang16.patch + "${FILESDIR}"/${PN}-2.7.1-test-tolerance.patch +) + +src_prepare() { + default + + if use deprecated; then + sed -i -e "/GSL_DISABLE_DEPRECATED/,+2d" configure.ac || die + fi + + eautoreconf +} + +src_configure() { + filter-flags -ffast-math + + if use cblas-external; then + export CBLAS_LIBS="$($(tc-getPKG_CONFIG) --libs cblas)" + export CBLAS_CFLAGS="$($(tc-getPKG_CONFIG) --cflags cblas)" + fi + + econf \ + --enable-shared \ + $(use_with cblas-external) \ + $(use_enable static-libs static) +} + +src_test() { + local MAKEOPTS="${MAKEOPTS} -j1" + default +} + +src_install() { + default + + find "${ED}" -name '*.la' -delete || die +} |