test(stick): Artemis grows to fill the stick -- the tests, seen to fail (#92, Task 2) [skip ci]

Plan 2026-10-29-stick-5, Task 2, steps 1-2:
- qemu_session.py: --stick-gib N (the session's copy of the stick extended,
  sparse); modes stick_grow (16 GiB: grown, over 12000000 user blocks, the
  prompt, the first boot's time; the second boot of the same copy not grown
  again; sfdisk --verify clean) and stick_small (4 GiB: under 8 GB, not grown,
  said so).
- kernel/Makefile: STICK_GIB and STICK_FRESH on qemu-stick, for those.
- check_images.sh: the PC stick's and data stick's Artemis BAM sized for the
  256 GiB cap (6144 devblocks).

Before the change: stick_grow FAIL (no growth line, 1137649 user blocks,
sfdisk: the backup GPT not at the end); stick_small FAIL (no line);
check_images.sh FAIL on the two BAM checks only.

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 11:54:53 +00:00
parent 4c38a7b1e6
commit 4e935e4825
9 changed files with 566 additions and 4 deletions
+7
View File
@@ -73,6 +73,11 @@ same() { # same IMG N FILE -- partition N holds FILE's bytes, and is exactly i
cmp -s -i "$((s * 512)):0" -n "$((z * 512))" "$1" "$3"
}
# bam IMG N -- the BAM of partition N's Artemis volume, in 4 KiB devblocks (mkartemis --check)
bam() { artemis_check "$1" "$2" 2>/dev/null | sed -n 's/.* bam \([0-9]*\) .*/\1/p'; }
# the BAM sized for the 256 GiB growth cap (plan 2026-10-29-stick-5, R1): choose_B of 2^26 devblocks
CAP_BAM=6144
uuid() { artemis_check "$1" "$2" 2>/dev/null | sed -n 's/.*disk_uuid \([0-9a-f]*\).*/\1/p'; }
echo "== building"
@@ -95,6 +100,7 @@ check "the ESP holds startup.nsh" mdir -i "$STICK@@$OFF" ::/startup.nsh
check "starforth.cfg's first word is system=v4" eq "$(mtype -i "$STICK@@$OFF" ::/starforth.cfg 2>/dev/null | awk '{print $1; exit}')" "system=v4"
check "the identity partition is all zeros" zeros "$STICK" 2
check "Artemis: STFR v2, signature ok" artemis_check "$STICK" 3
check "Artemis: its BAM sized for 256 GiB ($CAP_BAM devblocks)" eq "$(bam "$STICK" 3)" "$CAP_BAM"
echo "== the data stick ($DATA)"
check "it exists, 1536 MiB" eq "$(stat -c %s "$DATA" 2>/dev/null)" "$((1536 * 1048576))"
@@ -105,6 +111,7 @@ check "whole MiB, contiguous, Artemis to the end" geometry "$DATA"
check "sfdisk --verify: the GPT is clean" sfdisk --verify "$DATA"
check "the identity partition is all zeros" zeros "$DATA" 1
check "Artemis: STFR v2, signature ok" artemis_check "$DATA" 2
check "Artemis: its BAM sized for 256 GiB ($CAP_BAM devblocks)" eq "$(bam "$DATA" 2)" "$CAP_BAM"
U1=$(uuid "$DATA" 2)
check "the data stick builds again" make -f kernel/Makefile ARCH=amd64 datastick
U2=$(uuid "$DATA" 2)
+57 -2
View File
@@ -53,6 +53,12 @@ the stick's, plan 2026-10-26-stick-1-screen-and-keyboard.md):
identity confirmed, no genesis, the prompt (plan 2026-10-29-stick-5, Task 1)
stick_genesis --target qemu-stick, the PC stick as built (no STICK_PAIR): its first boot mints
the proxy Zuse and reaches [zuse@Hera] ok> with nothing set up (plug and play)
stick_grow --target qemu-stick --stick-gib 16: the first boot grows Artemis to fill the stick
(over 12000000 user blocks), mints, the prompt, its time POST -> prompt printed; the
second boot of the same copy is not grown again and recognises Zuse; sfdisk --verify
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
stick_artemis ARTDISK= (no virtio disk): Artemis and Zuse from the Zuse stick alone -- the
stick's Artemis partition attached first (785938 user blocks), then its identity
(48724); [zuse@Hera] ok> (plan 2026-10-27-stick-4-one-disk.md, Task 4)
@@ -88,6 +94,7 @@ ap.add_argument("--label", default=None)
ap.add_argument("--make", default="")
ap.add_argument("--no-zuse", action="store_true")
ap.add_argument("--target", default="qemu") # qemu-stick: boot the PC stick (amd64)
ap.add_argument("--stick-gib", type=int, default=None) # qemu-stick: the copy extended to N GiB
a = ap.parse_args()
NO_ZUSE_MODES = {"gpt_zuse", "gpt_hotplug", "gpt_foreign", "gpt_bad_crc", "gpt_bad_entries", "gpt_no_header",
@@ -95,7 +102,7 @@ NO_ZUSE_MODES = {"gpt_zuse", "gpt_hotplug", "gpt_foreign", "gpt_bad_crc", "gpt_b
"alttab_after_logout", "alttab_before_pull", "emergency_pull",
"screen_dark_until_login", "screen_console_after_login", "screen_dark_after_logout",
"kbd_typeahead", "stick_boot", "stick_v3", "stick_zuse", "screen_boot", "genesis",
"stick_genesis"}
"stick_genesis", "stick_grow", "stick_small"}
label = a.label or f"{a.mode}-{a.arch}"
work = os.path.join(ROOT, "build", "qemu-session", label)
shutil.rmtree(work, ignore_errors=True)
@@ -135,6 +142,10 @@ if a.mode == "screen_boot":
make_args.append("KERNEL_ARGS=screen=boot")
if a.mode == "stick_zuse":
make_args.append(f"STICK_PAIR={work}") # the PC stick with this session's copy of the pair
if a.stick_gib:
make_args.append(f"STICK_GIB={a.stick_gib}")
if a.mode in ("stick_grow", "stick_small"):
make_args.append("KERNEL_ARGS=--log-level=info") # the blk: disk lines the sizes are read from
if a.mode == "genesis":
# a fresh data stick, made once into this session's directory and booted twice: the second
# boot is the same copy, so it finds what the first wrote (plan 2026-10-29-stick-5, Task 1)
@@ -464,6 +475,49 @@ elif m in ("genesis", "stick_genesis"):
check("7 ok (second boot)", wait_for(PROMPT, 60, n) and re.search(r"7\s+ok", text()[-400:]) is not None)
check("no fault (second boot)", count(r"EXCEPTION|PANIC|panic") == 0)
elif m in ("stick_grow", "stick_small"):
def artemis_blocks():
u = re.findall(r"blk: disk .*?\((\d+) us", text())
return int(u[0]) if u else None
t0 = time.time()
if m == "stick_grow":
check("Artemis: grown to fill the stick", wait_for(r"Artemis: grown to fill the stick", 300),
near=r"Artemis: |GPT: ")
else:
check("Artemis: the stick is under 8 GB -- not grown",
wait_for(r"Artemis: the stick is under 8 GB -- not grown", 300), near=r"Artemis: |GPT: ")
check("Zuse: genesis minted onto attached thumbdrive",
wait_for(r"Zuse: genesis minted onto attached thumbdrive", 300), near=r"Artemis: |Zuse: ")
check("[zuse@Hera] ok>", wait_for(PROMPT, 120))
print(f"TIME: POST to the prompt, first boot: {time.time() - t0:.0f} s", flush=True)
b1 = artemis_blocks()
if m == "stick_grow":
check(f"Artemis over 12000000 user blocks ({b1})", b1 is not None and b1 > 12000000)
else:
check(f"Artemis at the image's size, 1000000..1200000 user blocks ({b1})",
b1 is not None and 1000000 < b1 < 1200000)
check("no fault", count(r"EXCEPTION|PANIC|panic") == 0)
if m == "stick_grow":
shutdown()
print("-- the second boot, the same copy of the stick", flush=True)
boot([x for x in make_args if x != "clean"] + ["STICK_FRESH=0"])
check("POST: PASSED (second boot)", wait_for(r"POST: PASSED", 900))
check("Zuse: identity confirmed (second boot)",
wait_for(r"Zuse: identity confirmed from attached thumbdrive", 300), near=r"Artemis: |Zuse: ")
check("[zuse@Hera] ok> (second boot)", wait_for(PROMPT, 120))
check("not grown again", count(r"Artemis: grown") == 0)
b2 = artemis_blocks()
check(f"the same Artemis size ({b1} -> {b2})", b2 == b1)
check("no fault (second boot)", count(r"EXCEPTION|PANIC|panic") == 0)
shutdown()
sf = shutil.which("sfdisk") or "/usr/sbin/sfdisk"
run = os.path.join(ROOT, "build", a.arch, "kernel", "stick-run.img")
v = subprocess.run([sf, "--verify", run], capture_output=True, text=True)
print(v.stdout.strip() + v.stderr.strip(), flush=True)
check("sfdisk --verify on the grown copy: clean",
v.returncode == 0 and "No errors detected" in v.stdout + v.stderr)
boot_done = True
elif m == "stick_v3":
t = text()
check("Boot disk: a StarshipOS stick", re.search(r"Boot disk: a StarshipOS stick", t) is not None)
@@ -708,7 +762,8 @@ else:
check(f"known mode {m}", False)
print(f"RESULT: {'PASS' if ok else 'FAIL'}", flush=True)
shutdown()
if not globals().get("boot_done"):
shutdown()
for f in ("v3/include/version.h", "capsules/BLOCK_MAP.md"):
subprocess.run(["git", "checkout", "-q", "--", f], cwd=ROOT)
sys.exit(0 if ok else 2)