Import CBB refresh verify r4 stability baseline
Preserve tested Verify source, authoritative READY checks, bounded bridge retries, diagnostics and failure-only reporting. Include 336-test suite and packaging assets; exclude live Mentor samples, field logs, backups and distributions.
This commit is contained in:
commit
11a2b2e46e
130 files changed
+19267
No files matched your search
@@ -0,0 +1,46 @@
|
||||
import json
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def run_server_client(fake_server, names):
|
||||
process = subprocess.Popen(
|
||||
[sys.executable, str(fake_server)],
|
||||
stdin=subprocess.PIPE,
|
||||
stdout=subprocess.PIPE,
|
||||
text=True,
|
||||
)
|
||||
requests = []
|
||||
for name in names:
|
||||
requests.append(json.dumps({"op": "is_verified", "lmc_file": "x.lmc",
|
||||
"block_name": name, "block_type": "RULP"}) + "\n")
|
||||
stdout, _ = process.communicate("".join(requests), timeout=5)
|
||||
return [json.loads(line) for line in stdout.splitlines() if line.strip()]
|
||||
|
||||
|
||||
def test_server_response_is_one_line_per_request(tmp_path):
|
||||
fake = tmp_path / "fake_server.py"
|
||||
fake.write_text(
|
||||
"import json,sys\n"
|
||||
"for line in sys.stdin:\n"
|
||||
" p=json.loads(line); print(json.dumps({'ok':True,'block_name':p['block_name'],'status':'READY','source':'fake'}), flush=True)\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
result = run_server_client(fake, ["A", "B"])
|
||||
assert [item["block_name"] for item in result] == ["A", "B"]
|
||||
|
||||
|
||||
def test_one_bad_request_does_not_stop_following_request(tmp_path):
|
||||
fake = tmp_path / "fake_server.py"
|
||||
fake.write_text(
|
||||
"import json,sys\n"
|
||||
"for line in sys.stdin:\n"
|
||||
" p=json.loads(line)\n"
|
||||
" if p.get('block_name') == 'BAD': print(json.dumps({'ok':False,'error':'bad'}), flush=True)\n"
|
||||
" else: print(json.dumps({'ok':True,'block_name':p['block_name'],'status':'PENDING','source':'fake'}), flush=True)\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
result = run_server_client(fake, ["BAD", "GOOD"])
|
||||
assert result[0]["ok"] is False
|
||||
assert result[1]["ok"] is True
|
||||
Reference in new issue
Block a user