[Buildroot] [PATCH 1/1] support/testing/infra/basetest.py: use Bootlin toolchain bleeding edge 2022.08-1

Romain Naour romain.naour at smile.fr
Tue Jun 6 20:50:30 UTC 2023


Hello Sebastian,

Le 30/03/2023 à 13:27, Sebastian Weyer a écrit :
> This patch updates the default toolchain used for runtime tests. The
> last time this toolchain was updated was in commit
> 0207a65323fc73fe9570f3d7e03bbfed4ab6d477 3 years ago. Since then,
> multiple things have changed:
> 
> Firstly, it used uclibc-ng as the libc whereas since commit
> 4057e36ca9665edd5248512e4edba2c243b8f4be, glibc is used as the default
> library.
> 
> And secondly, since commit 531b2a10cda6bae78ecc141c9fe48f2024f71dbc, buildroot
> dropped the support for gcc 8 and it cannot be built internally anymore.
> 
> This new toolchain bleeding edge 2022.08-1 is based on gcc 12.2.0, linux
> headers 5.4.212, glibc 2.35 and binutils 2.39.

I'm not sure we really want to use the bleeding edge toolchain for the
testsuite. Please use the stable one that provide gcc 11 (the current gcc
default version).

> It is now required to add enable BR2_TOOLCHAIN_USES_GLIBC and
> BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC since uclibc-ng is still the
> standard choice when using an external toolchain. If one were to change
> this, it would break the builds for people using a uclibc toolchain with
> a recent version of buildroot. BR2_TOOLCHAIN_EXTERNAL_LOCALE doesn't
> need to be enabled anymore since it is implicit in glibc.
> BR2_TOOLCHAIN_EXTERNAL_INET_RPC needs to be disabled since support has
> been dropped by glibc but it is selected by default when choosing glibc.

IIRC last time the BASIC_TOOLCHAIN_CONFIG was updated (2020.04), the Bootlin
toolchains were not packaged as external toolchain (added in 2020.08).

That's why at that time we used BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC but now you
can use:

     BR2_arm=y
     BR2_TOOLCHAIN_EXTERNAL=y
     BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
     BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_ARMV5_EABI_GLIBC_STABLE=y

> 
> The previous toolchain bleeding edge 2018.11-1 is based on gcc 8.2.0,
> linux headers 4.14.80, uclibc 1.0.30 and binutils 2.31.1

If you look closer, you will notice that some tests are using explicitely a
glibc toolchain:

 class TestPythonPy3Autobahn(TestPythonPackageBase):
     __test__ = True
    # Need to use a different toolchain than the default due to
    # python-cryptography using Rust (not available with uclibc)
    config = \
         """
         BR2_arm=y
         BR2_TOOLCHAIN_EXTERNAL=y
         BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
         BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_ARMV5_EABI_GLIBC_STABLE=y

now you can simply use the toolchain provided your update :)

class TestPythonPy3Autobahn(TestPythonPackageBase):
     __test__ = True
     config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
         """

When the test must be built with an uClibc-ng toolchain, you can do
    config = \
         """
         BR2_arm=y
         BR2_TOOLCHAIN_EXTERNAL=y
         BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
         BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_ARMV5_EABI_UCLIBC_STABLE=y

Some test are named with the libc implementation (TestOpenSshuClibc) but
since you switch to glibc, you have to update the toolchain configuration.
Otherwise a test TestOpenSshuClibc will be built with a Glibc toolchain.

Be careful with the rootfs size, glibc toolchain are "slightly" bigger that
uclibc toolchain, you may have to increase BR2_TARGET_ROOTFS_EXT2_SIZE.

> 
> Tested with gitlab:
> https://gitlab.com/DocSepp/buildroot/-/pipelines/821745386/
> 
> Due to gitlab constraints it's not possible to check all the tests. Most
> of the tests that did not succeed didn't because of such constraints.
> The remaining fails are missing python or perl modules, timeouts because
> the test takes more than 3h, tests.package.test_kexec.TestKexec  is
> executed with a property that is unknown to qemu and several tests use a
> different toolchain.
> 
> I noticed 4 tests, TestPython3Py, TestPython3Pyc, TestPython3PyPyc and
> TestTmux that failed due to locale and libc.so.1 not found errors. I
> verified that they did run with the previous toolchain and subsequently
> introduced changes in their configs so the tests succeed with the new
> toolchain.

I would suggest to explain why we have to update some tests due to the glibc
switch. The libc.so.1 update is easy but TestTmux update that now requires a
locale is not.

Best regards,
Romain

> 
> Signed-off-by: Sebastian Weyer <sebastian.weyer at smile.fr>
> ---
>  support/testing/infra/basetest.py            | 10 ++++++----
>  support/testing/tests/package/test_python.py |  2 +-
>  support/testing/tests/package/test_tmux.py   |  1 +
>  3 files changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/support/testing/infra/basetest.py b/support/testing/infra/basetest.py
> index 670c7213d6..586b51e56e 100644
> --- a/support/testing/infra/basetest.py
> +++ b/support/testing/infra/basetest.py
> @@ -10,13 +10,15 @@ BASIC_TOOLCHAIN_CONFIG = \
>      BR2_arm=y
>      BR2_TOOLCHAIN_EXTERNAL=y
>      BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
> +    BR2_TOOLCHAIN_USES_GLIBC=y
> +    BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y
>      BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y
> -    BR2_TOOLCHAIN_EXTERNAL_URL="https://toolchains.bootlin.com/downloads/releases/toolchains/armv5-eabi/tarballs/armv5-eabi--uclibc--bleeding-edge-2018.11-1.tar.bz2"
> -    BR2_TOOLCHAIN_EXTERNAL_GCC_8=y
> -    BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_14=y
> -    BR2_TOOLCHAIN_EXTERNAL_LOCALE=y
> +    BR2_TOOLCHAIN_EXTERNAL_URL="https://toolchains.bootlin.com/downloads/releases/toolchains/armv5-eabi/tarballs/armv5-eabi--glibc--bleeding-edge-2022.08-1.tar.bz2"
> +    BR2_TOOLCHAIN_EXTERNAL_GCC_12=y
> +    BR2_TOOLCHAIN_EXTERNAL_HEADERS_5_4=y
>      BR2_TOOLCHAIN_HAS_THREADS_DEBUG=y
>      BR2_TOOLCHAIN_EXTERNAL_CXX=y
> +    # BR2_TOOLCHAIN_EXTERNAL_INET_RPC is not set
>      """
>  
>  MINIMAL_CONFIG = \
> diff --git a/support/testing/tests/package/test_python.py b/support/testing/tests/package/test_python.py
> index d6f69a83c7..c9ecf9acda 100644
> --- a/support/testing/tests/package/test_python.py
> +++ b/support/testing/tests/package/test_python.py
> @@ -29,7 +29,7 @@ class TestPythonBase(infra.basetest.BRTest):
>      def libc_time_test(self, timeout=-1):
>          cmd = self.interpreter + " -c '"
>          cmd += "import ctypes;"
> -        cmd += "libc = ctypes.cdll.LoadLibrary(\"libc.so.1\");"
> +        cmd += "libc = ctypes.cdll.LoadLibrary(\"libc.so.6\");"
>          cmd += "print(libc.time(None))'"
>          self.assertRunOk(cmd, timeout)
>  
> diff --git a/support/testing/tests/package/test_tmux.py b/support/testing/tests/package/test_tmux.py
> index 7a10b7a2b0..f2c620d5ca 100644
> --- a/support/testing/tests/package/test_tmux.py
> +++ b/support/testing/tests/package/test_tmux.py
> @@ -9,6 +9,7 @@ class TestTmux(infra.basetest.BRTest):
>          BR2_PACKAGE_TMUX=y
>          BR2_TARGET_ROOTFS_CPIO=y
>          # BR2_TARGET_ROOTFS_TAR is not set
> +        BR2_GENERATE_LOCALE="C.UTF-8"
>          """
>  
>      def test_run(self):




More information about the buildroot mailing list