From 9468f1c099221461abaf5ab152788e692119b8dd Mon Sep 17 00:00:00 2001 From: Thomas Petazzoni Date: Sat, 18 Oct 2025 21:43:00 +0200 Subject: [PATCH] support/testing/infra/basetest.py: add BRHostPkgTest class Runtime test cases are currently mostly used to test target packages, and the BRTest class is perfect for that as we can easily feed a Buildroot configuration, boot it under Qemu and run commands inside the emulator. A few tests use the more basic BRConfigTest when they have special needs that don't match with BRTest. However, as we are going to add a number of tests to verify the proper functionality of some host only packages, which have no visible menuconfig option, it makes sense to add another BRHostPkgTest class that allows to easily trigger the build of "make host- host-", and then run some commands on the host machine. Such tests could be done by using BRConfigTest, but that would require a bit of duplicated boilerplate, which BRHostPkgTest allows to remove. Signed-off-by: Thomas Petazzoni Signed-off-by: Julien Olivain --- support/testing/infra/basetest.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/support/testing/infra/basetest.py b/support/testing/infra/basetest.py index 9fb9dffc53..13f9b2d398 100644 --- a/support/testing/infra/basetest.py +++ b/support/testing/infra/basetest.py @@ -60,6 +60,28 @@ class BRConfigTest(unittest.TestCase): self.b.delete() +class BRHostPkgTest(BRConfigTest): + """Test up to the build stage of a host package. Define hostpkgs in + the class to the list of host packages that should be built.""" + config = \ + BASIC_TOOLCHAIN_CONFIG + \ + MINIMAL_CONFIG + hostpkgs = None + + def __init__(self, names): + super(BRHostPkgTest, self).__init__(names) + + def setUp(self): + super(BRHostPkgTest, self).setUp() + if not self.b.is_finished(): + self.show_msg("Building") + self.b.build(make_extra_opts=self.hostpkgs) + self.show_msg("Building done") + + def tearDown(self): + super(BRHostPkgTest, self).tearDown() + + class BRTest(BRConfigTest): """Test up to the build stage and instantiate an emulator.""" def __init__(self, names):