From 3686e16b5213431ee44d6599486d05d9c07854d1 Mon Sep 17 00:00:00 2001 From: Julien Olivain Date: Mon, 8 May 2023 20:10:01 +0200 Subject: [PATCH] support/testing/tests/package/test_openblas.py: new runtime test Signed-off-by: Julien Olivain Signed-off-by: Yann E. MORIN --- 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 efb2907d1b..37c1f06ec1 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -1748,6 +1748,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)