From 6c6166a8d76581efc47fc5031d2afa185884093e Mon Sep 17 00:00:00 2001 From: chandupatel-ai Date: Fri, 4 Sep 2026 11:07:56 +0530 Subject: [PATCH 1/3] test: skip GCC-dependent test when compiler is unavailable --- tests/ebuild/test_build_dir_resolution.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/ebuild/test_build_dir_resolution.py b/tests/ebuild/test_build_dir_resolution.py index 28d9eb3..66f6557 100644 --- a/tests/ebuild/test_build_dir_resolution.py +++ b/tests/ebuild/test_build_dir_resolution.py @@ -26,6 +26,7 @@ from __future__ import annotations import os +import shutil import subprocess import textwrap from pathlib import Path @@ -243,7 +244,7 @@ def test_configure_and_build_from_outside_agree_on_the_build_dir( @pytest.mark.skipif( - subprocess.run(["gcc", "--version"], capture_output=True).returncode != 0, + shutil.which("gcc") is None, reason="needs a working gcc to link the executable", ) def test_end_to_end_build_from_outside_produces_the_binary(tmp_path, monkeypatch): From cc479879c1404cd30596b1a7f6871cfa9019d3ff Mon Sep 17 00:00:00 2001 From: chandupatel-ai Date: Fri, 4 Sep 2026 13:57:57 +0530 Subject: [PATCH 2/3] test: guard GCC-dependent tests --- tests/ebuild/test_build_dir_resolution.py | 2 +- tests/unit/test_footprint.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/ebuild/test_build_dir_resolution.py b/tests/ebuild/test_build_dir_resolution.py index 66f6557..43f17e9 100644 --- a/tests/ebuild/test_build_dir_resolution.py +++ b/tests/ebuild/test_build_dir_resolution.py @@ -245,7 +245,7 @@ def test_configure_and_build_from_outside_agree_on_the_build_dir( @pytest.mark.skipif( shutil.which("gcc") is None, - reason="needs a working gcc to link the executable", + reason="needs gcc on PATH to link the executable", ) def test_end_to_end_build_from_outside_produces_the_binary(tmp_path, monkeypatch): """No stubs: the real ninja run must produce the real executable.""" diff --git a/tests/unit/test_footprint.py b/tests/unit/test_footprint.py index 5450853..2c1db2f 100644 --- a/tests/unit/test_footprint.py +++ b/tests/unit/test_footprint.py @@ -15,6 +15,7 @@ """ import os +import shutil import subprocess from pathlib import Path @@ -55,8 +56,11 @@ def test_a_pure_bss_buffer_costs_ram_but_not_flash(self): assert fp.flash == 100 assert fp.ram == 8192 - class TestMeasure: + @pytest.mark.skipif( + shutil.which("gcc") is None, + reason="needs gcc on PATH to build the binary under test", + ) def test_measures_a_real_binary(self, tmp_path): src = tmp_path / "m.c" src.write_text("static char buf[4096];\nint main(void){return buf[0];}\n") From 833064046b2800a3185238d12e87c516fcff35ef Mon Sep 17 00:00:00 2001 From: chandupatel-ai Date: Fri, 4 Sep 2026 16:08:42 +0530 Subject: [PATCH 3/3] test: skip footprint test when size tool is unavailable --- tests/unit/test_footprint.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/unit/test_footprint.py b/tests/unit/test_footprint.py index 2c1db2f..3e20168 100644 --- a/tests/unit/test_footprint.py +++ b/tests/unit/test_footprint.py @@ -58,9 +58,10 @@ def test_a_pure_bss_buffer_costs_ram_but_not_flash(self): class TestMeasure: @pytest.mark.skipif( - shutil.which("gcc") is None, - reason="needs gcc on PATH to build the binary under test", + shutil.which("gcc") is None or find_size_tool() is None, + reason="needs gcc and a size tool", ) + def test_measures_a_real_binary(self, tmp_path): src = tmp_path / "m.c" src.write_text("static char buf[4096];\nint main(void){return buf[0];}\n")