Skip to content

Commit 2024add

Browse files
committed
Wire the harness to run make check for mode check examples starting with ecc
1 parent 5edb6f1 commit 2024add

3 files changed

Lines changed: 27 additions & 22 deletions

File tree

.github/examples-manifest.yml

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -383,25 +383,8 @@ examples:
383383
- id: ecc
384384
path: ecc
385385
profile: ecc
386-
run:
387-
- exec: [./ecc-key-decode]
388-
expect: "Success"
389-
- exec: [./ecc-params]
390-
expect: "Gy: 32"
391-
# the last of 10 rounds; a failure in any earlier one now exits non-zero
392-
- exec: [./ecc-sign]
393-
expect: "Firmware Signature 9: Ret 0"
394-
- exec: [./ecc-stack]
395-
expect: "stack used ="
396-
- exec: [./ecc-verify]
397-
expect: "hash_firmware_verify: 0"
398-
- exec: [./ecc-verify-minimal]
399-
expect: "wc_ecc_verify_hash: ret=0, is_valid_sig=1"
400-
# must follow ecc-key-export, which writes the .der it reads
401-
- exec: [./ecc-key-export]
402-
expect: "ECC Public Key Exported to ./ECC_SECP256K1_pub.pem"
403-
- exec: [./ecc-export-Qx-Qy, ECC_SECP256K1.der, qxqy.raw]
404-
expect: "Exported Qx and Qy"
386+
# asserts via ecc/Makefile's check target
387+
mode: check
405388

406389
- id: hash
407390
path: hash

.github/scripts/manifest.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def validate(data):
6969
sys.exit(f"manifest: duplicate id '{e['id']}'")
7070
seen.add(e["id"])
7171
mode = e.get("mode", "run")
72-
if mode not in ("run", "build-only", "skip"):
72+
if mode not in ("run", "check", "build-only", "skip"):
7373
sys.exit(f"manifest: {e['id']}: bad mode '{mode}'")
7474
if mode == "skip" and not e.get("reason"):
7575
sys.exit(f"manifest: {e['id']}: mode 'skip' requires a 'reason'")
@@ -258,8 +258,9 @@ def cmd_check(data):
258258
if isinstance(s, dict) and "expect_fail" in s
259259
)
260260
print(
261-
f"tested: {modes['run']} run, {modes['build-only']} build-only, "
262-
f"{modes['skip']} skip -- {asserts} output assertions, {xfails} known-fail"
261+
f"tested: {modes['run']} run, {modes['check']} make-check, "
262+
f"{modes['build-only']} build-only, {modes['skip']} skip -- "
263+
f"{asserts + modes['check']} output assertions, {xfails} known-fail"
263264
)
264265

265266

.github/scripts/run_example.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,27 @@ def run_entry(entry, expect_sha, results, wolfssl_ref):
658658
if binary.exists():
659659
assert_binary_links_ours(binary, expect_sha)
660660

661+
# mode: check delegates the run+assert to the example's own `make check`
662+
# target, so the assertions live in the Makefile and are user-runnable.
663+
if entry.get("mode") == "check":
664+
try:
665+
p = subprocess.run(["make", "check"], cwd=cwd, capture_output=True,
666+
text=True, env=env, timeout=600)
667+
ok = p.returncode == 0
668+
detail = "" if ok else f"make check rc={p.returncode}"
669+
log = (p.stdout + p.stderr)[-4000:]
670+
except subprocess.TimeoutExpired as e:
671+
out = e.output or ""
672+
if isinstance(out, bytes):
673+
out = out.decode(errors="replace")
674+
ok, detail, log = False, "make check timed out", out[-4000:]
675+
results.append({
676+
"id": eid, "target": "make check",
677+
"status": "pass" if ok else "fail", "stage": "run",
678+
"detail": detail, "log": log,
679+
})
680+
return ok
681+
661682
all_ok = True
662683
for step in entry.get("run") or []:
663684
if "exec" in step and step.get("must_fail"):

0 commit comments

Comments
 (0)