Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/CUDApp/blob/main/tests/localrouter/negative_control.py # CUDApp CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `CUDApp / tests / localrouter / negative_control.py` 33 lines · 1576 bytes Raw Blame History 1 #!/usr/bin/env python3 2 # SPDX-License-Identifier: MIT 3 """Remove the shared-lock guard in a temporary copy; its test must fail.""" 4 from pathlib import Path 5 import shutil 6 import subprocess 7 import sys 8 import tempfile 9 10 11 root = Path(__file__).resolve().parents[2] 12 with tempfile.TemporaryDirectory(prefix="localrouter-control-") as name: 13 temp = Path(name) 14 for relative in ("tools/localrouter/setup.py", "tests/localrouter/test_setup.py"): 15 target = temp / relative 16 target.parent.mkdir(parents=True, exist_ok=True) 17 shutil.copyfile(root / relative, target) 18 script = temp / "tools/localrouter/setup.py" 19 text = script.read_text() 20 before = 'require(cfg.get("gpu_lock") == "",' 21 if text.count(before) != 1: 22 sys.exit("FAIL: shared-lock guard was not found exactly once") 23 script.write_text(text.replace(before, 'require(True,')) 24 run = subprocess.run([sys.executable, "-m", "unittest", "discover", "-s", 25 "tests/localrouter", "-p", "test_setup.py", "-v"], 26 cwd=temp, capture_output=True, text=True) 27 output = run.stdout + run.stderr 28 # A crash/import failure cannot count as detecting this control. 29 if run.returncode == 0 or "AssertionError: ValueError not raised" not in output or "FAILED (failures=1)" not in output: 30 print(output) 31 sys.exit("FAIL: removing the shared-lock guard did not fail its intended check") 32 print("PASS: shared-lock guard removed in scratch copy; intended rejection test failed") 33 print("mutant exit code:", run.returncode)