Introducing a virtual framebuffer Wayland server in KWayland

The next KDE framework release will include a small addition in KWayland which will make it much easier to run auto tests for Wayland based applications. KWayland now installs a small virtual framebuffer test server into libexec directory.

This means it’s an application inspired by Xvfb which allows to run a graphical application with a virtual framebuffer. The new tool is the same for Wayland. KWayland makes testing already quite easy, but we noticed that we don’t have a good setup for the case that we want to test an application which uses QtWayland QPA plugin as that is not possible with the test support so far in KWayland.

The idea behind the server is that every test gets it’s own dedicated test Wayland server. The test Wayland server will start the test and terminate itself once the test finished (either successful, failure or crash). All output from the test – including exit code – is forwarded, which makes integration into a ctest based system really easy.

In fact if you use CMake as a build system to define your tests, this becomes super easy:

find_package(KF5Wayland CONFIG)
add_executable(myTest myTest.cpp)
target_link_libraries(myTest Qt5::Gui Qt5::Test)
kwaylandtest(myTest)

This also allows to run the same test on X11 and on Wayland. Assuming the test is meant for build.kde.org which has an Xvfb running during the test phase, one can add the test the normal way (X11) and just add the kwaylandtest in addition. So the test will run on both windowing systems.

Now this is a really new project and the test server is still rather limited. All it does is faking rendering at 60 Hz. Otherwise it’s still limited and does not provide the functionality of e.g. a window manager on X11. In that regard it’s also inspired by Xvfb which doesn’t support that. I plan to extend this as I have need in the tests I’m going to add for it.

Speaking of that: the first test case making use of this new infrastructure is already pushed.

2 Replies to “Introducing a virtual framebuffer Wayland server in KWayland”

  1. Martin,
    This is the only place that I have found by Googling that mentions ‘kwaylandtest’.
    When I compile the latest frameworks+plasma+applications (5.24.0+5.7.1+16.04.3),
    I do find that kwayland in the frameworks has provided:
    /lib/libexec/org-kde-kf5-kwayland-testserver
    But when I try to compile kwayland-integration, I get:

    CMake Error at autotests/idletime/CMakeLists.txt:3 (kwaylandtest):
    Unknown CMake command “kwaylandtest”.

    What is going wrong?

    Regards,
    David

    1. I don’t know and my blog is not the right place to investigate. Best open a big report with your distribution

Comments are closed.