libportal icon indicating copy to clipboard operation
libportal copied to clipboard

Qt5 tests require specific environment

Open hadess opened this issue 2 years ago • 3 comments

The Qt5 tests were run when compiling the libportal RPM, but the tests don't set up their own environment, which means they're bound to fail when, say, a D-Bus daemon, or a display isn't available.

The tests should be self-standing and be runnable without further configuration from the caller. That would also mean that the tests could be run in the GitHub CI, which they currently aren't.

Test running in koji:

+ cd libportal-0.6
+ /usr/bin/meson test -C redhat-linux-build --num-processes 6 --print-errorlogs
ninja: Entering directory `/builddir/build/BUILD/libportal-0.6/redhat-linux-build'
ninja: no work to do.
1/1 Qt unit test FAIL            0.35s   killed by signal 6 SIGABRT
>>> MALLOC_PERTURB_=130 /builddir/build/BUILD/libportal-0.6/redhat-linux-build/tests/qt5/qt-test
Summary of Failures:
1/1 Qt unit test FAIL            0.35s   killed by signal 6 SIGABRT
Ok:                 0   
Expected Fail:      0   
Fail:               1   
Unexpected Pass:    0   
Skipped:            0   
Timeout:            0   
Full log written to /builddir/build/BUILD/libportal-0.6/redhat-linux-build/meson-logs/testlog.txt

CC @grulja

Full log

hadess avatar Mar 22 '22 09:03 hadess

This still happens.

$ WAYLAND_DISPLAY=invalid DISPLAY=invalid MALLOC_PERTURB_=241 /home/hadess/Projects/Fedora/merged/libportal/libportal-0.6/redhat-linux-build/tests/qt5/qt-test
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
qt.qpa.xcb: could not connect to display invalid
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.

Aborted (core dumped)

hadess avatar Jun 09 '22 09:06 hadess

xvfb-run and dbus-run-session might be helpful here.

smcv avatar Jun 09 '22 11:06 smcv

This might help: https://src.fedoraproject.org/rpms/qt5-qtbase/blob/rawhide/f/qt5-qtbase.spec#_684

grulja avatar Jun 24 '22 06:06 grulja