Travis CI - Perform LWJGL tests in a headless environment?

I am trying to run several tests on Travis CI that need a server that ... Error without a head. As you can say, I know so little about an area that I don’t even know what terminology to use.

The tests use LibGDX and LWJGL. They work fine on my desktop (Windows 8 and Ubuntu), but it is not surprising to fail in Travis CI:

Could not initialize class org.lwjgl.Sys at org.lwjgl.opengl.Display.<clinit>(Display.java:135) at com.badlogic.gdx.backends.lwjgl.LwjglGraphics.setVSync(LwjglGraphics.java:446) at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:118) 

Can I do something with Travis CI so that he thinks he has the right display? Even if this is not possible using Travis CI, is there a general approach that I could take with another virtual machine? Do I have more control over?

+5
source share
2 answers

This can be done using xvfb. In your travis.yml add this:

 before_script: - export DISPLAY=:99.0 - sh -e /etc/init.d/xvfb start 

You will need to install xvfb if you do not already have it. You may also need to install other libraries / packages necessary for your tests on the virtual machine (for example, for testing web applications, you will need a browser).

+4
source

Running a virtual framebuffer (xvfb) on Travis CI is not enough. If you need OpenGL> 1.4, you also need to install libgl1-mesa-swx11, libgl1-mesa-swx11-dev.

In my travis.yml, I install OpenGL and run xvfb with:

 - sudo apt-get install -qq --force-yes mesa-utils libgl1-mesa-swx11 libgl1-mesa-swx11-dev xvfb - /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1400x900x24 -ac +extension GLX +render 

the whole file is located at: https://github.com/mwohlf/pluto/blob/master/.travis.yml

+1
source

Source: https://habr.com/ru/post/1214581/


All Articles