test(pi3): fix Phase 2 E2E test + bump rootfs to shims-final

The Phase 2 E2E test was sending the Python GPIO command via
'python3 -c "..."' but bash quote-nesting silently corrupted the
script — the python process started, printed nothing, exited 0, and
the test asserted 'GPIO_SETUP 17 out' was missing in proto bytes
(it never got sent because the python script never ran).

Switch the test to base64-encode the script + pipe through base64 -d
into a file, then execute. Verified end-to-end now:

  [test] proto received 36 bytes:
      GPIO_SETUP 17 out pud_off
      GPIO 17 1
  [test] ✓ shim → proto pipeline works

Also bump the rootfs manifest entry to the final Phase 2 build
(d6d4a274 raw / debd1c33 zst, version 2026.05+phase2-shims-final).

Earlier auto-discovery in _transport.py was hanging at import time
on some glob/sysfs interaction. Now hardcoded /dev/vport1p1 which
is the empirical path under -M virt + virtio-blk-pci on slot 0.
This commit is contained in:
davidmonterocrespo24 2026-05-18 15:00:04 +02:00
parent 5c5336acc0
commit ca2b76f1f8
2 changed files with 37 additions and 11 deletions

View File

@ -22,13 +22,13 @@
{
"name": "velxio-pi-rootfs-arm64.ext4",
"asset_id": "velxio-pi-rootfs-arm64-zst",
"sha256": "6b471bdf2d078eae75e00249fa3d1d1c377a3801b205afebe1dd50dc9db5de07",
"sha256": "d6d4a2747d18055493a621f28bf2552e94dc2a11b1586d64b0eeb3847c7e06be",
"size_bytes": 629145600,
"version": "2026.05+phase2-shims-autodiscovery",
"version": "2026.05+phase2-shims-final",
"compressed": {
"encoding": "zstd",
"sha256": "6c189066aa1796eb2344c4b140be2190e2e767467f1fd6a2db9d63f225fd4414",
"size_bytes": 24734406
"sha256": "debd1c339dc8a6e0c72494a14f032d69f3579f4f55929ca45446f030415602ca",
"size_bytes": 24733697
}
}
]

View File

@ -147,14 +147,40 @@ def run() -> int:
if not chunk:
break
buf.extend(chunk)
if not saw_prompt and b"login on" in buf:
# Wait for the actual bash prompt (`:~#`) — `login on` alone
# fires from the login message line BEFORE bash is fully
# ready to read input. The :~# marker only appears once
# bash has printed PS1.
if not saw_prompt and b":~#" in buf:
saw_prompt = True
print("[test] login reached, sending Python GPIO call")
time.sleep(2)
cmd = (b"python3 -c \"import RPi.GPIO as G; "
b"G.setmode(G.BCM); G.setup(17, G.OUT); "
b"G.output(17, 1); import time; time.sleep(0.3); "
b"print('SHIM_OK')\"\n")
print("[test] bash prompt reached, sending Python GPIO call")
time.sleep(3)
try:
while True:
more = sock.recv(4096)
if not more:
break
buf.extend(more)
except socket.timeout:
pass
# Send the Python test as a base64-encoded file —
# avoids all the bash/python -c quote-nesting hell
# (which silently corrupts the script and makes
# nothing happen, see the Phase 2 debug logs).
import base64
py = (
"import RPi.GPIO as G\n"
"G.setmode(G.BCM)\n"
"G.setup(17, G.OUT)\n"
"G.output(17, 1)\n"
"import time; time.sleep(0.5)\n"
"print('SHIM_OK')\n"
)
b64 = base64.b64encode(py.encode()).decode()
cmd = (
f"echo {b64} | base64 -d > /tmp/shim_test.py && "
f"python3 /tmp/shim_test.py\n"
).encode()
sock.sendall(cmd)
sent_test = True
if sent_test and b"SHIM_OK" in buf: