cmd/gogio: don't hang on some e2e test errors

For example, if the test app fails to start on wayland, we'd block
~forever (ten minutes) waiting for it to render its first frame.

We don't have a good solution right now. But at least we can use a
relatively short timeout, to help out the human who rightfully expects
a result within ten seconds.

While at it, remove a sway "get_seats" command, which was a leftover
from my debugging of what input devices are available when running
headless.

Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
This commit is contained in:
Daniel Martí
2020-01-12 22:51:57 +08:00
committed by Elias Naur
parent 08b840f114
commit 170e86142c
4 changed files with 25 additions and 10 deletions
+3 -6
View File
@@ -185,7 +185,7 @@ func (d *WaylandTestDriver) Start(t_ *testing.T, path string, width, height int)
}
// Wait for the gio app to render.
<-d.frameNotifs
waitForFrame(d.t, d.frameNotifs)
}
func (d *WaylandTestDriver) Screenshot() image.Image {
@@ -204,9 +204,7 @@ func (d *WaylandTestDriver) Screenshot() image.Image {
}
func (d *WaylandTestDriver) swaymsg(args ...interface{}) {
strs := []string{
"--socket", d.socket,
}
strs := []string{"--socket", d.socket}
for _, arg := range args {
strs = append(strs, fmt.Sprint(arg))
}
@@ -218,11 +216,10 @@ func (d *WaylandTestDriver) swaymsg(args ...interface{}) {
}
func (d *WaylandTestDriver) Click(x, y int) {
d.swaymsg("-t", "get_seats")
d.swaymsg("seat", "-", "cursor", "set", x, y)
d.swaymsg("seat", "-", "cursor", "press", "button1")
d.swaymsg("seat", "-", "cursor", "release", "button1")
// Wait for the gio app to render after this click.
<-d.frameNotifs
waitForFrame(d.t, d.frameNotifs)
}