test(stick): MINT-ZUSE's first test, mint_zuse; Task 4's progress kept in the plan (#92, 4.1) [skip ci]

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GE3SDvQn5EoxdGufk84zz2
This commit is contained in:
Claude
2026-11-08 17:58:38 +00:00
parent 9bb49ee623
commit 4706ddf39a
2 changed files with 62 additions and 0 deletions
+41
View File
@@ -63,6 +63,10 @@ the stick's, plan 2026-10-26-stick-1-screen-and-keyboard.md):
on the copy is clean (plan 2026-10-29-stick-5, Task 2)
stick_small --target qemu-stick --stick-gib 4: under 8 GB -- not grown, said so; Artemis at the
image's size; the prompt
mint_zuse the default fresh data stick, the prompt; MINT-ZUSE; a blank 600 MiB stick added on port 3:
its size said, YES typed, "real Zuse minted onto the second stick", the prompt, 7 ok;
afterwards sfdisk --verify on it clean, one StarshipOS identity partition (plan
2026-10-29-stick-5, Task 4)
bam_flush --target qemu-stick --stick-gib 16: an Artemis block changed and SAVE-BUFFERS'd three
times, each timed (TIME:); each answers ok within 2 s (#155: it took 5-6 s); then the BAM's bytes on the
stick hashed (BAM:), to be the same before and after #155's change
@@ -384,6 +388,12 @@ def add_zuse(n, img=None, fail_sector0=False):
drive=f"zuse{n}", id=f"zusedev{n}")
def add_stick(n, img, port):
"""A USB stick added over QMP on the xHCI controller's `port` (plan 2026-10-29-stick-5, Task 4)."""
qcmd("blockdev-add", driver="raw", **{"node-name": f"stick{n}"}, file={"driver": "file", "filename": img})
qcmd("device_add", driver="usb-storage", bus="xhci0.0", port=str(port), drive=f"stick{n}", id=f"stickdev{n}")
def del_zuse(n):
qcmd("device_del", id=f"zusedev{n}")
time.sleep(3)
@@ -534,6 +544,37 @@ elif m in ("stick_grow", "stick_small"):
v.returncode == 0 and "No errors detected" in v.stdout + v.stderr)
boot_done = True
elif m == "mint_zuse":
blank = os.path.join(work, "zuse-real.img")
subprocess.run(["truncate", "-s", "600M", blank], check=True)
check("[zuse@Hera] ok> (the proxy, on a fresh data stick)", wait_for(PROMPT, 300))
type_line("MINT-ZUSE")
check("MINT-ZUSE: plug in the stick for the real Zuse",
wait_for(r"MINT-ZUSE: plug in the stick for the real Zuse", 60), near=r"MINT-ZUSE")
add_stick(1, blank, 3)
check("MINT-ZUSE: a stick of 600 MiB -- all of it is erased",
wait_for(r"MINT-ZUSE: a stick of 600 MiB -- all of it is erased", 120), near=r"MINT-ZUSE")
check("MINT-ZUSE: type YES to write it", wait_for(r"MINT-ZUSE: type YES to write it", 30), near=r"MINT-ZUSE")
n = count(PROMPT)
type_line("YES")
check("Zuse: real Zuse minted onto the second stick",
wait_for(r"Zuse: real Zuse minted onto the second stick", 300), near=r"MINT-ZUSE|Zuse:")
check("[zuse@Hera] ok> (the real Zuse)", wait_for(PROMPT, 120, n))
n = count(PROMPT)
type_line("3 4 + .")
check("7 ok", wait_for(PROMPT, 60, n) and re.search(r"7\s+ok", text()[-400:]) is not None)
check("no fault", count(r"EXCEPTION|PANIC|panic") == 0)
shutdown()
boot_done = True
sf = shutil.which("sfdisk") or "/usr/sbin/sfdisk"
v = subprocess.run([sf, "--verify", blank], capture_output=True, text=True)
print(v.stdout.strip() + v.stderr.strip(), flush=True)
check("sfdisk --verify on the new Zuse stick: clean", v.returncode == 0 and "No errors detected" in v.stdout + v.stderr)
j = subprocess.run([sf, "--json", blank], capture_output=True, text=True)
parts = json.loads(j.stdout)["partitiontable"]["partitions"] if j.returncode == 0 and j.stdout else []
check(f"one StarshipOS identity partition ({[q['type'] for q in parts]})",
len(parts) == 1 and parts[0]["type"].upper() == GPT_IDENTITY)
elif m == "bam_flush":
check("[zuse@Hera] ok>", wait_for(PROMPT, 600))
lbns = re.findall(r"blk: disk .*? LBN (\d+)\.\.(\d+)", text())