| 1 |
include(CTest) |
| 2 |
|
| 3 |
list(APPEND _binary_tests) |
| 4 |
|
| 5 |
macro(compiled_test _test_name) |
| 6 |
add_executable(test_${_test_name} |
| 7 |
$<TARGET_OBJECTS:espeak-ng> |
| 8 |
${_test_name}.c |
| 9 |
) |
| 10 |
target_link_libraries(test_${_test_name} PRIVATE |
| 11 |
$<TARGET_PROPERTY:espeak-ng,LINK_LIBRARIES> |
| 12 |
) |
| 13 |
target_compile_definitions(test_${_test_name} PRIVATE LIBESPEAK_NG_EXPORT=1) |
| 14 |
target_include_directories( |
| 15 |
test_${_test_name} PRIVATE |
| 16 |
$<TARGET_PROPERTY:espeak-ng,SOURCE_DIR> |
| 17 |
$<TARGET_PROPERTY:espeak-ng,SOURCE_DIR>/include/compat |
| 18 |
$<TARGET_PROPERTY:espeak-ng,INTERFACE_INCLUDE_DIRECTORIES> |
| 19 |
$<TARGET_PROPERTY:espeak-ng-config,INTERFACE_INCLUDE_DIRECTORIES> |
| 20 |
) |
| 21 |
if (MINGW) |
| 22 |
target_link_options(test_${_test_name} PUBLIC "-static" "-static-libstdc++") |
| 23 |
endif() |
| 24 |
add_dependencies(test_${_test_name} data) |
| 25 |
add_test( |
| 26 |
NAME ${_test_name} |
| 27 |
COMMAND ${ESPEAK_RUN_ENV} $<TARGET_FILE:test_${_test_name}> |
| 28 |
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/.. |
| 29 |
) |
| 30 |
list(APPEND _binary_tests test_${_test_name}) |
| 31 |
endmacro(compiled_test) |
| 32 |
|
| 33 |
find_program(SHELL bash) |
| 34 |
|
| 35 |
macro(shell_test _test_name) |
| 36 |
add_test( |
| 37 |
NAME ${_test_name} |
| 38 |
COMMAND ${ESPEAK_RUN_ENV} ESPEAK_BIN=$<TARGET_FILE:espeak-ng-bin> ${SHELL} ${CMAKE_CURRENT_SOURCE_DIR}/${_test_name}.test |
| 39 |
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/.. |
| 40 |
) |
| 41 |
endmacro(shell_test) |
| 42 |
|
| 43 |
compiled_test(api) |
| 44 |
compiled_test(encoding) |
| 45 |
compiled_test(ieee80) |
| 46 |
compiled_test(readclause) |
| 47 |
|
| 48 |
if (SHELL AND UNIX) |
| 49 |
|
| 50 |
shell_test(bom) |
| 51 |
shell_test(non-executable-files-with-executable-bit) |
| 52 |
|
| 53 |
shell_test(cmd_options) |
| 54 |
shell_test(dictionary) |
| 55 |
shell_test(language-numbers-cardinal) |
| 56 |
shell_test(language-numbers-ordinal) |
| 57 |
shell_test(language-phonemes) |
| 58 |
shell_test(language-pronunciation) |
| 59 |
shell_test(language-replace) |
| 60 |
shell_test(ssml) |
| 61 |
shell_test(translate) |
| 62 |
shell_test(variants) |
| 63 |
shell_test(voices) |
| 64 |
shell_test(crash) |
| 65 |
|
| 66 |
# shell_test(windows-data) |
| 67 |
# shell_test(windows-installer) |
| 68 |
|
| 69 |
if (USE_KLATT) |
| 70 |
shell_test(klatt) |
| 71 |
endif() |
| 72 |
if (USE_MBROLA) |
| 73 |
shell_test(mbrola) |
| 74 |
endif() |
| 75 |
|
| 76 |
endif() |
| 77 |
|
| 78 |
add_custom_target(tests DEPENDS ${_binary_tests}) |