canonical / mir-ci

Mir CI helpers
1 stars 1 forks source link

Async all the things #19

Closed wmww closed 1 year ago

wmww commented 1 year ago

Turns out screencopy frames weren't being captured because we were doing non-async waiting in the tests. This makes all our context managers (including notably Program) async, fixing the issue. Assertions are put in place to fail tests that do not get a minimum number of frames.

Saviq commented 1 year ago

The gedit test still feels suspect to me… how could it only be 5 frames when it blinks the cursor every half second for 10 seconds?

test frames
test_active_app[confined_shell-asciinema] 25
test_active_app[confined_shell-mir-kiosk-neverputt] 94
test_compositor_alone[confined_shell] 7
test_inactive_app[confined_shell-qterminal] 9
test_inactive_app[confined_shell-gedit] 5
test_inactive_app[confined_shell-mir-kiosk-kodi] 22
AlanGriffiths commented 1 year ago

how could it only be 5 frames when it blinks the cursor

Does it? Is the cursor over the text area?

Saviq commented 1 year ago

how could it only be 5 frames when it blinks the cursor

Does it? Is the cursor over the text area?

I meant the text cursor, the caret. That one blinks as long as there's focus?

wmww commented 1 year ago

The gedit cursor does eventually stop blinking, but I see it blink about ten times before then.

However I'm currently seeing 22 frames for gedit on ubuntu-frame, and more frames for other servers.

Saviq commented 1 year ago

The numbers are: ci(xvfb) native(local) xvfb(local)

confined-shell mir_demo_server mir-kiosk ubuntu-frame
test_active_app[*-asciinema] 23 27 29 22 22 24 28 35 35 20 23 26
test_active_app[*-mir-kiosk-neverputt] 76 591 705 124 1869 989 99 2359 938 91 1203 805
test_compositor_alone[*] 9 6 6 2 2 2 10 10 10 2 3 3
test_inactive_app[*-gedit] 6 46 51 2 40 58 10 46 47 2 22 22
test_inactive_app[*-mir-kiosk-kodi] 19 163 89 17 181 94 25 164 94 14 154 84
test_inactive_app[*-qterminal] 10 13 13 5 7 8 12 19 17 5 10 9

So the gedit case looks weirdest.

wmww commented 1 year ago

Very strange, confined-shell specifically doesn't seem to be producing any output when run on XVFB. It produces output just fine when run on normal X.

wmww commented 1 year ago

I've gotten closer to the cause. on xvfb-run confined_shell fails to terminate and needs to be killed. Other shells do not, and confined_shell does not when run on normal X (or at least XWayland). This is strange but it's pre-existing, main has the same behavior.

However, something about getting output when a process is killed (not terminated) is broken on this branch. It's not that waiting after the SIGKILL is timing out. The process exits quickly after being killed, it just doesn't give any output. Continuing to investigate.

wmww commented 1 year ago

That ended up being a bit tricky, but I think I have a good system now. The problem was that with asyncio it's only reasonable to call process.communicate() once, even if that call is cancelled. With the new system it's called when the program starts, but not awaited until the program is done. There's also a task that sends the signals to kill and later terminate the program, and it's cancelled when the program is done.

Saviq commented 1 year ago

bors merge

bors[bot] commented 1 year ago

Build succeeded: