tests: Skip some tests if we don't have Xvfb or setxkbmap

The keyboard test relies on both of those programs, the network
panel test on Xvfb. Where we don't have those programs installed (e.g. a
pure Wayland session) we cannot run the test.
This commit is contained in:
Peter Hutterer 2024-06-14 13:56:55 +10:00 committed by Felipe Borges
parent 657ef02f1d
commit 541d72e915
3 changed files with 51 additions and 46 deletions

View file

@ -1,35 +1,35 @@
find_program('setxkbmap')
if setxkbmap.found() and Xvfb.found()
test_units = [
'test-keyboard-shortcuts'
]
test_units = [
'test-keyboard-shortcuts'
]
env = [
'G_MESSAGES_DEBUG=all',
'BUILDDIR=' + meson.current_build_dir(),
'TOP_BUILDDIR=' + meson.project_build_root(),
# Disable ATK, this should not be required but it caused CI failures -- 2018-12-07
'NO_AT_BRIDGE=1'
]
cflags = [
'-DTEST_SRCDIR="@0@"'.format(meson.current_source_dir())
]
includes = [top_inc, include_directories('../../panels/keyboard')]
env = [
'G_MESSAGES_DEBUG=all',
'BUILDDIR=' + meson.current_build_dir(),
'TOP_BUILDDIR=' + meson.project_build_root(),
# Disable ATK, this should not be required but it caused CI failures -- 2018-12-07
'NO_AT_BRIDGE=1'
]
cflags = [
'-DTEST_SRCDIR="@0@"'.format(meson.current_source_dir())
]
includes = [top_inc, include_directories('../../panels/keyboard')]
foreach unit: test_units
exe = executable(
unit,
[unit + '.c'],
dependencies : common_deps,
include_directories : includes,
link_with : [keyboard_panel_lib],
c_args : cflags
)
endforeach
foreach unit: test_units
exe = executable(
unit,
[unit + '.c'],
dependencies : common_deps,
include_directories : includes,
link_with : [keyboard_panel_lib],
c_args : cflags
test(
'test-keyboard',
find_program('test-keyboard.py'),
env : env,
timeout : 60
)
endforeach
test(
'test-keyboard',
find_program('test-keyboard.py'),
env : env,
timeout : 60
)
endif

View file

@ -1,3 +1,6 @@
setxkbmap = find_program('setxkbmap', required: false)
Xvfb = find_program('Xvfb', required: false)
subdir('common')
#subdir('datetime')
if host_is_linux

View file

@ -8,15 +8,6 @@ cflags = [
'-DTEST_NM_SERVICE="@0@"'.format(join_paths(meson.project_source_root(), 'tests', 'network', 'nm-utils', 'test-networkmanager-service.py')),
]
exe = executable(
'test-network-panel',
['test-network-panel.c', 'cc-test-window.c', 'nm-utils/nm-test-utils-impl.c'],
include_directories : includes + [common_inc],
dependencies : common_deps + network_manager_deps + [libtestshell_dep],
link_with : [network_panel_lib],
c_args : cflags
)
envs = [
'G_MESSAGES_DEBUG=all',
'BUILDDIR=' + meson.current_build_dir(),
@ -26,12 +17,23 @@ envs = [
'GTK_A11Y=none',
]
test(
'test-network-panel',
find_program('test-network-panel.py'),
env : envs,
timeout : 60
)
if Xvfb.found()
exe = executable(
'test-network-panel',
['test-network-panel.c', 'cc-test-window.c', 'nm-utils/nm-test-utils-impl.c'],
include_directories : includes + [common_inc],
dependencies : common_deps + network_manager_deps + [libtestshell_dep],
link_with : [network_panel_lib],
c_args : cflags
)
test(
'test-network-panel',
find_program('test-network-panel.py'),
env : envs,
timeout : 60
)
endif
exe = executable(
'test-wifi-panel-text',