Make Gitea core validation source-only

This commit is contained in:
gamer147
2026-08-03 13:28:59 -04:00
parent 52b0ac9038
commit d611c4868d
38 changed files with 154 additions and 40 deletions

View File

@@ -100,8 +100,9 @@ def skeleton_toml(op: int, label: str, argc: int, argtypes_for_op: dict,
f"observed_types = [{obs}]"]
return "\n".join(lines) + "\n"
def bootstrap(toml_path: Path) -> None:
used, argtypes = scan_corpus()
def bootstrap(toml_path: Path, *, corpus_scan=None) -> None:
"""Append observed skeletons from a real scan or an injected synthetic scan fixture."""
used, argtypes = corpus_scan if corpus_scan is not None else scan_corpus()
present = set(M.load(toml_path).opcodes) if toml_path.exists() else set()
blocks = []
for op in sorted(used):

View File

@@ -1,6 +1,7 @@
#!/usr/bin/env python3
"""Standalone tests for the opcode reference tooling. Run: py -3.11 -X utf8 tools/test_opcodes.py"""
import os, sys, tempfile
from collections import Counter
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
import opcodes_model as M
@@ -120,14 +121,21 @@ def test_bootstrap():
import opcodes_build as B
from age_opcodes import OPCODES
from pathlib import Path
canonical = M.load(Path(__file__).resolve().parents[1] / "vm-map" / "opcodes.toml")
observed = sorted(op for op, entry in canonical.opcodes.items() if entry.observed_in_himegari)
synthetic_scan = (
Counter({op: 1 for op in observed}),
{op: {i: {0} for i in range(OPCODES[op][1])} for op in observed},
)
fd, p = tempfile.mkstemp(suffix=".toml"); os.close(fd); os.remove(p)
tp = Path(p)
B.bootstrap(tp) # first run: meta + all skeletons
B.bootstrap(tp, corpus_scan=synthetic_scan) # first run: meta + synthetic observed skeletons
m = M.load(tp)
check(len(m.opcodes) >= 240, f"bootstrap seeded ~248 opcodes (got {len(m.opcodes)})")
check(len(m.opcodes) == len(observed),
f"bootstrap seeded all {len(observed)} synthetic observations (got {len(m.opcodes)})")
check(0x90 in m.opcodes and m.opcodes[0x90].argc == 7, "0x90 seeded with argc 7")
n1 = len(m.opcodes)
B.bootstrap(tp) # idempotent: appends nothing new
B.bootstrap(tp, corpus_scan=synthetic_scan) # idempotent: appends nothing new
check(len(M.load(tp).opcodes) == n1, "second bootstrap adds no duplicates")
e, w = M.lint(m)
check(e == [], f"bootstrapped file lints clean (errors: {e[:3]})")

View File

@@ -75,13 +75,21 @@ class GatePlanTests(unittest.TestCase):
self.assertNotIn("sys4-corpus-validate", keys)
self.assertNotIn("godot-selftest", keys)
self.assertNotIn("age-cli-sweep", keys)
engine = next(gate for gate in validate.build_gate_plan("core") if gate.key == "engine-tests")
self.assertIn("Category!=Workspace", engine.command)
def test_workspace_extends_core(self) -> None:
core = {gate.key for gate in validate.build_gate_plan("core")}
workspace = {gate.key for gate in validate.build_gate_plan("workspace")}
self.assertLess(core, workspace)
self.assertIn("sys4-corpus-validate", workspace)
self.assertIn("engine-workspace-tests", workspace)
self.assertNotIn("godot-selftest", workspace)
installed = next(
gate for gate in validate.build_gate_plan("workspace")
if gate.key == "engine-workspace-tests"
)
self.assertIn("Category=Workspace", installed.command)
def test_runtime_requires_resolved_paths(self) -> None:
with self.assertRaisesRegex(ValueError, "resolved Godot"):

View File

@@ -152,16 +152,27 @@ def build_gate_plan(
gates.append(
Gate(
"engine-tests",
".NET engine tests",
".NET engine core tests",
(
"dotnet", "test", "engine/AgeEngine.sln", "--nologo", "--verbosity", "minimal",
"-p:UseSharedCompilation=false",
"--filter", "Category!=Workspace", "-p:UseSharedCompilation=false",
),
300,
)
)
if "workspace" in phases:
gates.append(
Gate(
"engine-workspace-tests",
".NET installed-data and native-oracle tests",
(
"dotnet", "test", "engine/AgeEngine.sln", "--nologo", "--verbosity", "minimal",
"--filter", "Category=Workspace", "-p:UseSharedCompilation=false",
),
300,
)
)
gates.append(
Gate("globals-build", "Global registry build", _python_tool("globals_build.py", "--build"))
)