Can't run SDL2: No available video device

./build/Test/HexagonEngineTest
[==========] Running 2 tests from 1 test suite.
[----------] Global test environment set-up.
[----------] 2 tests from Window
[RUN] Window.WindowSize
error: XDG_RUNTIME_DIR not set in the environment.
unknown file: Failure
C++ exception with description "ERROR: SDL_Init failed No available video device" thrown in the test body.
[FAILED] Window.WindowSize (112 ms)
[RUN] Window.WindowSize
error: XDG_RUNTIME_DIR not set in the environment.
unknown file: Failure
C++ exception with description "ERROR: SDL_Init failed No available video device" thrown in the test body.
[FAILED] Window.WindowSize (0 ms)
[----------] 2 tests from Window (112 ms total)

[----------] Global test environment tear-down
[==========] 2 tests from 1 test suite ran. (112 ms total)
[PASSED] 0 tests.
[FAILED] 2 tests, listed below:
[FAILED] Window.WindowSize
[FAILED] Window.WindowSize

 2 FAILED TESTS
make: *** [test] Error 1
Makefile:5: recipe for target 'test' failed
##[error]Process completed with exit code 2.

You can take a look for it here

Is there any solution for this problem?

I fork your repo and notice the error has been changed. Could you please let me know if the original issue has been resolved? Thanks.

We have moved from GitHub Actions to Travis CI and I have solve the problem (that also occur in Travis CI) in Travis CI. The solution must be similar to GitHub Actions.

Simply install the dependencies below

  • mesa-utils
  • linux-generic
  • xserver-xorg-core
  • xserver-xorg
  • xserver-xorg-video-all
  • xserver-xorg-input-all
  • libwayland-egl1-mesa

And then start it

/sbin/start-stop-daemon --start --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 800x600x24 -ac +extension GLX;
export SDL_VIDEODRIVER=x11;
export DISPLAY=:99.0;

https://github.com/andraantariksa/hexagon-engine/blob/master/.travis.yml

https://docs.travis-ci.com/user/gui-and-headless-browsers/#Starting-a-Web-Server

For anyone else ever hitting this again, try a virtual framebuffer via XVFB. It’s already installed, but this action makes running much simpler: