Skip to content

Commit 2c4d75c

Browse files
committed
fix(hw): Properly group missing runners
1 parent 52c078b commit 2c4d75c

File tree

4 files changed

+68
-10
lines changed

4 files changed

+68
-10
lines changed

.gitlab/scripts/gen_hw_jobs.py

Lines changed: 52 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,11 @@ def find_sketch_test_dirs(types_filter: list[str]) -> list[tuple[str, Path]]:
8383
def load_tags_for_test(ci_json: dict, chip: str) -> set[str]:
8484
tags = set()
8585
# Global tags
86-
for key in "tags":
87-
v = ci_json.get(key)
88-
if isinstance(v, list):
89-
for e in v:
90-
if isinstance(e, str) and e.strip():
91-
tags.add(e.strip())
86+
v = ci_json.get("tags")
87+
if isinstance(v, list):
88+
for e in v:
89+
if isinstance(e, str) and e.strip():
90+
tags.add(e.strip())
9291
# Per-SoC tags
9392
soc_tags = ci_json.get("soc_tags")
9493
if isinstance(soc_tags, dict):
@@ -360,11 +359,24 @@ def main():
360359
# Discover available runners (best-effort)
361360
available_runners = list_project_runners()
362361
if not available_runners:
363-
print("[WARN] Could not enumerate project runners or none found; skipping runner-tag availability checks.")
362+
print("[WARN] Could not enumerate project runners or none found; using conservative mode for tagged groups.")
363+
else:
364+
print(f"\n=== Available Runners ({len(available_runners)}) ===")
365+
for runner in available_runners:
366+
runner_id = runner.get("id", "?")
367+
runner_desc = runner.get("description", "")
368+
runner_tags = runner.get("tag_list", [])
369+
runner_active = runner.get("active", False)
370+
runner_paused = runner.get("paused", False)
371+
status = "ACTIVE" if (runner_active and not runner_paused) else "INACTIVE/PAUSED"
372+
print(f" Runner #{runner_id} ({status}): {runner_desc}")
373+
print(f" Tags: {', '.join(runner_tags) if runner_tags else '(none)'}")
374+
print("=" * 60 + "\n")
364375

365376
# Accumulate all missing-runner groups to emit a single stub job
366377
missing_groups: list[dict] = []
367378

379+
print(f"\n=== Test Group Scheduling ===")
368380
for (chip, tagset, test_type), test_dirs in group_map.items():
369381
tag_list = sorted(tagset)
370382
# Build name suffix excluding the SOC itself to avoid duplication
@@ -375,6 +387,25 @@ def main():
375387
can_schedule = True
376388
if available_runners:
377389
can_schedule = any_runner_matches(tag_list, available_runners)
390+
print(f" Group: {chip}-{test_type}-{tag_suffix}")
391+
print(f" Required tags: {', '.join(tag_list)}")
392+
print(f" Tests: {len(test_dirs)}")
393+
if can_schedule:
394+
print(f" ✓ Runner found")
395+
else:
396+
print(f" ✗ NO RUNNER FOUND - will create error report stub")
397+
else:
398+
# Conservative mode when we cannot list runners: treat groups that require extra
399+
# tags beyond the SOC or 'generic' as missing-runner to avoid running on generic.
400+
assume_missing = os.environ.get("ASSUME_TAGGED_GROUPS_MISSING", "1") == "1"
401+
if assume_missing:
402+
extra = [t for t in tag_list if t not in (chip, "generic")]
403+
if extra:
404+
can_schedule = False
405+
print(f" Group: {chip}-{test_type}-{tag_suffix}")
406+
print(f" Required tags: {', '.join(tag_list)}")
407+
print(f" Tests: {len(test_dirs)}")
408+
print(f" ? Conservative mode: {'can schedule' if can_schedule else 'treating as missing'}")
378409

379410
if can_schedule:
380411
job_name = f"hw-{chip}-{test_type}-{tag_suffix}"[:255]
@@ -403,6 +434,20 @@ def main():
403434
}
404435
)
405436

437+
# Print summary
438+
scheduled_count = len([e for e in jobs_entries if e[1] != "hw-missing-runners"])
439+
print(f"\n=== Summary ===")
440+
print(f" Scheduled groups: {scheduled_count}")
441+
print(f" Missing runner groups: {len(missing_groups)}")
442+
if missing_groups:
443+
print(f"\n Missing runner details:")
444+
for mg in missing_groups:
445+
chip = mg.get("chip")
446+
test_type = mg.get("test_type")
447+
tags = mg.get("required_tags", [])
448+
test_count = len(mg.get("test_dirs", []))
449+
print(f" - {chip}-{test_type}: requires tags {tags}, {test_count} tests")
450+
406451
# If any groups are missing runners, create one combined stub job to emit all JUnit errors
407452
if missing_groups:
408453
job_name = "hw-missing-runners"

.gitlab/workflows/hardware_tests_dynamic.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@ generate-hw-tests:
1818
before_script:
1919
- pip install PyYAML
2020
- apt-get update
21-
- apt-get install -y jq yq unzip curl
21+
- apt-get install -y jq unzip curl wget
22+
# Install mikefarah/yq (Go version) instead of kislyuk/yq (Python version)
23+
- YQ_VERSION=v4.47.2
24+
- YQ_BINARY=yq_linux_amd64
25+
- wget https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/${YQ_BINARY} -O /usr/bin/yq
26+
- chmod +x /usr/bin/yq
27+
- yq --version
2228
script:
2329
- mkdir -p ~/.arduino/tests
2430
- |
@@ -65,7 +71,7 @@ collect-hw-results:
6571
- if: $CI_PIPELINE_SOURCE == "trigger"
6672
when: always
6773
before_script:
68-
- apt-get update && apt-get install -y jq yq curl unzip
74+
- apt-get update && apt-get install -y jq curl unzip
6975
script:
7076
- bash .gitlab/scripts/get_results.sh
7177
artifacts:

.gitlab/workflows/hw_test_template.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,13 @@ hw-test-template:
3434
- echo "Pipeline ID:$PIPELINE_ID"
3535
- echo "Running hardware tests for chip:$TEST_CHIP"
3636
- apt-get update
37-
- apt-get install -y jq yq unzip curl
37+
- apt-get install -y jq unzip curl wget
38+
# Install mikefarah/yq (Go version) instead of kislyuk/yq (Python version)
39+
- YQ_VERSION=v4.47.2
40+
- YQ_BINARY=yq_linux_amd64
41+
- wget https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/${YQ_BINARY} -O /usr/bin/yq
42+
- chmod +x /usr/bin/yq
43+
- yq --version
3844
- rm -rf ~/.arduino/tests
3945
- mkdir -p ~/.arduino/tests/$TEST_CHIP
4046
- echo Fetching binaries for $TEST_CHIP $TEST_TYPE

tests/validation/psram/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ soc_tags:
77
- octal_psram
88
esp32c5:
99
- psram
10+
# Runners for ESP32-P4 have PSRAM by default. There are no runners with psram tag.
1011

1112
platforms:
1213
qemu: false

0 commit comments

Comments
 (0)