diff mbox series

[RFC,next,2/2] support/testing/tests/core/test_kernel3_10: new test

Message ID 20220822221430.355066-2-ju.o@free.fr
State Rejected
Headers show
Series [RFC,next,1/2] linux: fix builds for kernels < 5.6 and host-gcc >= 10 | expand

Commit Message

Julien Olivain Aug. 22, 2022, 10:14 p.m. UTC
This commit add a test to check that a relatively old 3.10 kernel are
building successfully in Buildroot. This test was written for
investigating the bug described in:
- https://bugs.busybox.net/show_bug.cgi?id=14971

Signed-off-by: Julien Olivain <ju.o@free.fr>
---
Tested with:

    python3 -m flake8 \
        support/testing/tests/core/test_kernel3_10.py
    [no-output]

    support/testing/run-tests \
        -d dl \
        -o output_folder tests.core.test_kernel3_10.TestOldKernel3_10
    ...
    OK
---
 DEVELOPERS                                    |  1 +
 support/testing/tests/core/test_kernel3_10.py | 43 +++++++++++++++++++
 2 files changed, 44 insertions(+)
 create mode 100644 support/testing/tests/core/test_kernel3_10.py

Comments

Yann E. MORIN Dec. 31, 2022, 7:38 p.m. UTC | #1
Julien, All,

On 2022-08-23 00:14 +0200, Julien Olivain spake thusly:
> This commit add a test to check that a relatively old 3.10 kernel are
> building successfully in Buildroot. This test was written for
> investigating the bug described in:
> - https://bugs.busybox.net/show_bug.cgi?id=14971
> 
> Signed-off-by: Julien Olivain <ju.o@free.fr>
> ---
[--SNIP--]
> diff --git a/support/testing/tests/core/test_kernel3_10.py b/support/testing/tests/core/test_kernel3_10.py
> new file mode 100644
> index 0000000000..5ff5ed1cad
> --- /dev/null
> +++ b/support/testing/tests/core/test_kernel3_10.py
> @@ -0,0 +1,43 @@
> +import os
> +
> +import infra.basetest
> +
> +
> +# For testing the compilation of an old 3.10 kernel, we use a armv7
> +# gcc5 bootlin toolchain, which also includes 3.10 kernel headers.

I'm not sure we want such a test. If we wanted to test that we can build
an older kernel, then we should use a state-of-the-art toolchain, i.e.
at least the default settings in Buildroot, not an older toolchain.

However, that would validate that he kernel itself can be built with a
recent compiler, not that the kernel build infra can be built; indeed,
the infra uses the host compiler, not the target compiler, but we have
no way to test with a latest-ish gcc:

  * our reference image is still using an old system especially because
    we also want to ensure that we can still use Buildroot on such old
    systems;

  * we can't know what users have on their machine if they run the
    runtime test locally.

So, I am not sure this test is entirely meaningful.

Regards,
Yann E. MORIN.

> +class TestOldKernel3_10(infra.basetest.BRTest):
> +    config = \
> +        """
> +        BR2_arm=y
> +        BR2_cortex_a9=y
> +        BR2_ARM_EABIHF=y
> +        BR2_ARM_ENABLE_NEON=y
> +        BR2_ARM_ENABLE_VFP=y
> +        BR2_LINUX_KERNEL=y
> +        BR2_LINUX_KERNEL_CUSTOM_VERSION=y
> +        BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="3.10.108"
> +        BR2_LINUX_KERNEL_DEFCONFIG="vexpress"
> +        BR2_LINUX_KERNEL_DTS_SUPPORT=y
> +        BR2_LINUX_KERNEL_INTREE_DTS_NAME="vexpress-v2p-ca9"
> +        BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
> +        BR2_TARGET_ROOTFS_CPIO=y
> +        BR2_TARGET_ROOTFS_CPIO_GZIP=y
> +        BR2_TOOLCHAIN_EXTERNAL=y
> +        BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
> +        BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y
> +        BR2_TOOLCHAIN_EXTERNAL_CXX=y
> +        BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y
> +        BR2_TOOLCHAIN_EXTERNAL_GCC_5=y
> +        BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_10=y
> +        BR2_TOOLCHAIN_EXTERNAL_URL="https://toolchains.bootlin.com/downloads/releases/toolchains/armv7-eabihf/tarballs/armv7-eabihf--glibc--stable-2017.05-toolchains-1-1.tar.bz2"
> +        """
> +
> +    def test_run(self):
> +        initrd = os.path.join(self.builddir, "images", "rootfs.cpio.gz")
> +        kern = os.path.join(self.builddir, "images", "zImage")
> +        dtb = os.path.join(self.builddir, "images", "vexpress-v2p-ca9.dtb")
> +        self.emulator.boot(arch="armv7", kernel=kern,
> +                           kernel_cmdline=["console=ttyAMA0"],
> +                           options=["-M", "vexpress-a9", "-dtb", dtb, "-initrd", initrd])
> +        self.emulator.login()
> +        self.assertRunOk("true")
> -- 
> 2.37.2
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
diff mbox series

