mirror of
https://github.com/MCKero6423/uv-k5-v3-emulator.git
synced 2026-10-02 11:07:31 +00:00
tools/run_tests.sh defaults QEMU_SRC to a sibling of the checkout, which is where setup_qemu.sh puts it; the two defaults disagreed, so a fresh clone rebuilt nothing and reported a build that was not there. The interpreter list was also reading an empty $PY. tools/test_bk4819_readback.sh was the last test with the author's paths, and the only one that could not run elsewhere. It now takes QEMU, GDB and ELF from the environment or PATH like the python tests, skips with a reason when one is missing, and says so on a platform whose QEMU cannot make the unix socket it uses. tools/check_docs.py points UVK5_FW_DIR at a sibling and skips the file:line checks, with a message, when there is no firmware tree -- a fresh clone used to see thirteen failures it could do nothing about. Added .github/workflows/unit.yml (the fast half of run_tests.sh on every push and PR), requirements-dev.txt for the one pip dependency, and a Dockerfile. Flask is not always installed, so test_webui now skips through setUpModule rather than erroring.
55 lines
1.4 KiB
Bash
Executable File
55 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Press keys, then screenshot -- without any GDB breakpoints in between.
|
|
#
|
|
# Breakpoints halt the guest, so a key held across a breakpoint session is never
|
|
# processed by the main loop. This holds the key, lets the machine run freely,
|
|
# releases, and only then reads the framebuffer.
|
|
set -uo pipefail
|
|
|
|
TOOLS="$(cd "$(dirname "$0")" && pwd)"
|
|
OUT="${OUT:-$PWD/vm_screen.png}"
|
|
HOLD="${HOLD:-3}"
|
|
SETTLE="${SETTLE:-3}"
|
|
|
|
hold_key() {
|
|
python3 - "$1" <<'PY'
|
|
import json, socket, sys
|
|
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
|
s.connect("/tmp/uvk5-qmp.sock")
|
|
buf = b""
|
|
|
|
|
|
def rd():
|
|
global buf
|
|
while b"\n" not in buf:
|
|
buf += s.recv(4096)
|
|
line, buf = buf.split(b"\n", 1)
|
|
return json.loads(line)
|
|
|
|
|
|
rd()
|
|
for p in ({"execute": "qmp_capabilities"},
|
|
{"execute": "qom-set",
|
|
"arguments": {"path": "/machine/keypad", "property": "press",
|
|
"value": sys.argv[1]}}):
|
|
s.sendall(json.dumps(p).encode() + b"\n")
|
|
while True:
|
|
m = rd()
|
|
if "return" in m or "error" in m:
|
|
break
|
|
PY
|
|
}
|
|
|
|
for key in "$@"; do
|
|
echo "press $key"
|
|
hold_key "$key"
|
|
sleep "$HOLD"
|
|
hold_key ""
|
|
sleep "$SETTLE"
|
|
done
|
|
|
|
rm -f /tmp/_screen_dump.bin
|
|
python3 "$TOOLS/screenshot.py" \
|
|
--frame-addr 0x200013DC --status-addr 0x2000175C \
|
|
--port 1234 --out "$OUT" --scale 4 2>&1 | grep pixels
|