interplane.Get Omega
Read in your language

aien-sovereign-core-mv

AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.

Brought by drakestapleton

branch main Branches Tags History

aien-sovereign-core-mv / om / ribbon / mutants.py

38 lines · 1627 bytes Raw Blame History
1#!/usr/bin/env python3
2# SPDX-License-Identifier: Apache-2.0
3"""Wrong-word controls of the real controller. Test tooling only."""
4import importlib.util
5from pathlib import Path
6import subprocess
7import sys
8
9root = Path(__file__).resolve().parent
10spec = importlib.util.spec_from_file_location('ribboncheck', root / 'check.py')
11check = importlib.util.module_from_spec(spec)
12sys.modules[spec.name] = check
13spec.loader.exec_module(check)
14source = (root / 'pipeline.om').read_text()
15driver = (root / 'test_driver.om').read_text()
16compiler, out = sys.argv[1], Path(sys.argv[2])
17mutants = {
18 'stale-ticket': ('ret and ne get st b 0 eq get st add b 2 div ticket 64', 'ret ne get st b 0'),
19 'premature-publish': ('if ne get q 4 1', 'if eq get q 4 1'),
20 'over-budget': ('if ge get st 6 get st 4', 'if gt get st 6 get st 4'),
21 'evict-pinned': ('if or ne get st add b 5 0 ne get st add b 6 0', 'if ne get st add b 6 0'),
22 'release-active': ('if eq p 3\nreleasebuf st b', 'if ne p 0\nreleasebuf st b'),
23 'reset-generation': ('put st 2 gen', 'put st 2 0'),
24}
25for name, (old, new) in mutants.items():
26 assert old in source, name
27 changed = source.replace(old, new, 1)
28 path = out / name
29 with path.open('wb') as f:
30 built = subprocess.run([compiler], input=(changed+driver).encode(), stdout=f, stderr=subprocess.PIPE)
31 assert built.returncode == 0, (name, built.stderr.decode())
32 path.chmod(0o700)
33 try:
34 check.check(path)
35 except (AssertionError, subprocess.TimeoutExpired):
36 print('PASS caught mutant', name)
37 else:
38 raise AssertionError('surviving mutant: ' + name)