From 9919a69180a8b2edd9368e1e5fa0ba2e80af70ae Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Thu, 6 Jun 2024 23:11:31 -0500 Subject: abuild: Add checkx11 option This allows test suites that require X11 and/or D-Bus to run. --- APKBUILD.5 | 6 ++++++ abuild.in | 12 ++++++++++++ 2 files changed, 18 insertions(+) diff --git a/APKBUILD.5 b/APKBUILD.5 index dc1c24b..af22a59 100644 --- a/APKBUILD.5 +++ b/APKBUILD.5 @@ -302,6 +302,12 @@ The reason for disabling the check phase should be noted in a comment. Specifies that the package's test suite will be run in .Xr fakeroot 8 . This is necessary for some test suites which fail when run as non-root. +.It Cm checkx11 +Specifies that the package's test suite requires a running X11 server. +This will spawn a D-Bus session bus connected to an Xvfb on display +number 7. The framebuffer can be monitored by running the command +.Cm xwud -in /tmp/Xvfb_screen0 +if desired. .It Cm !dbg Specifies that the package should not be built with a debug information package. diff --git a/abuild.in b/abuild.in index 72a29b2..bfac3e6 100644 --- a/abuild.in +++ b/abuild.in @@ -73,6 +73,7 @@ want_check() { [ -n "$ABUILD_BOOTSTRAP" ] && return 1 cross_compiling && return 1 options_has "!check" && return 1 + options_has "checkx11" && checkdepends="$checkdepends xvfb dbus-x11" return 0 } @@ -1533,6 +1534,9 @@ build_abuildrepo() { if options_has "checkroot"; then _check=check_fakeroot fi + if options_has "checkx11"; then + _check=check_x11 + fi if ! want_check; then _check=true fi @@ -1787,6 +1791,14 @@ check_fakeroot() { do_fakeroot "$abuild_path" $forceroot $color_opt $keep_build check } +# wrap check() for tests requiring X11 and/or D-Bus +check_x11() { + cd "$startdir" + Xvfb :7 -screen 0 1280x1024x24 -fbdir /tmp & + trap "kill %1" 0 + env DISPLAY=:7 dbus-run-session "$abuild_path" $forceroot $color_opt $keep_build check +} + # build and package in fakeroot rootpkg() { cd "$startdir" -- cgit v1.2.3-70-g09d2