From 504fa11d0ef9e7df501dc28199ba976ffb3c631d Mon Sep 17 00:00:00 2001 From: Michael Graeb Date: Thu, 30 Jan 2025 05:56:58 -0800 Subject: [PATCH 1/6] Let armv8 tests run on new ubuntu-24.04-arm Github runners --- builder/core/data.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/builder/core/data.py b/builder/core/data.py index 2ce27aea3..4830a357f 100644 --- a/builder/core/data.py +++ b/builder/core/data.py @@ -321,9 +321,6 @@ class PKG_TOOLS(Enum): 'armv7': { 'run_tests': False }, - 'armv8': { - 'run_tests': False - }, 'mips': { 'run_tests': False }, From cccf1fd85b04da341897a92a485bec04a0f718e4 Mon Sep 17 00:00:00 2001 From: Michael Graeb Date: Thu, 30 Jan 2025 09:44:36 -0800 Subject: [PATCH 2/6] ensure tests don't run when ACTUALLY cross-compiling --- builder/core/project.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/core/project.py b/builder/core/project.py index d473627c0..84967afbc 100644 --- a/builder/core/project.py +++ b/builder/core/project.py @@ -572,7 +572,7 @@ def post_build(self, env): return Script(steps, name='post_build {}'.format(self.name)) def test(self, env): - run_tests = env.config.get('run_tests', True) + run_tests = self.needs_tests(env) if not run_tests: return From 600541df97f8666b91a8726ff5ed00c4e0859506 Mon Sep 17 00:00:00 2001 From: Michael Graeb Date: Thu, 30 Jan 2025 10:26:44 -0800 Subject: [PATCH 3/6] ugh project.test() needs to work with mock Env in builder's unittests, so check for cross-compile this way instead --- builder/core/project.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/builder/core/project.py b/builder/core/project.py index 84967afbc..a204f511f 100644 --- a/builder/core/project.py +++ b/builder/core/project.py @@ -553,7 +553,8 @@ def build_consumers(self, env): for c in consumers: build_consumers += _build_project(c, env) # build consumer tests - build_consumers += to_list(c.test(env)) + if c.needs_tests(env): + build_consumers += to_list(c.test(env)) if len(build_consumers) == 0: return None return Script(build_consumers, name='build consumers of {}'.format(self.name)) @@ -572,7 +573,7 @@ def post_build(self, env): return Script(steps, name='post_build {}'.format(self.name)) def test(self, env): - run_tests = self.needs_tests(env) + run_tests = env.config.get('run_tests', True) if not run_tests: return From 218a379076787d00bd1b8c75f1595f6c3e56c9e4 Mon Sep 17 00:00:00 2001 From: Michael Graeb Date: Thu, 30 Jan 2025 10:39:51 -0800 Subject: [PATCH 4/6] mock aren't real --- tests/test_project.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/test_project.py b/tests/test_project.py index 996255d2f..c6b2e4e97 100644 --- a/tests/test_project.py +++ b/tests/test_project.py @@ -16,6 +16,7 @@ 'name': 'test-proj', 'search_dirs': [test_data_dir], 'path': here, + 'run_tests': True, } @@ -148,7 +149,8 @@ def test_downstream_tests_build_by_default(self): ] p = Project(**config) - mock_env = mock.Mock(name='MockEnv', config=config) + m_toolchain = mock.Mock(name='mock toolchain', cross_compile=False) + mock_env = mock.Mock(name='MockEnv', config=config, project=p, toolchain=m_toolchain) mock_env.spec = BuildSpec() steps = p.build_consumers(mock_env) self._assert_step_contains_all(steps, ['test lib-1']) @@ -163,7 +165,8 @@ def test_downstream_post_build_runs_before_tests(self): ] p = Project(**config) - mock_env = mock.Mock(name='MockEnv', config=config) + m_toolchain = mock.Mock(name='mock toolchain', cross_compile=False) + mock_env = mock.Mock(name='MockEnv', config=config, project=p, toolchain=m_toolchain) mock_env.spec = BuildSpec() steps = p.build_consumers(mock_env) self._assert_step_contains_all(steps, ['post build lib-1', 'test lib-1']) From 4c814797fb3a9937778c68cd03920a2f55055314 Mon Sep 17 00:00:00 2001 From: Michael Graeb Date: Thu, 30 Jan 2025 19:55:34 +0000 Subject: [PATCH 5/6] needs another needs_tests() call before test() --- builder/main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/builder/main.py b/builder/main.py index b3f759dee..61beb82f6 100755 --- a/builder/main.py +++ b/builder/main.py @@ -73,7 +73,8 @@ def post_build(env): return env.project.post_build(env) def test(env): - return env.project.test(env) + if env.project.needs_tests(env): + return env.project.test(env) def install(env): return env.project.install(env) From 03ba17444dea4c61883d7707c43645d6d505abba Mon Sep 17 00:00:00 2001 From: Michael Graeb Date: Thu, 30 Jan 2025 19:56:02 +0000 Subject: [PATCH 6/6] why not al2023 --- builder/core/data.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/builder/core/data.py b/builder/core/data.py index 4830a357f..36f861c2c 100644 --- a/builder/core/data.py +++ b/builder/core/data.py @@ -215,6 +215,15 @@ class PKG_TOOLS(Enum): 'python': "python3", }, }, + 'al2023': { + 'os': 'linux', + 'pkg_tool': PKG_TOOLS.DNF, + 'pkg_update': 'dnf update -y', + 'pkg_install': 'dnf install -y', + 'variables': { + 'python': "python3", + }, + }, 'manylinux': { 'os': 'linux', 'pkg_tool': PKG_TOOLS.YUM,