feat(ci): add automated QEMU live boot screenshot capture workflow
This commit is contained in:
1 parent
6dac92c8d2
commit
bf41a69626
3 files changed
+132
No files matched your search
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env python3
|
||||
import sys
|
||||
import time
|
||||
import socket
|
||||
import json
|
||||
|
||||
def qmp_screendump(sock_path, out_file):
|
||||
try:
|
||||
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||
s.settimeout(10)
|
||||
s.connect(sock_path)
|
||||
s.recv(4096) # QMP greeting
|
||||
s.sendall(json.dumps({"execute": "qmp_capabilities"}).encode() + b"\n")
|
||||
s.recv(4096) # Capabilities accepted
|
||||
cmd = json.dumps({"execute": "screendump", "arguments": {"filename": out_file}})
|
||||
s.sendall(cmd.encode() + b"\n")
|
||||
s.recv(4096) # Screendump completed
|
||||
s.close()
|
||||
print(f"Successfully captured screenshot to: {out_file}")
|
||||
except Exception as e:
|
||||
print(f"Failed to capture {out_file}: {e}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) < 3:
|
||||
print("Usage: capture_qemu.py <qmp_socket_path> <output_ppm_path>")
|
||||
sys.exit(1)
|
||||
sock = sys.argv[1]
|
||||
out = sys.argv[2]
|
||||
qmp_screendump(sock, out)
|
||||
Reference in new issue
Block a user