diff --git a/.crumb b/.crumb index 662f516..db6b4ef 100644 --- a/.crumb +++ b/.crumb @@ -4,7 +4,7 @@ "children": [ { "digest": "2fef3d6de87d55fe49b144a65ae78e2d3e9351653ede054fe6f7a4b795c72b74", - "last_commit": "bb3a8ae", + "last_commit": "4ad48c4", "name": "docs", "purpose": "Native ABI contracts and qualification boundaries" }, @@ -16,19 +16,19 @@ }, { "digest": "d0cef16228dbf8c832aa03ae707b96169067aa2c4a976726d092ee01eee86be2", - "last_commit": "30fba61", + "last_commit": "", "name": "evidence/native-freestanding-f32", "purpose": "Private FP32 no-libc native profile, raw hosted differential, whole attention-plan composition a" }, { "digest": "f22dd9fdf5af0a51a8676baa3520e594715a2f4362f682130214a07425d23fd0", - "last_commit": "12f8132", + "last_commit": "", "name": "evidence/native-freestanding-om2-nolibc", "purpose": "Device-free host and emulated receipts for pure OM2 arrays, private f64 and six-unit no-libc com" }, { "digest": "5c547f5fa713650855d8c5a5ba21273086c987609351ddb42c652a444c279e46", - "last_commit": "dead63c", + "last_commit": "", "name": "evidence/native-x86-aien-abi1", "purpose": "Device-free CPU qualification of exact ABI1 plus hosted-x86 native bridge; no chip run" }, @@ -40,38 +40,38 @@ }, { "digest": "ed236e744dc942696b18451c368100565d5c8b00e1a0696880d54b42249e6e25", - "last_commit": "bb3a8ae", + "last_commit": "9629242", "name": "src", "purpose": "Seeded native bridge generator and strict compiler pins" }, { "digest": "3a1409c71ed647da0ae7dae923a033cdc8d6eeaf653a57775d3e460c136ce381", - "last_commit": "6a8f009", + "last_commit": "", "name": "tests/native/freestanding", "purpose": "Pure no-libc OM2 fixtures with integer public ABI and private floating point" }, { "digest": "eaf4b68cbe6feb6e4236ccc49de28597dc6776a9cbf21392ea59d0d19fd51d86", - "last_commit": "c1282b2", + "last_commit": "", "name": "tests/native/v2/dev", "purpose": "Bounded CPU-only device-word controls; no device opens" }, { - "digest": "27fc2d7c2f74f02b1d3eed8c4c4b75d607c9bf8ce1598c90338b347070be0f2c", - "last_commit": "30fba61", + "digest": "c05117a5ef1852f3d16215fce4a3585c78a5573baf14c0af8645ffe3043a3ad7", + "last_commit": "3a65531", "name": "tests/native/x86", "purpose": "Cross-toolchain ABI v2 qualification under qemu-x86_64; never native hardware evidence" } ], - "children_root": "sha256:a6c5dad65c27bac8fd70fb7f3f7b50a2c54cae48e051726c6a6ee779d41ac30b", - "compiled_at": "2026-11-06T12:31:28Z", + "children_root": "sha256:5eab88f95411addc0b0f6f7c70d257a87cd18a6a58376b1a486c63cc7680edeb", + "compiled_at": "2026-11-06T13:03:52Z", "compiler": "crumb-compile/1", - "digest": "sha256:70ce26464ab04185981565b4538bc22c13dae36c22fea344d25f036670957ff5", - "evidence_files": 575, - "evidence_root": "sha256:7f9eaf762cd584b76eb06e200b64a679de635e9f4979ad39fb5708ee60f74ab5", - "files": 930, - "generated_at_commit": "bb3a8ae10d940d82f14c41cd8f0f1c32021545f0", - "source_tree": "sha256:69db6e6121dff1572dfce10cf2b5a740f506cf9536546673b3d72e73f57e5ded" + "digest": "sha256:11a16710e37fd5489a4ae0bcbeecba69d1bfbe5d692f0e2cfbd0f38219de53f7", + "evidence_files": 597, + "evidence_root": "sha256:28876b93736b9a574cc7d3aae93c29ff74bbb875f461bbf10b46f7509ca32b95", + "files": 955, + "generated_at_commit": "3a655311e2900e6f39440b1efe3b5a5a2e0011e0", + "source_tree": "sha256:80224a1dc1655a45962319d8b3d4da0d99d09e3d323123f57e1bac8de9c546b8" } }, "name": "BridgeHostAienX86", diff --git a/evidence/native-x86-mode-labels-green.log b/evidence/native-x86-mode-labels-green.log new file mode 100644 index 0000000..0b0b610 --- /dev/null +++ b/evidence/native-x86-mode-labels-green.log @@ -0,0 +1,16 @@ +HOST-ONLY diagnostic regression, no compiler/caller/emulator execution. +Base: 4ad48c456de95cacd6250295ce9a092537fc9643 plus the three self.how suffix changes. +Command: python3 tests/native/x86/test_mode_labels.py +1b18d520f169a8f2c70c12eb43d1c2c28e18bfed8e05b69672b75357ca0d0464 tests/native/x86/suite.py +cb9e5bdc503d29f9794afe8a93b5552d333fff6a5e7a43302600192430f5f987 tests/native/x86/test_mode_labels.py +test_each_old_label_mutant_is_detected (__main__.ModeLabelTests.test_each_old_label_mutant_is_detected) ... ok +test_emulated_labels_unchanged (__main__.ModeLabelTests.test_emulated_labels_unchanged) ... ok +test_guest_selection (__main__.ModeLabelTests.test_guest_selection) ... ok +test_native_labels (__main__.ModeLabelTests.test_native_labels) ... ok + +---------------------------------------------------------------------- +Ran 4 tests in 0.004s + +OK + +exit=0 diff --git a/evidence/native-x86-mode-labels-red.log b/evidence/native-x86-mode-labels-red.log new file mode 100644 index 0000000..09161cd --- /dev/null +++ b/evidence/native-x86-mode-labels-red.log @@ -0,0 +1,81 @@ +HOST-ONLY diagnostic regression, no compiler/caller/emulator execution. +Base: 4ad48c456de95cacd6250295ce9a092537fc9643 (unmodified suite.py) +Command: python3 tests/native/x86/test_mode_labels.py +Log normalization: repository path replaced by ; trailing spaces removed. +test_each_old_label_mutant_is_detected (__main__.ModeLabelTests.test_each_old_label_mutant_is_detected) ... ok +test_emulated_labels_unchanged (__main__.ModeLabelTests.test_emulated_labels_unchanged) ... ok +test_guest_selection (__main__.ModeLabelTests.test_guest_selection) ... ok +test_native_labels (__main__.ModeLabelTests.test_native_labels) ... + test_native_labels (__main__.ModeLabelTests.test_native_labels) (ok=True) ... FAIL + test_native_labels (__main__.ModeLabelTests.test_native_labels) (ok=False) ... FAIL + +====================================================================== +FAIL: test_native_labels (__main__.ModeLabelTests.test_native_labels) (ok=True) +---------------------------------------------------------------------- +Traceback (most recent call last): + File "/tests/native/x86/test_mode_labels.py", line 60, in test_native_labels + self.assert_labels("NATIVE", ok) + File "/tests/native/x86/test_mode_labels.py", line 53, in assert_labels + self.assertEqual(output.getvalue().splitlines(), +AssertionError: Lists differ: ['PAS[90 chars]eads EMULATED', 'PASS freestanding x86 OM-2 fa[157 chars]TED'] != ['PAS[90 chars]eads NATIVE', 'PASS freestanding x86 OM-2 fapi[151 chars]IVE'] + +First differing element 0: +'PASS[40 chars]s, bad-arg and trap leave out untouched, four threads EMULATED' +'PASS[40 chars]s, bad-arg and trap leave out untouched, four threads NATIVE' + + ['PASS freestanding x86 OM-2 FIPS 180-4 digests, bad-arg and trap leave out ' +- 'untouched, four threads EMULATED', +? ^^^^ - + ++ 'untouched, four threads NATIVE', +? ^ ++ + + 'PASS freestanding x86 OM-2 fapic wrapper traps (SIGILL) on a nonzero status ' +- 'EMULATED', ++ 'NATIVE', + 'PASS freestanding x86 OM-2 copy-back-dropped mutant leaves the pre-call fill ' +- 'in every digest EMULATED'] +? ^^^^ - + ++ 'in every digest NATIVE'] +? ^ ++ + + +====================================================================== +FAIL: test_native_labels (__main__.ModeLabelTests.test_native_labels) (ok=False) +---------------------------------------------------------------------- +Traceback (most recent call last): + File "/tests/native/x86/test_mode_labels.py", line 60, in test_native_labels + self.assert_labels("NATIVE", ok) + File "/tests/native/x86/test_mode_labels.py", line 53, in assert_labels + self.assertEqual(output.getvalue().splitlines(), +AssertionError: Lists differ: ['FAI[90 chars]eads EMULATED', 'FAIL freestanding x86 OM-2 fa[157 chars]TED'] != ['FAI[90 chars]eads NATIVE', 'FAIL freestanding x86 OM-2 fapi[151 chars]IVE'] + +First differing element 0: +'FAIL[40 chars]s, bad-arg and trap leave out untouched, four threads EMULATED' +'FAIL[40 chars]s, bad-arg and trap leave out untouched, four threads NATIVE' + + ['FAIL freestanding x86 OM-2 FIPS 180-4 digests, bad-arg and trap leave out ' +- 'untouched, four threads EMULATED', +? ^^^^ - + ++ 'untouched, four threads NATIVE', +? ^ ++ + + 'FAIL freestanding x86 OM-2 fapic wrapper traps (SIGILL) on a nonzero status ' +- 'EMULATED', ++ 'NATIVE', + 'FAIL freestanding x86 OM-2 copy-back-dropped mutant leaves the pre-call fill ' +- 'in every digest EMULATED'] +? ^^^^ - + ++ 'in every digest NATIVE'] +? ^ ++ + + +---------------------------------------------------------------------- +Ran 4 tests in 0.006s + +FAILED (failures=2) + +exit=1 diff --git a/tests/native/x86/.crumb b/tests/native/x86/.crumb index fecca11..06be425 100644 --- a/tests/native/x86/.crumb +++ b/tests/native/x86/.crumb @@ -3,14 +3,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-11-06T07:56:53Z", + "compiled_at": "2026-11-06T13:03:52Z", "compiler": "crumb-compile/1", - "digest": "sha256:27fc2d7c2f74f02b1d3eed8c4c4b75d607c9bf8ce1598c90338b347070be0f2c", + "digest": "sha256:c05117a5ef1852f3d16215fce4a3585c78a5573baf14c0af8645ffe3043a3ad7", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "files": 14, - "generated_at_commit": "12f8132c2fe0ad240430583c85e0d9c4f7bd1c33", - "source_tree": "sha256:77999c0b010c3d628bfe7a1744ee5b0ab664cdd3113e45f135c35ed480e16466" + "files": 15, + "generated_at_commit": "3a655311e2900e6f39440b1efe3b5a5a2e0011e0", + "source_tree": "sha256:c08ec160e07e268e8e241abe9cccbd359ec1f05a4255c2ce28a09a5c71fa62dd" } }, "layer": "tests", diff --git a/tests/native/x86/suite.py b/tests/native/x86/suite.py index 75b577e..64b3990 100755 --- a/tests/native/x86/suite.py +++ b/tests/native/x86/suite.py @@ -765,18 +765,18 @@ class Suite: lines = result.stdout.decode().splitlines() got = dict(l.split() for l in lines if l.split() and l.split()[0] in om2.WANT) if source is good: - self.check("freestanding x86 OM-2 FIPS 180-4 digests, bad-arg and trap leave out untouched, four threads EMULATED", + self.check("freestanding x86 OM-2 FIPS 180-4 digests, bad-arg and trap leave out untouched, four threads " + self.how, result.returncode == 0 and got == om2.WANT and "badarg 32 1" in lines and "outok 0 2 7 1" in lines and "outtrap 5 1" in lines and "threads 1" in lines and "floatbits 1" in lines) # The fapic wrapper's __builtin_trap() is ud2 on x86-64: SIGILL, and the call never returns. result = self.call(self.guest(tree / "fsom2", "trap")) - self.check("freestanding x86 OM-2 fapic wrapper traps (SIGILL) on a nonzero status EMULATED", + self.check("freestanding x86 OM-2 fapic wrapper traps (SIGILL) on a nonzero status " + self.how, result.returncode == -4 and not result.stdout) else: # Every digest must be the caller's untouched 0xa5 pre-call fill, so a crash or a # partial run cannot pass as the mutant being caught. - self.check("freestanding x86 OM-2 copy-back-dropped mutant leaves the pre-call fill in every digest EMULATED", + self.check("freestanding x86 OM-2 copy-back-dropped mutant leaves the pre-call fill in every digest " + self.how, result.returncode == 0 and got == om2.MUTANT) def freestanding_f32_x86(self): diff --git a/tests/native/x86/test_mode_labels.py b/tests/native/x86/test_mode_labels.py new file mode 100644 index 0000000..3bac79f --- /dev/null +++ b/tests/native/x86/test_mode_labels.py @@ -0,0 +1,87 @@ +#!/usr/bin/env python3 +"""Host-only regression for the freestanding OM-2 diagnostic labels. + +Evaluate the real check-name expressions and use Suite.check to print them. +No acceptance predicate, compiler, caller or emulator is executed here. This +tests reporting and command selection, not native ABI or hardware behavior. +""" + +import ast +import contextlib +import inspect +import io +import os +import textwrap +import unittest +from unittest.mock import patch + +from suite import Suite + + +PREFIXES = ( + "freestanding x86 OM-2 FIPS 180-4 digests, bad-arg and trap leave out untouched, four threads ", + "freestanding x86 OM-2 fapic wrapper traps (SIGILL) on a nonzero status ", + "freestanding x86 OM-2 copy-back-dropped mutant leaves the pre-call fill in every digest ", +) + + +class ModeLabelTests(unittest.TestCase): + @classmethod + def setUpClass(cls): + source = textwrap.dedent(inspect.getsource(Suite.freestanding_om2_x86)) + cls.labels = [] + for node in ast.walk(ast.parse(source)): + if (isinstance(node, ast.Call) and isinstance(node.func, ast.Attribute) + and isinstance(node.func.value, ast.Name) + and node.func.value.id == "self" and node.func.attr == "check"): + label = node.args[0] + if any(isinstance(part, ast.Constant) and isinstance(part.value, str) + and part.value.startswith("freestanding x86 OM-2 ") + for part in ast.walk(label)): + cls.labels.append(compile(ast.Expression(label), "", "eval")) + if len(cls.labels) != len(PREFIXES): + raise AssertionError("expected all three freestanding OM-2 diagnostic expressions") + + def assert_labels(self, how, ok, expressions=None): + runner = Suite.__new__(Suite) + runner.how, runner.failed = how, [] + output = io.StringIO() + with contextlib.redirect_stdout(output): + for label in self.labels if expressions is None else expressions: + runner.check(eval(label, {"self": runner}), ok) + verdict = "PASS " if ok else "FAIL " + self.assertEqual(output.getvalue().splitlines(), + [verdict + prefix + how for prefix in PREFIXES]) + self.assertEqual(runner.failed, [] if ok else [prefix + how for prefix in PREFIXES]) + + def test_native_labels(self): + for ok in (True, False): + with self.subTest(ok=ok): + self.assert_labels("NATIVE", ok) + + def test_emulated_labels_unchanged(self): + for ok in (True, False): + with self.subTest(ok=ok): + self.assert_labels("EMULATED", ok) + + def test_each_old_label_mutant_is_detected(self): + for i, prefix in enumerate(PREFIXES): + with self.subTest(label=prefix): + mutant = list(self.labels) + mutant[i] = compile(repr(prefix + "EMULATED"), "", "eval") + with self.assertRaises(AssertionError): + self.assert_labels("NATIVE", True, mutant) + + def test_guest_selection(self): + runner = Suite.__new__(Suite) + runner.qemu, runner.sysroot = ["qemu-x86_64"], "/guest-root" + with patch.dict(os.environ, {}, clear=True): + runner.native = True + self.assertEqual(runner.guest("caller", "trap"), ["caller", "trap"]) + runner.native = False + self.assertEqual(runner.guest("caller", "trap"), + ["qemu-x86_64", "-L", "/guest-root", "caller", "trap"]) + + +if __name__ == "__main__": + unittest.main(verbosity=2) diff --git a/tools/test.sh b/tools/test.sh index fad898b..8b6c381 100755 --- a/tools/test.sh +++ b/tools/test.sh @@ -2,6 +2,7 @@ set -eu cd "$(dirname "$0")/.." # Invoke with quiet-build tools/test.sh on a shared build host. +python3 tests/native/x86/test_mode_labels.py tools/build.sh python3 tests/differential.py python3 tests/refusals.py