Skip to content

tests: share one plugin source list between the native test scripts - #622

Merged
alnitak merged 1 commit into
alnitak:mainfrom
Kunstderfug:pr/test-shared-sources
Nov 28, 2026
Merged

alnitak merged 1 commit into
alnitak:mainfrom
Kunstderfug:pr/test-shared-sources

Conversation

@Kunstderfug

Copy link
Copy Markdown
Contributor

What

The native tests that link the whole plugin (bindings.cpp down to the SoLoud
engine) each carried their own copy of the plugin's source list: 17
test/common/*_test.sh scripts, test/support/plugin_build.sh,
test/support/engine_sources.sh (the macOS, Linux, iOS and Android
scripts), test/docker/windows_native.sh and Get-PluginSources in
test/support/native_build.ps1.

This PR moves the list to one file, test/support/plugin_sources.txt, and
makes all of them read it:

  • plugin_sources [apple|android|linux|windows] in engine_sources.sh
    sets PLUGIN_SOURCES, PLUGIN_INCLUDES and PLUGIN_LIBS.
    engine_sources and plugin_build now use it.
  • Each test/common script replaces its -I block, its source block and
    its PLATFORM_SOURCES/PLATFORM_LIBS block with
    "${PLUGIN_INCLUDES[@]}", "${PLUGIN_SOURCES[@]}" and
    "${PLUGIN_LIBS[@]}". The defines, the sanitizer flags, the backend
    choice and the test-only sources stay in each script as before.
  • plugin_build.sh keeps PLUGIN_BUILD_NO_COMMON=1.
  • windows_native.sh and native_build.ps1 read the windows: lines of
    the same file.
  • New: test/common/plugin_sources_test.dart compares the list with
    collectSources() in hook/build.dart for macOS, iOS, Android, Linux and
    Windows. It fails when a source the hook compiles is missing from the list.
  • test/README.md gets one paragraph saying where the list is.

Why

Adding a source file to the plugin meant editing about 20 lists, and a list
that was missed only showed up as a link error in one test, or as a test
that quietly built less than the plugin ships. Now there is one list, and a
test that catches the hook and the list drifting apart.

There is no CHANGELOG entry: the change is test-only, and the CHANGELOG
describes what users of the package see.

Testing

All on macOS (arm64), from the repository root. Every script was run on
main (9abf4b3) and then on this branch:

VST3_PREBUILD_DIR=<prebuild> ./test/common/<name>_test.sh [--asan|--tsan]
Script Before After
bindings_null_args PASS PASS
buffer_stream_format 39 assertions, 0 failures same
buffer_stream_race 40, 0 same
bus_samplerate 12, 0 same
device_coordinator 73, 0 same
device_list 13, 0 same
engine_lifecycle 222, 0 same
filter_params 77, 0 same
load_mem_ownership 46, 0 same
out_of_memory PASS PASS
play_missing_file 155, 0 same
player_concurrency PASS PASS
pull_buffer_stream 684 checks, 0 failures same
pull_mp3_seek 24, 0 same
pull_ogg_seek 94, 0 same
pull_stream_race 124, 0 same
stress_soak (plugin_build) 17 checks, 0 failed same
waveform_synth 58, 0 same
macos/coreaudio_device_change 2 checks fail the same 2 checks fail
macos/sample_rate_change SKIPPED (no BlackHole) SKIPPED
filter_params --asan 77, 0 same
device_coordinator --tsan 73, 0 same
stress_soak --asan 16 checks, 0 failed same
out_of_memory --asan PASS PASS
stress_soak --tsan not run 16 checks, 0 failed

coreaudio_device_change fails the same two checks on main on this
machine ("the engine lists it (id -2)" and "aggregate listed"). It depends
on the machine's audio devices, not on this change.

The compiler calls were recorded with the generator's fake compilers, for
every script plain, with --asan and with --tsan (775 calls before, 775
after). They are the same, except that:

  • 8 scripts that linked only AudioToolbox and CoreFoundation now also link
    Foundation, as the other scripts already did;
  • plugin_build.sh passes the same frameworks in a different order.
python3 test/support/gen_cmake.py   # test/CMakeLists.txt is unchanged
flutter test test/common/plugin_sources_test.dart   # 5 tests pass

With src/mixeroutput/*.cpp taken out of the list,
plugin_sources_test.dart fails for every platform, as it should.

gen_cmake.py needs the VST3 prebuild (or VST3_PREBUILD_DIR) to
reproduce the committed file. Without it, it drops the
vst3_param_changes_test target. That is true on main too.

Not run on this branch: Linux, the Windows scripts (windows_native.sh,
native_build.ps1), iOS and Android. The same change, with a few
additions of our own on top, does pass the Windows suite in our fork
(Windows 11, MSVC 14.50: test\windows\all.ps1, ctest 61/61,
msvc_build_test with /W3 /WX). Windows now also compiles
src/device_lifecycle_test_hooks.cpp, which is empty without
SOLOUD_LIFECYCLE_TEST_HOOKS.

Follow-ups

  • About 40 test/common scripts compile only parts of the engine (SoLoud
    core, one decoder, ...), not the whole plugin, so they keep their own
    lists. They could share smaller named lists in the same way.

🤖 Generated with Claude Code

- test/support/plugin_sources.txt lists the plugin's sources once; the
  test/common scripts, plugin_build.sh, engine_sources.sh,
  windows_native.sh and native_build.ps1 read it
- plugin_sources_test.dart fails when a source the build hook compiles is
  missing from the list
@alnitak

alnitak commented Nov 28, 2026

Copy link
Copy Markdown
Owner

This is a great cleanup, removing ~20 duplicated source lists will save a lot of maintenance headaches.

Merging now, thanks!

@alnitak
alnitak merged commit b591a78 into alnitak:main Nov 28, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants