kumquat-buildroot/support/testing/infra/basetest.py
Sebastian Weyer f89f52168f support/testing/infra/basetest.py: use Bootlin toolchain stable 2022.08-1
This patch updates the default toolchain used for runtime tests. The
last time this toolchain was updated was in commit
0207a65323 3 years ago. Since then,
multiple things have changed:

Firstly, it used uclibc-ng as the libc whereas since commit
4057e36ca9, glibc is used as the default
library.

And secondly, since commit 531b2a10cd, buildroot
dropped the support for gcc 8 and it cannot be built internally anymore.
So the testsuite was executed using a toolchain that can't be built by
the Buildroot internal toolchain backend anymore.

This new Bootlin toolchain stable 2022.08-1 is based on gcc 11.3.0,
linux headers 4.9.327, glibc 2.35 and binutils 2.38.

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

Nowadays Bootlin toolchains are packaged in Buildroot and we can
directly select them from BASIC_TOOLCHAIN_CONFIG and avoid
setting the toolchain parameters (BR2_TOOLCHAIN_EXTERNAL_CUSTOM...).

The switch to Glibc requires to update some tests for the following
reasons:

- TestPython3Py, TestPython3Pyc and TestPython3PyPyc has been updated
  since they use the libc binary file name in their test
  (uClibc: libc.so.1 vs Glibc: libc.so.6).

- TestTmux needs at least one locale to pass (as stated in tmux help
  text "tmux needs a working UTF-8 locale"), so use "C.UTF-8".

- TestOpenSsh needs a toolchain >= 5.x due to a openssh issue
  (Similar to: https://bugs.busybox.net/show_bug.cgi?id=13671)
  Use the Bootlin toolchain bleeding-edge 2022.08-1 rhat provide
  kernel headers 5.4

- TestShadow needs a toolchain >= 4.14
  Use the Bootlin toolchain bleeding-edge 2022.08-1 rhat provide
  kernel headers 5.4

Runtime tested on the gcc farm server.

Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>
Signed-off-by: Romain Naour <romain.naour@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2023-07-12 23:22:14 +02:00

94 lines
2.7 KiB
Python

import unittest
import os
import datetime
from infra.builder import Builder
from infra.emulator import Emulator
BASIC_TOOLCHAIN_CONFIG = \
"""
BR2_arm=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_ARMV5_EABI_GLIBC_STABLE=y
"""
MINIMAL_CONFIG = \
"""
BR2_INIT_NONE=y
BR2_SYSTEM_BIN_SH_NONE=y
# BR2_PACKAGE_BUSYBOX is not set
# BR2_TARGET_ROOTFS_TAR is not set
"""
class BRConfigTest(unittest.TestCase):
"""Test up to the configure stage."""
config = None
br2_external = list()
downloaddir = None
outputdir = None
logtofile = True
keepbuilds = False
jlevel = 0
timeout_multiplier = 1
def __init__(self, names):
super(BRConfigTest, self).__init__(names)
self.testname = self.__class__.__name__
self.builddir = self.outputdir and os.path.join(self.outputdir, self.testname)
self.config += '\nBR2_DL_DIR="{}"\n'.format(self.downloaddir)
self.config += "\nBR2_JLEVEL={}\n".format(self.jlevel)
def show_msg(self, msg):
print("{} {:40s} {}".format(datetime.datetime.now().strftime("%H:%M:%S"),
self.testname, msg))
def setUp(self):
self.show_msg("Starting")
self.b = Builder(self.config, self.builddir, self.logtofile, self.jlevel)
if not self.keepbuilds:
self.b.delete()
if not self.b.is_finished():
self.b.configure(make_extra_opts=["BR2_EXTERNAL={}".format(":".join(self.br2_external))])
def tearDown(self):
self.show_msg("Cleaning up")
if self.b and not self.keepbuilds:
self.b.delete()
class BRTest(BRConfigTest):
"""Test up to the build stage and instantiate an emulator."""
def __init__(self, names):
super(BRTest, self).__init__(names)
self.emulator = None
def setUp(self):
super(BRTest, self).setUp()
if not self.b.is_finished():
self.show_msg("Building")
self.b.build()
self.show_msg("Building done")
self.emulator = Emulator(self.builddir, self.downloaddir,
self.logtofile, self.timeout_multiplier)
def tearDown(self):
if self.emulator:
self.emulator.stop()
super(BRTest, self).tearDown()
# Run the given 'cmd' with a 'timeout' on the target and
# assert that the command succeeded; on error, print the
# faulty command and its output
def assertRunOk(self, cmd, timeout=-1):
out, exit_code = self.emulator.run(cmd, timeout)
self.assertEqual(
exit_code,
0,
"\nFailed to run: {}\noutput was:\n{}".format(cmd, ' '+'\n '.join(out))
)