Skip to content

Commit

Permalink
tests: Fix top_dir test
Browse files Browse the repository at this point in the history
The top_dir test is failing on newer versions of python because it
requires that parsing be able to be done on the test host, which some
really old versions simply cannot do. Only run the test if the is
possible, and bump up Ubuntu 18.04 to test on Yocto 3.1
  • Loading branch information
JoshuaWatt committed Mar 21, 2024
1 parent c39d586 commit c701b42
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions ci/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,24 @@ def wrapper(self, *args, **kwargs):
return decorator


def minPokyVer(major, minor):
def ver_str(major, minor):
return "%d.%d" % (major, minor)

def decorator(func):
def wrapper(self, *args, **kwargs):
if self.pokyver < (major, minor):
self.skipTest(
"Test cannot be used with poky version < %s (using %s)"
% (ver_str(major, minor), ver_str(*self.pokyver))
)
return func(self, *args, **kwargs)

return wrapper

return decorator


built_images = set()


Expand Down Expand Up @@ -1052,6 +1070,7 @@ def test_templateconf_rel(self):
)
self.assertEqual(s, test_string)

@minPokyVer(3, 1)
def test_top_dir(self):
# Verify that the TOPDIR reported by bitbake in pyrex is the same as
# the one reported by bitbake outside of pyrex
Expand Down Expand Up @@ -1179,28 +1198,28 @@ class PyrexImageType_oetest(PyrexImageType_oe):
TEST_IMAGES = (
("ubuntu-14.04-base", (2, 6)),
("ubuntu-16.04-base", (2, 6)),
("ubuntu-18.04-base", (2, 6)),
("ubuntu-18.04-base", (3, 1)),
("ubuntu-20.04-base", (3, 1)),
("ubuntu-22.04-base", (4, 0)),
("ubuntu-14.04-oe", (2, 6)),
("ubuntu-16.04-oe", (2, 6)),
("ubuntu-18.04-oe", (2, 6)),
("ubuntu-18.04-oe", (3, 1)),
("ubuntu-20.04-oe", (3, 1)),
("ubuntu-22.04-oe", (4, 0)),
("ubuntu-14.04-oegarmin", (2, 6)),
("ubuntu-16.04-oegarmin", (2, 6)),
("ubuntu-18.04-oegarmin", (2, 6)),
("ubuntu-18.04-oegarmin", (3, 1)),
("ubuntu-20.04-oegarmin", (3, 1)),
("ubuntu-22.04-oegarmin", (4, 0)),
("ubuntu-18.04-oetest", (2, 6)),
("ubuntu-18.04-oetest", (3, 1)),
("ubuntu-20.04-oetest", (3, 1)),
)


def add_image_tests():
self = sys.modules[__name__]
for provider in PROVIDERS:
for (image, pokyver) in TEST_IMAGES:
for image, pokyver in TEST_IMAGES:
(_, _, image_type) = image.split("-")

parent = getattr(self, "PyrexImageType_" + image_type)
Expand Down

0 comments on commit c701b42

Please sign in to comment.