Exercise X11 client libraries in a diskless Vinix guest
@@ -0,0 +1,26 @@
1+# X11 client library probe
2+
3+Build this probe with a signed vpac SDK containing musl, libxau, libxdmcp, libxcb and their dependencies. It checks Xauthority path selection, XDMCP network byte order and XCB display parsing without opening a display connection.
4+
5+```sh
6+export VPAC_MAKEPKG_ROOT="$sdk/root"
7+v -prod -musl -gc none -cc gcc \
8+ -cflags "--sysroot=$VPAC_MAKEPKG_ROOT -specs=$VPAC_MAKEPKG_ROOT/usr/lib/musl-gcc-sysroot.specs" \
9+ -o "$work/xcb-display" tests/xcb/display.v
10+vinix-run "$work/xcb-display"
11+readelf -l -d "$work/xcb-display"
12+```
13+
14+For a diskless x86_64 guest, install BusyBox into the same SDK. Copy its root to a fixture directory, add the probe and build the serial shell ISO with the existing guest runner.
15+
16+```sh
17+cp -a "$sdk/root" "$work/guest-root"
18+install -m755 "$work/xcb-display" "$work/guest-root/xcb-display"
19+"$work/boot" "$work/guest-root" "$vinix_iso" "$work/guest" --shell
20+qemu-system-x86_64 -machine q35 -accel tcg -cpu max -m 384 -smp 1 \
21+ -cdrom "$work/guest/busybox-shell.iso" -nic none -display none -monitor none -serial stdio
22+```
23+
24+At the `vinix>` prompt run `uname -sm`, then `/xcb-display`. A successful run prints `Xau, Xdmcp and XCB display checks passed.` Run `poweroff -f` to end the VM.
25+
26+The x86_64 worker ran this probe in Vinix on 2026-11-29 with BusyBox 1.38.0-2, musl 1.2.6-1, Xau 1.0.11-1, Xdmcp 1.1.5-1 and XCB 1.16.1-1. The client authorization and protocol recipes originated at ports revision `e812945`. The XCB recipe added DRI3 to the generated Present header's pkg-config requirements. The signed package hashes are under `~/.local/state/vinix/ports/musl-busybox-CqkBEA/xorg/feed-7/packages.tsv`. The transcript is under `xorg/guest/worker/serial.log` in the same bundle and has SHA-256 `b2911de93665161d3dc759511daec7016055373aefb1b512a8c2d0ab223799b5`.
@@ -0,0 +1,46 @@
1+// Exercise the installed client libraries without requiring a display server.
2+module main
3+
4+import os
5+
6+#include <X11/Xauth.h>
7+#include <X11/Xdmcp.h>
8+#include <xcb/xcb.h>
9+#flag -lXau
10+#flag -lXdmcp
11+#flag -lxcb
12+
13+@[typedef]
14+struct C.XdmcpBuffer {
15+ data &u8
16+ size int
17+ pointer int
18+ count int
19+}
20+
21+fn C.XauFileName() &char
22+fn C.XdmcpReadCARD16(&C.XdmcpBuffer, &u16) int
23+fn C.xcb_parse_display(&char, &&char, &int, &int) int
24+
25+fn main() {
26+ os.setenv('XAUTHORITY', '/tmp/display-fixture.Xauthority', true)
27+ assert unsafe { cstring_to_vstring(C.XauFileName()) } == '/tmp/display-fixture.Xauthority'
28+
29+ packet := [u8(0x12), 0x34]!
30+ mut buffer := C.XdmcpBuffer{
31+ data: unsafe { &packet[0] }
32+ size: packet.len
33+ count: packet.len
34+ }
35+ mut value := u16(0)
36+ assert C.XdmcpReadCARD16(&buffer, &value) == 1
37+ assert value == 0x1234 && buffer.pointer == 2
38+
39+ mut host := &char(unsafe { nil })
40+ mut display, mut screen := 0, 0
41+ assert C.xcb_parse_display(c'localhost:42.1', &host, &display, &screen) == 1
42+ assert unsafe { cstring_to_vstring(host) } == 'localhost'
43+ unsafe { C.free(host) }
44+ assert display == 42 && screen == 1
45+ println('Xau, Xdmcp and XCB display checks passed.')
46+}