fix(tests): skip efficiency tests when glm_tiny fixture is absent (CI #360)
CI runs 'make check' = dependency-free tests, no model downloads (by design, #140). glm_tiny/ is a gitignored generated fixture, so test_inefficiency.py hard-failed on the Windows/macOS/Linux runners with 'config.json: No such file or directory' instead of skipping. _engine_present() now requires BOTH glm.exe AND glm_tiny/config.json, and _skip_reason() names exactly which prerequisite is missing so the skip is actionable. Verified: 8 skipped (0 failed) with the fixture absent; 5 pass + 3 CUDA-skip with it present.
This commit is contained in:
@@ -31,7 +31,25 @@ TINY = C_DIR / "glm_tiny"
|
||||
|
||||
|
||||
def _engine_present() -> bool:
|
||||
return ENGINE.exists()
|
||||
"""True iff BOTH the built engine AND the tiny fixture are available.
|
||||
|
||||
These tests need glm.exe (a build artifact) AND glm_tiny/ (a generated
|
||||
fixture, gitignored). CI runs `make check` = "dependency-free tests, no
|
||||
model downloads" (workflow .github/workflows/check.yml, by design #140), so
|
||||
neither is present there and these tests must SKIP rather than fail. They
|
||||
run locally after `make glm.exe` (glm_tiny ships alongside the source, or
|
||||
is regenerated by tools/make_glm_oracle.py).
|
||||
"""
|
||||
return ENGINE.exists() and (TINY / "config.json").exists()
|
||||
|
||||
|
||||
def _skip_reason() -> str:
|
||||
"""Name exactly which prerequisite is missing, so the skip is actionable."""
|
||||
if not ENGINE.exists():
|
||||
return "glm.exe not built (run: make glm.exe)"
|
||||
if not (TINY / "config.json").exists():
|
||||
return "glm_tiny fixture absent (gitignored; ship it locally or run tools/make_glm_oracle.py)"
|
||||
return ""
|
||||
|
||||
|
||||
def _cuda_available() -> bool:
|
||||
@@ -66,7 +84,7 @@ def _cuda_available() -> bool:
|
||||
return False
|
||||
|
||||
|
||||
@unittest.skipUnless(_engine_present(), "glm.exe not built (run: make glm.exe)")
|
||||
@unittest.skipUnless(_engine_present(), _skip_reason() or "glm.exe + glm_tiny required")
|
||||
class TinyEfficiencyTest(unittest.TestCase):
|
||||
"""Asserted regression tests on the resident tiny model. Gates CI."""
|
||||
|
||||
@@ -156,7 +174,7 @@ class TinyEfficiencyTest(unittest.TestCase):
|
||||
|
||||
|
||||
@unittest.skipUnless(_cuda_available(),
|
||||
"CUDA build not present (run: make clean && make glm.exe CUDA_DLL=1 && make cuda-dll)")
|
||||
_skip_reason() or "CUDA build not present (run: make clean && make glm.exe CUDA_DLL=1 && make cuda-dll)")
|
||||
class TinyCudaEfficiencyTest(unittest.TestCase):
|
||||
"""CUDA-path regression tests on the tiny model. Skip unless CUDA built.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user