[Buildroot] [PATCH 02/11] support/testing/infra/basetest.py: add BRHostPkgTest class
Thomas Petazzoni
thomas.petazzoni at bootlin.com
Sat Oct 18 19:43:00 UTC 2025
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-<foo>
host-<bar>", 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 <thomas.petazzoni at bootlin.com>
---
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):
--
2.51.0
More information about the buildroot
mailing list