mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-25 06:55:29 +02:00
cartkit: skip the scaffold round trip when there is no engine checkout
The generated cart release workflow curls cartkit.py into RUNNER_TEMP and runs the selftest from the cart repo, where find_repo() finds nothing and scaffold exits non-zero, so every cart release failed at the first step. Report failures and skips even under --quiet; the workflow passes it, so the only output was the FAIL count with no indication of which check.
This commit is contained in:
+17
-4
@@ -1582,9 +1582,17 @@ def t_png():
|
|||||||
assert label_art("#123456") == art
|
assert label_art("#123456") == art
|
||||||
|
|
||||||
|
|
||||||
|
class SelftestSkip(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def t_roundtrip():
|
def t_roundtrip():
|
||||||
root = tempfile.mkdtemp(prefix="cartkit-selftest-")
|
root = tempfile.mkdtemp(prefix="cartkit-selftest-")
|
||||||
repo = find_repo(os.path.dirname(os.path.abspath(__file__)))
|
repo = find_repo(os.getcwd()) or find_repo(
|
||||||
|
os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
if not repo:
|
||||||
|
raise SelftestSkip("scaffold needs an engine checkout; none found "
|
||||||
|
"from the cwd or the script")
|
||||||
try:
|
try:
|
||||||
with contextlib.redirect_stdout(io.StringIO()):
|
with contextlib.redirect_stdout(io.StringIO()):
|
||||||
_roundtrip(root, repo)
|
_roundtrip(root, repo)
|
||||||
@@ -1650,21 +1658,26 @@ CHECKS = [
|
|||||||
|
|
||||||
def cmd_selftest(args, repo):
|
def cmd_selftest(args, repo):
|
||||||
failures = []
|
failures = []
|
||||||
|
skipped = []
|
||||||
for name, check in CHECKS:
|
for name, check in CHECKS:
|
||||||
try:
|
try:
|
||||||
check()
|
check()
|
||||||
|
except SelftestSkip as why:
|
||||||
|
skipped.append((name, why))
|
||||||
|
print(f"skip {name}: {why}")
|
||||||
except Exception as problem:
|
except Exception as problem:
|
||||||
failures.append((name, problem))
|
failures.append((name, problem))
|
||||||
if not args.quiet:
|
print(f"FAIL {name}: {problem!r}")
|
||||||
print(f"FAIL {name}: {problem!r}")
|
|
||||||
else:
|
else:
|
||||||
if not args.quiet:
|
if not args.quiet:
|
||||||
print(f"ok {name}")
|
print(f"ok {name}")
|
||||||
if failures:
|
if failures:
|
||||||
print(f"FAIL {len(failures)} of {len(CHECKS)} checks")
|
print(f"FAIL {len(failures)} of {len(CHECKS)} checks")
|
||||||
return 1
|
return 1
|
||||||
|
ran = len(CHECKS) - len(skipped)
|
||||||
|
tail = f" ({len(skipped)} skipped)" if skipped else ""
|
||||||
if not args.quiet:
|
if not args.quiet:
|
||||||
print(f"ok {len(CHECKS)} checks")
|
print(f"ok {ran} checks{tail}")
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user