commit:     abf9dd297641ae488de4100ef7ba32626f6f6f88
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Oct  1 10:51:04 2025 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Oct  1 10:52:17 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=abf9dd29

sci-libs/blas-lapack-aux-wrapper: Run a few LAPACK tests

Build and run BLAS, CBLAS and LAPACK tests from the Netlib archive
to ensure that the wrappers actually work, and the linked files are run
via FlexiBLAS.

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 sci-libs/blas-lapack-aux-wrapper/Manifest          |  1 +
 .../blas-lapack-aux-wrapper-0-r1.ebuild            | 65 +++++++++++++++++++++-
 2 files changed, 63 insertions(+), 3 deletions(-)

diff --git a/sci-libs/blas-lapack-aux-wrapper/Manifest 
b/sci-libs/blas-lapack-aux-wrapper/Manifest
index 4cf768a27fe8..754a89557ad4 100644
--- a/sci-libs/blas-lapack-aux-wrapper/Manifest
+++ b/sci-libs/blas-lapack-aux-wrapper/Manifest
@@ -1 +1,2 @@
 DIST blas-lapack-aux-wrapper-0.tar.xz 8356 BLAKE2B 
765c1efad487d449064892ba8213232b245cb33159dcc35c3fda2552f72d8097ff8e21e711b81c4598a9c76a6ce2314fd86a5a1f171917f079ddb008d5547d64
 SHA512 
412662a79f2c01a12a0ac4e656710675487036172704ab88093f04626c5adb4770503b65184ce8546ac10d8b522ee2241cb6e638ccfc10a005bf6d55597a3830
+DIST lapack-3.12.1.tar.gz 8067087 BLAKE2B 
13fd3bbb6d1f23eb0add0a71d302af7af172d608b3e2354031d0b13cb7fbf243017d85b53ca04322983c5ed069ad3773510833d231d533b2dc417962cc24a817
 SHA512 
9749976d773830eb635498611c7f1247af8dece23fe8c08446243aa39bdcc20dd35fdc670345643cd1ec6828e379d5c2152009817e0b486c10fd89a06602e0fb

diff --git 
a/sci-libs/blas-lapack-aux-wrapper/blas-lapack-aux-wrapper-0-r1.ebuild 
b/sci-libs/blas-lapack-aux-wrapper/blas-lapack-aux-wrapper-0-r1.ebuild
index fe8145a3b8a8..37e50ee35dd5 100644
--- a/sci-libs/blas-lapack-aux-wrapper/blas-lapack-aux-wrapper-0-r1.ebuild
+++ b/sci-libs/blas-lapack-aux-wrapper/blas-lapack-aux-wrapper-0-r1.ebuild
@@ -5,16 +5,24 @@ EAPI=8
 
 PYTHON_COMPAT=( python3_{11..14} )
 
-inherit meson python-any-r1
+inherit meson python-any-r1 toolchain-funcs
 
+LAPACK_VER=3.12.1
 DESCRIPTION="BLAS/LAPACK wrappers for FlexiBLAS"
 HOMEPAGE="https://gitweb.gentoo.org/proj/blas-lapack-aux-wrapper.git/";
-SRC_URI="https://dev.gentoo.org/~mgorny/dist/${P}.tar.xz";
+SRC_URI="
+       https://dev.gentoo.org/~mgorny/dist/${P}.tar.xz
+       test? (
+               
https://github.com/Reference-LAPACK/lapack/archive/v${LAPACK_VER}.tar.gz
+                       -> lapack-${LAPACK_VER}.tar.gz
+       )
+"
 
 LICENSE="GPL-2+"
 SLOT="0"
 KEYWORDS="~amd64"
-IUSE="index64"
+IUSE="index64 test"
+RESTRICT="!test? ( test )"
 
 RDEPEND="
        !sci-libs/lapack[-flexiblas(-)]
@@ -39,6 +47,57 @@ src_configure() {
        meson_src_configure
 }
 
+check_result() {
+       local f=${1}
+
+       if ! grep -q "flexiblas.*TRIGGER-WARNING" "${f}.out"; then
+               die "No FlexiBLAS output found in ${f}.out"
+       fi
+       if grep -q -i "FAIL" "${f}.out"; then
+               die "Test failed in ${f}.out"
+       fi
+}
+
+run_test() {
+       local f=${1}
+
+       einfo "Running ${f} ..."
+       "${f}" &> "${f}.out" || die "Running ${f} failed"
+       check_result "${f}"
+}
+
+src_test() {
+       # Force a nonexisting provider to:
+       # a. get indication that FlexiBLAS is actually used on stderr.
+       # b. force fallback to Netlib LAPACK.
+       local -x FLEXIBLAS=trigger-warning
+       tc-export CC FC AR RANLIB
+
+       cd "${WORKDIR}/lapack-${LAPACK_VER}" || die
+       cat > make.inc <<-EOF || die
+               FFLAGS_DRV   = \$(FFLAGS)
+               FFLAGS_NOOPT = \$(FFLAGS) -O0
+               ARFLAGS      = rv
+
+               BLASLIB      = ${BUILD_DIR}/libblas.so
+               CBLASLIB     = ${BUILD_DIR}/libcblas.so
+               LAPACKLIB    = ${BUILD_DIR}/liblapack.so
+               TMGLIB       = \$(TOPSRCDIR)/libtmglib.a
+               LAPACKELIB   = ${BUILD_DIR}/liblapacke.so
+       EOF
+
+       emake -C BLAS/TESTING xblat1d
+       emake -C CBLAS include/cblas_mangling.h
+       run_test BLAS/TESTING/xblat1d
+
+       emake -C CBLAS/testing xdcblat1
+       run_test CBLAS/testing/xdcblat1
+
+       emake -C TESTING/MATGEN
+       emake -C TESTING dbb.out
+       check_result TESTING/dbb
+}
+
 src_install() {
        meson_src_install
 

Reply via email to