Patch

diff --git a/DEVELOPERS b/DEVELOPERS
index 4287fd9cf7..5cf63e919e 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1680,6 +1680,7 @@  F:	package/python-gnupg/
 F:	package/python-pyalsa/
 F:	package/riscv-isa-sim/
 F:	package/zynaddsubfx/
+F:	support/testing/tests/core/test_kernel3_10.py
 F:	support/testing/tests/package/sample_python_distro.py
 F:	support/testing/tests/package/sample_python_gnupg.py
 F:	support/testing/tests/package/sample_python_pyalsa.py
diff --git a/support/testing/tests/core/test_kernel3_10.py b/support/testing/tests/core/test_kernel3_10.py
new file mode 100644
index 0000000000..5ff5ed1cad
--- /dev/null
+++ b/support/testing/tests/core/test_kernel3_10.py
@@ -0,0 +1,43 @@ 
+import os
+
+import infra.basetest
+
+
+# For testing the compilation of an old 3.10 kernel, we use a armv7
+# gcc5 bootlin toolchain, which also includes 3.10 kernel headers.
+class TestOldKernel3_10(infra.basetest.BRTest):
+    config = \
+        """
+        BR2_arm=y
+        BR2_cortex_a9=y
+        BR2_ARM_EABIHF=y
+        BR2_ARM_ENABLE_NEON=y
+        BR2_ARM_ENABLE_VFP=y
+        BR2_LINUX_KERNEL=y
+        BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+        BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="3.10.108"
+        BR2_LINUX_KERNEL_DEFCONFIG="vexpress"
+        BR2_LINUX_KERNEL_DTS_SUPPORT=y
+        BR2_LINUX_KERNEL_INTREE_DTS_NAME="vexpress-v2p-ca9"
+        BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
+        BR2_TARGET_ROOTFS_CPIO=y
+        BR2_TARGET_ROOTFS_CPIO_GZIP=y
+        BR2_TOOLCHAIN_EXTERNAL=y
+        BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
+        BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y
+        BR2_TOOLCHAIN_EXTERNAL_CXX=y
+        BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y
+        BR2_TOOLCHAIN_EXTERNAL_GCC_5=y
+        BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_10=y
+        BR2_TOOLCHAIN_EXTERNAL_URL="https://toolchains.bootlin.com/downloads/releases/toolchains/armv7-eabihf/tarballs/armv7-eabihf--glibc--stable-2017.05-toolchains-1-1.tar.bz2"
+        """
+
+    def test_run(self):
+        initrd = os.path.join(self.builddir, "images", "rootfs.cpio.gz")
+        kern = os.path.join(self.builddir, "images", "zImage")
+        dtb = os.path.join(self.builddir, "images", "vexpress-v2p-ca9.dtb")
+        self.emulator.boot(arch="armv7", kernel=kern,
+                           kernel_cmdline=["console=ttyAMA0"],
+                           options=["-M", "vexpress-a9", "-dtb", dtb, "-initrd", initrd])
+        self.emulator.login()
+        self.assertRunOk("true")