Skip to content

Commit

Permalink
tests: Check for required WAV decoder for notification tests
Browse files Browse the repository at this point in the history
Otherwise the sound validator will reject what the tests consider a
valid sound and fail.
  • Loading branch information
swick authored and GeorgesStavracas committed Dec 11, 2024
1 parent 3377081 commit 1c6dd18
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/workflows/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ RUN apt install -y --no-install-recommends \
libgstreamer-plugins-base1.0-dev \
gstreamer1.0-plugins-good \
libgstreamer-plugins-good1.0-dev \
gstreamer1.0-tools \
libgeoclue-2-dev \
libglib2.0-dev \
libgudev-1.0-dev \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/container.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
env:
IMAGE_TAG: 20241210-1
IMAGE_TAG: 20241211-1

on:
workflow_call:
Expand Down
10 changes: 10 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,16 @@ libsystemd_dep = dependency('libsystemd', required: get_option('systemd'))
gudev_dep = dependency('gudev-1.0', required: get_option('gudev'))
umockdev_dep = dependency('umockdev-1.0', required: get_option('pytest'))

gst_inspect = find_program('gst-inspect-1.0', required: false)
if gst_inspect.found()
have_wav_parse = run_command(
gst_inspect, 'wavparse', '--exists',
check: false,
).returncode() == 0
else
have_wav_parse = false
endif

bwrap = find_program('bwrap', required: get_option('sandboxed-image-validation').allowed() or get_option('sandboxed-sound-validation').allowed())

if not bwrap.found()
Expand Down
21 changes: 15 additions & 6 deletions tests/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ if have_libportal
'email.c',
'filechooser.c',
'inhibit.c',
'notification.c',
'openuri.c',
'print.c',
'screenshot.c',
Expand All @@ -111,6 +110,12 @@ if have_libportal
)
endif

if have_wav_parse
portals_test_sources += files(
'notification.c',
)
endif

test_portals = executable(
'test-portals',
'test-portals.c',
Expand Down Expand Up @@ -277,11 +282,15 @@ python = pymod.find_installation(
required: get_option('pytest'),
)

enable_pytest = \
pytest.found() and \
python.found() and \
python.language_version().version_compare('>=3.9') and \
umockdev_dep.found()
enable_pytest = get_option('pytest') \
.require(pytest.found()) \
.require(python.found()) \
.require(python.language_version().version_compare('>=3.9'),
error_message: 'Python version >=3.9 is required') \
.require(umockdev_dep.found()) \
.require(have_wav_parse,
error_message: 'gst-inspect and the wavparse plugins are required') \
.allowed()

if enable_pytest
subdir('templates')
Expand Down

0 comments on commit 1c6dd18

Please sign in to comment.