* [Buildroot] [PATCH 1/2] package/openblas: add a new option to install tests
@ 2023-05-08 18:10 Julien Olivain
2023-05-08 18:10 ` [Buildroot] [PATCH 2/2] support/testing/tests/package/test_openblas.py: new runtime test Julien Olivain
2023-05-08 20:56 ` [Buildroot] [PATCH 1/2] package/openblas: add a new option to install tests Yann E. MORIN
0 siblings, 2 replies; 3+ messages in thread
From: Julien Olivain @ 2023-05-08 18:10 UTC (permalink / raw)
To: buildroot; +Cc: Julien Olivain
This option can be used for runtime testing or package debugging.
Signed-off-by: Julien Olivain <ju.o@free.fr>
---
package/openblas/Config.in | 5 +++++
package/openblas/openblas.mk | 18 ++++++++++++++++++
2 files changed, 23 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..3fa0bbfce7 100644
--- a/package/openblas/openblas.mk
+++ b/package/openblas/openblas.mk
@@ -77,4 +77,22 @@ define OPENBLAS_INSTALL_TARGET_CMDS
-C $(@D) install PREFIX=$(TARGET_DIR)/usr
endef
+ifeq ($(BR2_PACKAGE_OPENBLAS_INSTALL_TESTS),y)
+# The actual test list depends on the architecture and/or some build
+# options. This macro installs all the test programs and input data
+# found in the ctest build directory.
+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))
--
2.40.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Buildroot] [PATCH 2/2] support/testing/tests/package/test_openblas.py: new runtime test
2023-05-08 18:10 [Buildroot] [PATCH 1/2] package/openblas: add a new option to install tests Julien Olivain
@ 2023-05-08 18:10 ` Julien Olivain
2023-05-08 20:56 ` [Buildroot] [PATCH 1/2] package/openblas: add a new option to install tests Yann E. MORIN
1 sibling, 0 replies; 3+ messages in thread
From: Julien Olivain @ 2023-05-08 18:10 UTC (permalink / raw)
To: buildroot; +Cc: Julien Olivain
Signed-off-by: Julien Olivain <ju.o@free.fr>
---
Patch tested on branch master at commit d2f45de with commands:
utils/docker-run make check-package
379602 lines processed
0 warnings generated
support/testing/run-tests \
-d dl -o output_folder \
tests.package.test_openblas
...
OK
---
DEVELOPERS | 1 +
.../testing/tests/package/test_openblas.py | 56 +++++++++++++++++++
2 files changed, 57 insertions(+)
create mode 100644 support/testing/tests/package/test_openblas.py
diff --git a/DEVELOPERS b/DEVELOPERS
index 5658dfa14b..ffece52d6a 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1749,6 +1749,7 @@ F: support/testing/tests/package/test_ncdu.py
F: support/testing/tests/package/test_octave.py
F: support/testing/tests/package/test_ola.py
F: support/testing/tests/package/test_ola/
+F: support/testing/tests/package/test_openblas.py
F: support/testing/tests/package/test_perftest.py
F: support/testing/tests/package/test_python_distro.py
F: support/testing/tests/package/test_python_gnupg.py
diff --git a/support/testing/tests/package/test_openblas.py b/support/testing/tests/package/test_openblas.py
new file mode 100644
index 0000000000..9cfe08ef2c
--- /dev/null
+++ b/support/testing/tests/package/test_openblas.py
@@ -0,0 +1,56 @@
+import os
+
+import infra.basetest
+
+
+class TestOpenBLAS(infra.basetest.BRTest):
+ config = \
+ """
+ BR2_aarch64=y
+ BR2_TOOLCHAIN_EXTERNAL=y
+ BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
+ BR2_LINUX_KERNEL=y
+ BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+ BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.1.27"
+ BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
+ BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/aarch64-virt/linux.config"
+ BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
+ BR2_TARGET_ROOTFS_CPIO=y
+ BR2_TARGET_ROOTFS_CPIO_GZIP=y
+ # BR2_TARGET_ROOTFS_TAR is not set
+ BR2_PACKAGE_OPENBLAS=y
+ BR2_PACKAGE_OPENBLAS_INSTALL_TESTS=y
+ """
+
+ def test_run(self):
+ img = os.path.join(self.builddir, "images", "rootfs.cpio.gz")
+ kern = os.path.join(self.builddir, "images", "Image")
+ self.emulator.boot(arch="aarch64",
+ kernel=kern,
+ kernel_cmdline=["console=ttyAMA0"],
+ options=["-M", "virt", "-cpu", "cortex-a57", "-smp", "2", "-m", "512M", "-initrd", img])
+ self.emulator.login()
+
+ test_prefix = "/usr/libexec/openblas/tests"
+
+ # BLAS data types:
+ blas_data_types = [
+ "s", # Single precision (32bit) float
+ "d", # Double precision (64bit) double
+ "c", # Single precision (32bit) complex
+ "z" # Double precision (64bit) complex
+ ]
+
+ # BLAS routine levels:
+ # Level 1: Vector operations,
+ # Level 2: Matrix-Vector operations,
+ # Level 3: Matrix-Matrix operations.
+ for blas_level in range(1, 4):
+ for blas_data_type in blas_data_types:
+ test_name = f"x{blas_data_type}cblat{blas_level}"
+ cmd = test_prefix + "/" + test_name
+
+ if blas_level > 1:
+ cmd += f" < {test_prefix}/{blas_data_type}in{blas_level}"
+
+ self.assertRunOk(cmd, timeout=30)
--
2.40.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Buildroot] [PATCH 1/2] package/openblas: add a new option to install tests
2023-05-08 18:10 [Buildroot] [PATCH 1/2] package/openblas: add a new option to install tests Julien Olivain
2023-05-08 18:10 ` [Buildroot] [PATCH 2/2] support/testing/tests/package/test_openblas.py: new runtime test Julien Olivain
@ 2023-05-08 20:56 ` Yann E. MORIN
1 sibling, 0 replies; 3+ messages in thread
From: Yann E. MORIN @ 2023-05-08 20:56 UTC (permalink / raw)
To: Julien Olivain; +Cc: buildroot
Julien, All,
On 2023-05-08 20:10 +0200, Julien Olivain spake thusly:
> This option can be used for runtime testing or package debugging.
>
> Signed-off-by: Julien Olivain <ju.o@free.fr>
Following our IRC discussion, and the various quick tests I did, it
looks like tests are always built, in fact. The only reason a test would
not be built, would be if BUILD_SINGLE et al. would be disabled.
We do not offer that possibility in Buildroot, but maybe that is
autodetected by openblas, where it would disable some stuff based on the
target processor (or whatever).
So, I tweaked the comment. It does not change much rom what you wrote.
in the end...
Applied to master, thanks.
Regards,
Yann E. MORIN.
> ---
> package/openblas/Config.in | 5 +++++
> package/openblas/openblas.mk | 18 ++++++++++++++++++
> 2 files changed, 23 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..3fa0bbfce7 100644
> --- a/package/openblas/openblas.mk
> +++ b/package/openblas/openblas.mk
> @@ -77,4 +77,22 @@ define OPENBLAS_INSTALL_TARGET_CMDS
> -C $(@D) install PREFIX=$(TARGET_DIR)/usr
> endef
>
> +ifeq ($(BR2_PACKAGE_OPENBLAS_INSTALL_TESTS),y)
> +# The actual test list depends on the architecture and/or some build
> +# options. This macro installs all the test programs and input data
> +# found in the ctest build directory.
> +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))
> --
> 2.40.1
>
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-05-08 20:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-08 18:10 [Buildroot] [PATCH 1/2] package/openblas: add a new option to install tests Julien Olivain
2023-05-08 18:10 ` [Buildroot] [PATCH 2/2] support/testing/tests/package/test_openblas.py: new runtime test Julien Olivain
2023-05-08 20:56 ` [Buildroot] [PATCH 1/2] package/openblas: add a new option to install tests Yann E. MORIN
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox