tools: avoid shadowing check parameter in graphics unload and ZBC main()

This commit is contained in:
morebrackets
2026-12-02 07:09:50 -08:00
parent 5284a3c263
commit 1e95a63382
3 changed files with 12 additions and 4 deletions

View File

@ -34,6 +34,14 @@ class GpuGraphicsBinaryOraclesTests(unittest.TestCase):
self.assertIn("write_or_check_text", src, f"{rel} missing write_or_check_text")
self.assertIn("write_or_check_json", src, f"{rel} missing write_or_check_json")
self.assertIn("finally:\n sys.argv = _saved_argv", src, f"{rel} must restore sys.argv")
for node in ast.walk(tree):
if isinstance(node, ast.FunctionDef) and node.name == "main":
stores = [
n.lineno
for n in ast.walk(node)
if isinstance(n, ast.Name) and n.id == "check" and isinstance(n.ctx, ast.Store)
]
self.assertEqual(stores, [], f"{rel}: main() must not shadow 'check' at {stores}")
def test_require_enforced_under_optimize(self) -> None:
helper.require(True, "ok")

View File

@ -136,9 +136,9 @@ def main(check=False):
# Wait for idle before the body: it runs whatever the wait returned.
for current in ([0], [0x80000000, 0], [0x80000000] * 3 + [0x7fffffff], [0xffffffff] * 40):
for pending, busy in (([0], []), ([1, 0], []), ([0], [1, 0]), ([1], [1])):
for check in ([], [0, 0x65], [0x65]):
for checks in ([], [0, 0x65], [0x65]):
unload(reads={0x409b00: list(current), 0x40060c: list(pending)},
busy=list(busy), check=list(check) + [0x65] * 40)
busy=list(busy), check=list(checks) + [0x65] * 40)
for gpu in ({0x917: 1}, {0x918: 1}, {0x919: 1}, {0x926: 1}, {0x915: 0}):
unload(reads={0x409b00: [0x80000000], 0x40060c: [1]}, gpu={0x911: 1, **gpu},
check=[0x65] * 40)

View File

@ -207,9 +207,9 @@ def main(check=False):
# Wait for idle inside the colour, depth and final steps.
for current in ([0], [0x80000000, 0], [0x80000000] * 3 + [0x7fffffff], [0xffffffff] * 40):
for pending, busy in (([0], []), ([1, 0], []), ([0], [1, 0]), ([1], [1])):
for check in ([], [0, 0x65], [0x65]):
for checks in ([], [0, 0x65], [0x65]):
service(reads={0x409b00: list(current), 0x40060c: list(pending)},
busy=list(busy), check=list(check) + [0x65] * 40)
busy=list(busy), check=list(checks) + [0x65] * 40)
for position in range(1, 7):
# The wait of one step never ends: the service stops there.
service(reads={0x409b00: [0] * (position - 1) + [0x80000000] * 40, 0x40060c: [1]},