144 lines
7.8 KiB
CMake
144 lines
7.8 KiB
CMake
|
|
# Every test runs from the source root: fixtures/project paths are source-relative.
|
||
|
|
function(xtc_test name binary)
|
||
|
|
add_test(NAME ${name} COMMAND ${binary} ${ARGN})
|
||
|
|
set_tests_properties(${name} PROPERTIES WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}")
|
||
|
|
endfunction()
|
||
|
|
function(xtc_wrap target)
|
||
|
|
foreach(symbol IN LISTS ARGN)
|
||
|
|
target_link_options(${target} PRIVATE "LINKER:--wrap=${symbol}")
|
||
|
|
endforeach()
|
||
|
|
endfunction()
|
||
|
|
if(NOT BUILD_TESTING)
|
||
|
|
return()
|
||
|
|
endif()
|
||
|
|
xtc_executable(test_offline tests/unit/test_offline.c)
|
||
|
|
xtc_test(offline test_offline)
|
||
|
|
xtc_executable(test_realtime tests/unit/test_realtime.c)
|
||
|
|
xtc_test(realtime test_realtime)
|
||
|
|
xtc_executable(test_graph_edits tests/unit/test_graph_edits.c)
|
||
|
|
xtc_test(graph-edits test_graph_edits)
|
||
|
|
xtc_executable(test_project tests/unit/test_project.c)
|
||
|
|
xtc_test(project test_project)
|
||
|
|
xtc_executable(test_audio tests/unit/test_audio.c)
|
||
|
|
xtc_test(audio test_audio)
|
||
|
|
xtc_executable(test_midi tests/unit/test_midi.c)
|
||
|
|
xtc_test(midi test_midi)
|
||
|
|
xtc_executable(test_mixer tests/unit/test_mixer.c)
|
||
|
|
xtc_test(mixer test_mixer)
|
||
|
|
xtc_executable(test_native tests/unit/test_native.c)
|
||
|
|
xtc_test(native test_native)
|
||
|
|
xtc_executable(test_performance tests/integration/test_performance.c)
|
||
|
|
xtc_test(performance test_performance)
|
||
|
|
xtc_executable(test_recovery tests/integration/test_recovery.c)
|
||
|
|
xtc_test(recovery test_recovery)
|
||
|
|
xtc_executable(test_reliability tests/integration/test_reliability.c)
|
||
|
|
xtc_wrap(test_reliability malloc calloc realloc free fopen fread fwrite read write pthread_mutex_lock pthread_cond_wait)
|
||
|
|
xtc_test(reliability test_reliability)
|
||
|
|
xtc_executable(test_quality tests/unit/test_quality.c)
|
||
|
|
xtc_test(quality test_quality)
|
||
|
|
xtc_executable(test_recording tests/integration/test_recording.c)
|
||
|
|
xtc_test(recording test_recording)
|
||
|
|
xtc_executable(test_processor tests/unit/test_processor.c examples/processors.c)
|
||
|
|
xtc_test(processor test_processor)
|
||
|
|
xtc_executable(test_plugins tests/integration/test_plugins.c)
|
||
|
|
xtc_wrap(test_plugins malloc calloc realloc free dlopen dlclose)
|
||
|
|
xtc_executable(test_control tests/unit/test_control.c)
|
||
|
|
xtc_test(control test_control)
|
||
|
|
xtc_executable(test_editing tests/unit/test_editing.c)
|
||
|
|
xtc_test(editing test_editing)
|
||
|
|
xtc_executable(test_portability tests/integration/test_portability.c)
|
||
|
|
xtc_test(portability test_portability)
|
||
|
|
xtc_executable(test_scale tests/integration/test_scale.c)
|
||
|
|
xtc_test(scale test_scale)
|
||
|
|
xtc_executable(test_composition tests/unit/test_composition.c)
|
||
|
|
xtc_test(composition test_composition)
|
||
|
|
xtc_executable(test_audio_editing tests/unit/test_audio_editing.c)
|
||
|
|
xtc_test(audio-editing test_audio_editing)
|
||
|
|
xtc_executable(test_routing tests/unit/test_routing.c)
|
||
|
|
xtc_test(routing test_routing)
|
||
|
|
xtc_executable(test_buses tests/unit/test_buses.c)
|
||
|
|
xtc_test(buses test_buses)
|
||
|
|
xtc_executable(test_parameters tests/unit/test_parameters.c)
|
||
|
|
xtc_test(parameters test_parameters)
|
||
|
|
xtc_executable(test_project_diagnostics tests/unit/test_project_diagnostics.c)
|
||
|
|
xtc_wrap(test_project_diagnostics fflush fclose fsync rename)
|
||
|
|
xtc_test(project-diagnostics test_project_diagnostics)
|
||
|
|
xtc_executable(test_soak tests/integration/test_soak.c)
|
||
|
|
xtc_test(soak test_soak)
|
||
|
|
xtc_executable(test_modern_plugins tests/integration/test_modern_plugins.c)
|
||
|
|
xtc_wrap(test_modern_plugins malloc calloc realloc free dlopen dlclose)
|
||
|
|
xtc_executable(test_instruments tests/integration/test_instruments.c)
|
||
|
|
xtc_wrap(test_instruments malloc calloc realloc free dlopen dlclose)
|
||
|
|
xtc_executable(test_settings tests/unit/test_settings.c)
|
||
|
|
xtc_test(settings test_settings)
|
||
|
|
xtc_executable(test_builtin tests/unit/test_builtin.c)
|
||
|
|
xtc_test(builtin test_builtin)
|
||
|
|
xtc_executable(test_modern_editing tests/unit/test_modern_editing.c)
|
||
|
|
xtc_test(modern-editing test_modern_editing)
|
||
|
|
xtc_executable(test_next_daw tests/unit/test_next_daw.c)
|
||
|
|
xtc_test(next-daw test_next_daw)
|
||
|
|
xtc_executable(test_sample tests/unit/test_sample.c)
|
||
|
|
xtc_test(sample test_sample)
|
||
|
|
xtc_executable(test_track_fx tests/unit/test_track_fx.c)
|
||
|
|
xtc_test(track-fx test_track_fx)
|
||
|
|
xtc_executable(test_creative tests/unit/test_creative.c)
|
||
|
|
xtc_test(creative test_creative)
|
||
|
|
xtc_executable(test_midi_file tests/unit/test_midi_file.c)
|
||
|
|
xtc_test(midi-file test_midi_file)
|
||
|
|
xtc_executable(test_plugin_module_path tests/unit/test_plugin_module_path.c)
|
||
|
|
xtc_test(plugin-module-path test_plugin_module_path)
|
||
|
|
xtc_executable(test_core tests/unit/test_core.c)
|
||
|
|
xtc_test(core test_core)
|
||
|
|
if(XTC_LADSPA_AVAILABLE)
|
||
|
|
add_library(plugin-fixture MODULE tests/plugins/fixture.c)
|
||
|
|
xtc_warnings(plugin-fixture)
|
||
|
|
set_target_properties(plugin-fixture PROPERTIES PREFIX "" SUFFIX ".so")
|
||
|
|
target_include_directories(plugin-fixture SYSTEM PRIVATE "${PROJECT_SOURCE_DIR}/third_party/clap/include" "${PROJECT_SOURCE_DIR}/third_party/vst3")
|
||
|
|
endif()
|
||
|
|
add_library(clap-fixture MODULE tests/plugins/clap_fixture.c)
|
||
|
|
xtc_warnings(clap-fixture)
|
||
|
|
set_target_properties(clap-fixture PROPERTIES PREFIX "" SUFFIX ".clap")
|
||
|
|
target_include_directories(clap-fixture SYSTEM PRIVATE "${PROJECT_SOURCE_DIR}/third_party/clap/include" "${PROJECT_SOURCE_DIR}/third_party/vst3")
|
||
|
|
add_library(vst2-fixture MODULE tests/plugins/vst2_fixture.c)
|
||
|
|
xtc_warnings(vst2-fixture)
|
||
|
|
set_target_properties(vst2-fixture PROPERTIES PREFIX "" SUFFIX ".so")
|
||
|
|
target_include_directories(vst2-fixture SYSTEM PRIVATE "${PROJECT_SOURCE_DIR}/third_party/clap/include" "${PROJECT_SOURCE_DIR}/third_party/vst3")
|
||
|
|
add_library(vst3-fixture MODULE tests/plugins/vst3_fixture.c)
|
||
|
|
xtc_warnings(vst3-fixture)
|
||
|
|
set_target_properties(vst3-fixture PROPERTIES PREFIX "" SUFFIX ".so")
|
||
|
|
target_include_directories(vst3-fixture SYSTEM PRIVATE "${PROJECT_SOURCE_DIR}/third_party/clap/include" "${PROJECT_SOURCE_DIR}/third_party/vst3")
|
||
|
|
add_library(clap-synth-fixture MODULE tests/plugins/clap_synth_fixture.c)
|
||
|
|
xtc_warnings(clap-synth-fixture)
|
||
|
|
set_target_properties(clap-synth-fixture PROPERTIES PREFIX "" SUFFIX ".clap")
|
||
|
|
target_include_directories(clap-synth-fixture SYSTEM PRIVATE "${PROJECT_SOURCE_DIR}/third_party/clap/include" "${PROJECT_SOURCE_DIR}/third_party/vst3")
|
||
|
|
add_library(vst2-synth-fixture MODULE tests/plugins/vst2_synth_fixture.c)
|
||
|
|
xtc_warnings(vst2-synth-fixture)
|
||
|
|
set_target_properties(vst2-synth-fixture PROPERTIES PREFIX "" SUFFIX ".so")
|
||
|
|
target_include_directories(vst2-synth-fixture SYSTEM PRIVATE "${PROJECT_SOURCE_DIR}/third_party/clap/include" "${PROJECT_SOURCE_DIR}/third_party/vst3")
|
||
|
|
add_library(vst3-synth-fixture MODULE tests/plugins/vst3_synth_fixture.c)
|
||
|
|
xtc_warnings(vst3-synth-fixture)
|
||
|
|
set_target_properties(vst3-synth-fixture PROPERTIES PREFIX "" SUFFIX ".so")
|
||
|
|
target_include_directories(vst3-synth-fixture SYSTEM PRIVATE "${PROJECT_SOURCE_DIR}/third_party/clap/include" "${PROJECT_SOURCE_DIR}/third_party/vst3")
|
||
|
|
if(XTC_LADSPA_AVAILABLE)
|
||
|
|
xtc_test(plugins test_plugins $<TARGET_FILE:plugin-fixture> fixture)
|
||
|
|
endif()
|
||
|
|
xtc_test(modern-plugins test_modern_plugins $<TARGET_FILE:clap-fixture> $<TARGET_FILE:vst2-fixture> $<TARGET_FILE:vst3-fixture>)
|
||
|
|
xtc_test(instruments test_instruments $<TARGET_FILE:clap-synth-fixture> $<TARGET_FILE:vst2-synth-fixture> $<TARGET_FILE:vst3-synth-fixture>)
|
||
|
|
xtc_test(startup xtc-check)
|
||
|
|
xtc_test(native-example native-gain)
|
||
|
|
add_test(NAME project-inspection COMMAND ${Python3_EXECUTABLE} "${PROJECT_SOURCE_DIR}/tests/integration/test_project_inspection.py" $<TARGET_FILE:xtc-check>)
|
||
|
|
set_tests_properties(project-inspection PROPERTIES WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}")
|
||
|
|
add_test(NAME benchmark-tools COMMAND ${Python3_EXECUTABLE} "${PROJECT_SOURCE_DIR}/tests/tools/test_benchmark.py")
|
||
|
|
set_tests_properties(benchmark-tools PROPERTIES WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}")
|
||
|
|
if(JACK_FOUND AND XTC_WITH_JACK)
|
||
|
|
xtc_executable(test_backend tests/unit/test_backend.c)
|
||
|
|
xtc_test(backend test_backend)
|
||
|
|
foreach(kind jack jack_audio jack_midi)
|
||
|
|
xtc_executable(test_${kind} tests/integration/test_${kind}.c)
|
||
|
|
if(XTC_ENABLE_LIVE_TESTS)
|
||
|
|
string(REPLACE "_" "-" name "${kind}")
|
||
|
|
xtc_test(${name} test_${kind})
|
||
|
|
set_tests_properties(${name} PROPERTIES LABELS live RUN_SERIAL TRUE)
|
||
|
|
endif()
|
||
|
|
endforeach()
|
||
|
|
endif()
|