talkatu/talkatu

c479d9b87420
Parents 1feab6429217
Children bf39ae959edc
Replace xvfb with broadway in the test wrapper

Use broadway as our test wrapper since xvfb isn't everywhere and is a pain.

Testing Done:
Ran the build images for fedora 32 and debian bullseye locally, still waiting for the images to be built and pushed to docker hub.

Reviewed at https://reviews.imfreedom.org/r/105/
--- a/meson.build Thu Sep 03 20:11:57 2020 -0500
+++ b/meson.build Sat Sep 05 23:29:15 2020 -0500
@@ -45,10 +45,6 @@
HELP2MAN = find_program('help2man')
endif
-if get_option('tests')
- XVFB_RUN = find_program('xvfb-run')
-endif
-
###############################################################################
# NLS
###############################################################################
--- a/packaging/debian/control Thu Sep 03 20:11:57 2020 -0500
+++ b/packaging/debian/control Sat Sep 05 23:29:15 2020 -0500
@@ -3,8 +3,9 @@
Priority: optional
Maintainer: Gary Kramlich <grim@reaperworld.com>
Build-Depends: debhelper-compat (=12),
- meson, libglib2.0-dev, libgtk-3-dev,
- gettext, help2man, xvfb,
+ meson, libglib2.0-dev,
+ libgtk-3-dev, libgtk-3-bin,
+ gettext, help2man,
gobject-introspection,
libgspell-1-dev, libgladeui-dev,
libgumbo-dev, libcmark-dev,
--- a/talkatu/tests/meson.build Thu Sep 03 20:11:57 2020 -0500
+++ b/talkatu/tests/meson.build Sat Sep 05 23:29:15 2020 -0500
@@ -21,6 +21,6 @@
'talkatutesthtmlparser.c',
dependencies : [talkatu_dep, GLIB]
)
-test('html-parser', e)
+test('html-parser', TEST_WRAPPER, args : e, is_parallel : false)
endif
--- a/talkatu/tests/test-wrapper.py Thu Sep 03 20:11:57 2020 -0500
+++ b/talkatu/tests/test-wrapper.py Sat Sep 05 23:29:15 2020 -0500
@@ -20,29 +20,25 @@
wrapping it with xvfb-run if necessary.
"""
+import os
import subprocess
import sys
-def need_xvfb():
- needed = ['linux', 'freebsd']
-
- for need in needed:
- if sys.platform.startswith(need):
- return True
-
- return False
-
def main():
- platform = sys.platform
+ # start broadway
+ broadwayd = subprocess.Popen(['broadwayd'])
- cmd = sys.argv[1:]
+ # run the unit test but set the GDK_BACKEND envvar to broadway
+ env = {**os.environ, 'GDK_BACKEND': 'broadway'}
- if need_xvfb():
- cmd = ['xvfb-run', '-a'] + cmd
+ try:
+ proc = subprocess.run(args=sys.argv[1:], env=env)
+ finally:
+ # kill broadway
+ broadwayd.kill()
- proc = subprocess.run(args=cmd)
-
+ # return the exit code of the unit test
sys.exit(proc.returncode)