detached 37f59a2

Merge branch 'fix/flaky-capture-syncobj' into main (!14)

test: fix flaky syncobj and capture keyboard tests
commit
37f59a2137a9674de4682e4dfbb501bef42894b5
author
ermite · · 2026-10-21 07:47 UTC
merge of
4f9bb17 + 0b0d373 · diff against the first parent
signature
SSH VerifiedSHA256:lY9fILbB/A+hln6Vh/iHoiiog74bbw/4qWrf/lrTU3U · ermite instance key Verified for the committer email
checks
1/1
2 files · +15 -7
M internal/adapters/wayland/syncobj_test.go +3 -1
@@ -443,7 +443,9 @@ func TestSyncobjProtocolErrors(t *testing.T) {
443443 }, func(h *syncHarness) uint32 { return h.syncSurf }, uint32(linuxdrmsyncobj.WpLinuxDrmSyncobjSurfaceV1ErrorUnsupportedBuffer)},
444444 {"surface destroyed", func(h *syncHarness) {
445445 requestProtocol(t, h.c, h.surf, wayland.SurfaceRequestDestroy)
446- h.setPoints(1, 2)
446+ // The first request already raises the error and the server
447+ // then closes the connection: a second write could hit EPIPE.
448+ requestProtocol(t, h.c, h.syncSurf, linuxdrmsyncobj.WpLinuxDrmSyncobjSurfaceV1RequestSetAcquirePoint, h.timeline, uint32(0), uint32(1))
447449 }, func(h *syncHarness) uint32 { return h.syncSurf }, uint32(linuxdrmsyncobj.WpLinuxDrmSyncobjSurfaceV1ErrorNoSurface)},
448450 {"surface exists", func(h *syncHarness) {
449451 mgr := bindProtocol(t, h.c, "wp_linux_drm_syncobj_manager_v1")
@@ -443,7 +443,9 @@ func TestSyncobjProtocolErrors(t *testing.T) {
443 }, func(h *syncHarness) uint32 { return h.syncSurf }, uint32(linuxdrmsyncobj.WpLinuxDrmSyncobjSurfaceV1ErrorUnsupportedBuffer)},443 }, func(h *syncHarness) uint32 { return h.syncSurf }, uint32(linuxdrmsyncobj.WpLinuxDrmSyncobjSurfaceV1ErrorUnsupportedBuffer)},
444 {"surface destroyed", func(h *syncHarness) {444 {"surface destroyed", func(h *syncHarness) {
445 requestProtocol(t, h.c, h.surf, wayland.SurfaceRequestDestroy)445 requestProtocol(t, h.c, h.surf, wayland.SurfaceRequestDestroy)
446- h.setPoints(1, 2)446+ // The first request already raises the error and the server
447+ // then closes the connection: a second write could hit EPIPE.
448+ requestProtocol(t, h.c, h.syncSurf, linuxdrmsyncobj.WpLinuxDrmSyncobjSurfaceV1RequestSetAcquirePoint, h.timeline, uint32(0), uint32(1))
447 }, func(h *syncHarness) uint32 { return h.syncSurf }, uint32(linuxdrmsyncobj.WpLinuxDrmSyncobjSurfaceV1ErrorNoSurface)},449 }, func(h *syncHarness) uint32 { return h.syncSurf }, uint32(linuxdrmsyncobj.WpLinuxDrmSyncobjSurfaceV1ErrorNoSurface)},
448 {"surface exists", func(h *syncHarness) {450 {"surface exists", func(h *syncHarness) {
449 mgr := bindProtocol(t, h.c, "wp_linux_drm_syncobj_manager_v1")451 mgr := bindProtocol(t, h.c, "wp_linux_drm_syncobj_manager_v1")
M internal/core/capture_test.go +12 -6
@@ -68,6 +68,16 @@ func (r *captureRig) layer(id ports.WindowID, layer ports.Layer, keyboard uint32
6868 return ports.LayerSurface{ID: id, Layer: layer, Anchor: ports.AnchorTop | ports.AnchorLeft, Width: 10, Height: 10, Output: "OUT-1", Keyboard: keyboard}
6969 }
7070
71+// drainCommands drops the commands already queued. Call it only once the
72+// core is quiet (after receiving a scene, which is published after its
73+// commands) and before sending the event under test: draining after the
74+// send races with the core emitting the commands the test waits for.
75+func (r *captureRig) drainCommands() {
76+ for len(r.commands) > 0 {
77+ <-r.commands
78+ }
79+}
80+
7181 // excludedScene waits for a scene whose exclusion list has n entries.
7282 func (r *captureRig) excludedScene(t *testing.T, n int) ports.Scene {
7383 t.Helper()
@@ -372,10 +382,8 @@ func TestCaptureExclusionKeyboardClamp(t *testing.T) {
372382 r.client <- ports.CaptureExclusionBegin{Session: 1}
373383 r.client <- ports.CaptureExclusionLayer{Session: 1, Layer: 10, Attached: true}
374384 r.excludedScene(t, 1)
385+ r.drainCommands()
375386 r.client <- ports.LayerChanged{Layers: []ports.LayerSurface{r.layer(10, ports.LayerOverlay, 1), r.layer(11, ports.LayerOverlay, 1)}}
376- for len(r.commands) > 0 {
377- <-r.commands
378- }
379387 scene(t, r.scenes)
380388 for {
381389 if f, ok := receive(t, r.commands).(ports.FocusWindow); ok {
@@ -396,9 +404,7 @@ func TestCaptureExclusionKeyboardNone(t *testing.T) {
396404 r.client <- ports.CaptureExclusionBegin{Session: 1}
397405 r.client <- ports.CaptureExclusionLayer{Session: 1, Layer: 10, Attached: true}
398406 r.excludedScene(t, 1)
399- for len(r.commands) > 0 {
400- <-r.commands
401- }
407+ r.drainCommands()
402408 r.client <- ports.WindowMapped{ID: 1}
403409 scene(t, r.scenes)
404410 for len(r.commands) > 0 {
@@ -68,6 +68,16 @@ func (r *captureRig) layer(id ports.WindowID, layer ports.Layer, keyboard uint32
68 return ports.LayerSurface{ID: id, Layer: layer, Anchor: ports.AnchorTop | ports.AnchorLeft, Width: 10, Height: 10, Output: "OUT-1", Keyboard: keyboard}68 return ports.LayerSurface{ID: id, Layer: layer, Anchor: ports.AnchorTop | ports.AnchorLeft, Width: 10, Height: 10, Output: "OUT-1", Keyboard: keyboard}
69 }69 }
70 70
71+// drainCommands drops the commands already queued. Call it only once the
72+// core is quiet (after receiving a scene, which is published after its
73+// commands) and before sending the event under test: draining after the
74+// send races with the core emitting the commands the test waits for.
75+func (r *captureRig) drainCommands() {
76+ for len(r.commands) > 0 {
77+ <-r.commands
78+ }
79+}
80+
71 // excludedScene waits for a scene whose exclusion list has n entries.81 // excludedScene waits for a scene whose exclusion list has n entries.
72 func (r *captureRig) excludedScene(t *testing.T, n int) ports.Scene {82 func (r *captureRig) excludedScene(t *testing.T, n int) ports.Scene {
73 t.Helper()83 t.Helper()
@@ -372,10 +382,8 @@ func TestCaptureExclusionKeyboardClamp(t *testing.T) {
372 r.client <- ports.CaptureExclusionBegin{Session: 1}382 r.client <- ports.CaptureExclusionBegin{Session: 1}
373 r.client <- ports.CaptureExclusionLayer{Session: 1, Layer: 10, Attached: true}383 r.client <- ports.CaptureExclusionLayer{Session: 1, Layer: 10, Attached: true}
374 r.excludedScene(t, 1)384 r.excludedScene(t, 1)
385+ r.drainCommands()
375 r.client <- ports.LayerChanged{Layers: []ports.LayerSurface{r.layer(10, ports.LayerOverlay, 1), r.layer(11, ports.LayerOverlay, 1)}}386 r.client <- ports.LayerChanged{Layers: []ports.LayerSurface{r.layer(10, ports.LayerOverlay, 1), r.layer(11, ports.LayerOverlay, 1)}}
376- for len(r.commands) > 0 {
377- <-r.commands
378- }
379 scene(t, r.scenes)387 scene(t, r.scenes)
380 for {388 for {
381 if f, ok := receive(t, r.commands).(ports.FocusWindow); ok {389 if f, ok := receive(t, r.commands).(ports.FocusWindow); ok {
@@ -396,9 +404,7 @@ func TestCaptureExclusionKeyboardNone(t *testing.T) {
396 r.client <- ports.CaptureExclusionBegin{Session: 1}404 r.client <- ports.CaptureExclusionBegin{Session: 1}
397 r.client <- ports.CaptureExclusionLayer{Session: 1, Layer: 10, Attached: true}405 r.client <- ports.CaptureExclusionLayer{Session: 1, Layer: 10, Attached: true}
398 r.excludedScene(t, 1)406 r.excludedScene(t, 1)
399- for len(r.commands) > 0 {407+ r.drainCommands()
400- <-r.commands
401- }
402 r.client <- ports.WindowMapped{ID: 1}408 r.client <- ports.WindowMapped{ID: 1}
403 scene(t, r.scenes)409 scene(t, r.scenes)
404 for len(r.commands) > 0 {410 for len(r.commands) > 0 {

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 25

Tags 10

↑↓ moveenter openesc close