https://kotlinlang.org logo
#getting-started
Title
# getting-started
z

zt

02/06/2023, 5:41 AM
I'm trying to use the x11 protocol in a library I'm making and I'm wondering how I can make tests for it. I need to have an x server running, is there some way I can do that automatically through the test lib?
e

ephemient

02/06/2023, 7:46 AM
sure, you can start a Xvfb. although you'll have to take care in choosing a display number to avoid collisions
oh right, I'm not sure since what version, but with new enough xorg-xserver, you can run
Xvfb -displayfd N
and it'll choose a free display number on its own and print it to file descriptor
N
maybe not the best way to do it, but getting Gradle to auto-start and stop a
Xvfb
for tests is pretty easy
👌 1
z

zt

02/06/2023, 10:33 PM
Oh thats perfect, thank you
10 Views