Add integration tests for defsfont loader

Runs the new dump_sfont utility on the test soundfonts and
compares them against the stored representation. Raise an error
if there are any differences.
This commit is contained in:
Marcus Weseloh 2021-03-22 18:29:11 +01:00
parent 736caf9d21
commit cc186512ed
5 changed files with 37662 additions and 0 deletions

View file

@ -53,6 +53,24 @@ macro ( ADD_FLUID_TEST_UTIL _util )
endmacro ( ADD_FLUID_TEST_UTIL )
# This macro adds a test that writes its output to a file called
# <test>.output (in the current working dir) and then compares
# the content with the file given in _expected_output
macro ( ADD_FLUID_SF_DUMP_TEST _sfname)
set( test_args "${CMAKE_SOURCE_DIR}/sf2/${_sfname} ${_sfname}.yml" )
ADD_TEST(${_sfname}_dump_test
${CMAKE_COMMAND}
-Dtest_cmd=${CMAKE_BINARY_DIR}/test/dump_sfont
-Dtest_args=${test_args}
-Dtest_output=${_sfname}.yml
-Dexpected_output=${CMAKE_SOURCE_DIR}/sf2/${_sfname}.yml
-P ${CMAKE_SOURCE_DIR}/cmake_admin/RunOutputTest.cmake
)
endmacro ( ADD_FLUID_SF_DUMP_TEST )
macro ( ADD_FLUID_DEMO _demo )
ADD_EXECUTABLE(${_demo} ${_demo}.c )

View file

@ -0,0 +1,31 @@
if( NOT test_cmd )
message( FATAL_ERROR "test_cmd not defined" )
endif( NOT test_cmd )
if( NOT test_output )
message( FATAL_ERROR "test_output not defined" )
endif( NOT test_output )
if( NOT expected_output )
message( FATAL_ERROR "expected_output not defined" )
endif( NOT expected_output )
separate_arguments( test_args )
execute_process(
COMMAND ${test_cmd} ${test_args}
RESULT_VARIABLE test_not_successful
)
if( test_not_successful )
message( FATAL_ERROR "${test_cmd} ${test_args} returned error ${test_not_successful}!" )
endif( test_not_successful )
execute_process(
COMMAND ${CMAKE_COMMAND} -E compare_files ${expected_output} ${test_output}
RESULT_VARIABLE compare_not_successful
)
if( compare_not_successful )
message( SEND_ERROR "${test_output} does not match ${expected_output}!" )
endif( compare_not_successful )

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -32,6 +32,9 @@ ADD_FLUID_TEST(test_utf8_open)
ADD_FLUID_TEST_UTIL(dump_sfont)
ADD_FLUID_SF_DUMP_TEST(VintageDreamsWaves-v2.sf2)
if ( LIBSNDFILE_HASVORBIS )
ADD_FLUID_TEST(test_sf3_sfont_loading)
ADD_FLUID_SF_DUMP_TEST(VintageDreamsWaves-v2.sf3)
endif ( LIBSNDFILE_HASVORBIS )