[Buildroot] [git commit] package/openblas: add a new option to install tests

Yann E. MORIN yann.morin.1998 at free.fr
Mon May 8 20:47:00 UTC 2023


commit: https://git.buildroot.net/buildroot/commit/?id=a0484b888f8d1e30590758d8a8f6730e3a2890fa
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master

This option can be used for runtime testing or package debugging.

Signed-off-by: Julien Olivain <ju.o at free.fr>
[yann.morin.1998 at free.fr: tweak the comment]
Signed-off-by: Yann E. MORIN <yann.morin.1998 at free.fr>
---
 package/openblas/Config.in   |  5 +++++
 package/openblas/openblas.mk | 19 +++++++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/package/openblas/Config.in b/package/openblas/Config.in
index 0144e93a3f..58976e657a 100644
--- a/package/openblas/Config.in
+++ b/package/openblas/Config.in
@@ -94,4 +94,9 @@ config BR2_PACKAGE_OPENBLAS_USE_LOCKING
 	  function calls from multiple threads, then locking is
 	  mandatory for correct operation.
 
+config BR2_PACKAGE_OPENBLAS_INSTALL_TESTS
+	bool "install tests"
+	help
+	  Install C test programs on target.
+
 endif
diff --git a/package/openblas/openblas.mk b/package/openblas/openblas.mk
index f7a50d7bc7..d8fcb4a2c6 100644
--- a/package/openblas/openblas.mk
+++ b/package/openblas/openblas.mk
@@ -77,4 +77,23 @@ define OPENBLAS_INSTALL_TARGET_CMDS
 		-C $(@D) install PREFIX=$(TARGET_DIR)/usr
 endef
 
+ifeq ($(BR2_PACKAGE_OPENBLAS_INSTALL_TESTS),y)
+# Tests are always built, but are not installed, so we need to install
+# them manually. The set of available tests may fluctuate depending on
+# the architecture and other options, so only install whatever gets
+# built.
+define OPENBLAS_INSTALL_TESTS
+	mkdir -p $(TARGET_DIR)/usr/libexec/openblas/tests
+	find $(@D)/ctest \
+		-type f -name "x[sdcz]cblat[123]" -perm -0100 \
+		-exec $(INSTALL) -m 0755 {} \
+			$(TARGET_DIR)/usr/libexec/openblas/tests \;
+	find $(@D)/ctest \
+		-type f -name "[sdcz]in[123]" \
+		-exec $(INSTALL) -m 0644 {} \
+			$(TARGET_DIR)/usr/libexec/openblas/tests \;
+endef
+OPENBLAS_POST_INSTALL_TARGET_HOOKS += OPENBLAS_INSTALL_TESTS
+endif
+
 $(eval $(generic-package))



More information about the buildroot mailing list