pipewire/spa/tests/meson.build
Wim Taymans 552eb1e618 ump-utils: fix sysex encoding and add F7 continuation support
Fix spa_ump_from_midi() to correctly encode short sysex messages as
Complete (0x0) instead of Start (0x1) when the entire message fits in
one UMP packet. Handle bare F7 termination when no data bytes follow.
Support 0xF7 as a sysex continuation marker and optional trailing 0xF0
as a continuation boundary.

Add unit tests for UMP/MIDI conversion covering note on, program change,
sysex complete/multi-packet/continue, system realtime, F7 continuation,
bare F7 end/complete/orphan, and trailing F0 scenarios.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-22 17:00:09 +02:00

94 lines
2.9 KiB
Meson

# Generate a compilation test for each SPA header, excluding the type-info.h
# ones which have circular dependencies and take some effort to fix.
# Do it for C++ if possible (picks up C++-specific errors), otherwise for C.
find = find_program('find', required: false)
summary({'find (for header testing)': find.found()}, bool_yn: true, section: 'Optional programs')
if find.found()
spa_headers = run_command(find,
meson.project_source_root() / 'spa' / 'include',
'-name', '*.h',
'-not', '-name', 'type-info.h',
'-type', 'f',
'-printf', '%P\n',
check: false)
foreach spa_header : spa_headers.stdout().split('\n')
if spa_header.endswith('.h') # skip empty lines
ext = have_cpp ? 'cpp' : 'c'
src = configure_file(input: 'spa-include-test-template.c',
output: 'spa-include-test-@0@.@1@'.format(spa_header.underscorify(), ext),
configuration: {
'INCLUDE': spa_header,
})
executable('spa-include-test-@0@'.format(spa_header.underscorify()),
src,
dependencies: [ spa_dep ],
install: false)
endif
endforeach
endif
test_apps = [
['test-ump-utils', []],
]
foreach a : test_apps
test('spa-' + a[0],
executable('spa-' + a[0], a[0] + '.c',
dependencies : [ spa_dep ],
include_directories : [configinc],
install : installed_tests_enabled,
install_dir : installed_tests_execdir,
),
env : [
'SPA_PLUGIN_DIR=@0@'.format(spa_dep.get_variable('plugindir')),
]
)
if installed_tests_enabled
test_conf = configuration_data()
test_conf.set('exec', installed_tests_execdir / 'spa-' + a[0])
configure_file(
input: installed_tests_template,
output: 'spa-' + a[0] + '.test',
install_dir: installed_tests_metadir,
configuration: test_conf,
)
endif
endforeach
benchmark_apps = [
['stress-ringbuffer', []],
['benchmark-pod', []],
['benchmark-dict', []],
]
if sndfile_dep.found()
benchmark_apps += [
['benchmark-aec', [sndfile_dep]]
]
endif
foreach a : benchmark_apps
benchmark('spa-' + a[0],
executable('spa-' + a[0], a[0] + '.c',
dependencies : [ spa_dep, dl_lib, pthread_lib, mathlib ] + a[1],
include_directories : [configinc],
install : installed_tests_enabled,
install_dir : installed_tests_execdir,
),
env : [
'SPA_PLUGIN_DIR=@0@'.format(spa_dep.get_variable('plugindir')),
]
)
if installed_tests_enabled
test_conf = configuration_data()
test_conf.set('exec', installed_tests_execdir / 'spa-' + a[0])
configure_file(
input: installed_tests_template,
output: 'spa-' + a[0] + '.test',
install_dir: installed_tests_metadir,
configuration: test_conf,
)
endif
endforeach