2021-07-11 07:30:21 +03:00
|
|
|
|
if(WIN32)
|
|
|
|
|
set(EXEEXT .exe)
|
|
|
|
|
endif()
|
|
|
|
|
|
2019-04-08 07:36:05 +03:00
|
|
|
|
if(NOT UNIX)
|
2022-01-10 21:35:39 +03:00
|
|
|
|
find_program(BUSYBOX_EXE busybox)
|
|
|
|
|
if(NOT BUSYBOX_EXE)
|
|
|
|
|
message(STATUS "Could NOT find busybox, only basic tests are enabled")
|
|
|
|
|
add_test(NAME libFLAC
|
|
|
|
|
COMMAND $<TARGET_FILE:test_libFLAC>
|
2021-12-01 02:24:47 +03:00
|
|
|
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
|
2022-01-10 21:35:39 +03:00
|
|
|
|
if(BUILD_CXXLIBS)
|
|
|
|
|
add_test(NAME libFLAC++
|
|
|
|
|
COMMAND $<TARGET_FILE:test_libFLAC++>
|
|
|
|
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
|
|
|
|
|
endif()
|
|
|
|
|
if(BUILD_PROGRAMS)
|
|
|
|
|
add_test(NAME flac_help
|
|
|
|
|
COMMAND $<TARGET_FILE:flacapp> --help
|
|
|
|
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
|
2022-05-12 23:21:39 +03:00
|
|
|
|
add_test(NAME flac_utf8_test COMMAND $<TARGET_FILE:flacapp> -t
|
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/flac-to-flac-metadata-test-files/שלום.flac"
|
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/flac-to-flac-metadata-test-files/Prøve.flac"
|
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/flac-to-flac-metadata-test-files/🤔.flac")
|
2022-01-10 21:35:39 +03:00
|
|
|
|
add_test(NAME metaflac_help
|
|
|
|
|
COMMAND $<TARGET_FILE:metaflac> --help
|
|
|
|
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
|
|
|
|
|
endif()
|
|
|
|
|
return()
|
|
|
|
|
else()
|
|
|
|
|
set(BUSYBOX_CMD "sh")
|
2021-12-01 02:24:47 +03:00
|
|
|
|
endif()
|
2019-04-08 07:36:05 +03:00
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
set(top_srcdir "${PROJECT_SOURCE_DIR}")
|
|
|
|
|
set(top_builddir "${PROJECT_BINARY_DIR}")
|
2022-04-20 22:47:07 +03:00
|
|
|
|
if(NOT GIT_COMMIT_TAG AND GIT_COMMIT_HASH AND GIT_COMMIT_DATE)
|
|
|
|
|
set(GIT_COMMIT_VERSION_HASH yes)
|
|
|
|
|
endif()
|
|
|
|
|
|
2019-04-08 07:36:05 +03:00
|
|
|
|
configure_file(common.sh.in common.sh @ONLY)
|
|
|
|
|
|
2022-05-12 23:21:39 +03:00
|
|
|
|
set(ALL_TESTS libFLAC grabbag)
|
2019-05-31 09:25:21 +03:00
|
|
|
|
|
2019-04-08 07:36:05 +03:00
|
|
|
|
add_test(NAME libFLAC
|
2022-01-10 21:35:39 +03:00
|
|
|
|
COMMAND ${BUSYBOX_EXE} ${BUSYBOX_CMD} "${CMAKE_CURRENT_SOURCE_DIR}/test_libFLAC.sh"
|
2019-04-08 07:36:05 +03:00
|
|
|
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
|
|
|
|
if(BUILD_CXXLIBS)
|
|
|
|
|
add_test(NAME libFLAC++
|
2022-01-10 21:35:39 +03:00
|
|
|
|
COMMAND ${BUSYBOX_EXE} ${BUSYBOX_CMD} "${CMAKE_CURRENT_SOURCE_DIR}/test_libFLAC++.sh"
|
2019-04-08 07:36:05 +03:00
|
|
|
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
2019-05-31 09:25:21 +03:00
|
|
|
|
list(APPEND ALL_TESTS libFLAC++)
|
2019-04-08 07:36:05 +03:00
|
|
|
|
endif()
|
|
|
|
|
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/cuesheets")
|
|
|
|
|
add_test(NAME grabbag
|
2022-01-10 21:35:39 +03:00
|
|
|
|
COMMAND ${BUSYBOX_EXE} ${BUSYBOX_CMD} "${CMAKE_CURRENT_SOURCE_DIR}/test_grabbag.sh"
|
2019-04-08 07:36:05 +03:00
|
|
|
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
2022-05-12 23:21:39 +03:00
|
|
|
|
if(BUILD_PROGRAMS)
|
|
|
|
|
add_test(NAME flac
|
|
|
|
|
COMMAND ${BUSYBOX_EXE} ${BUSYBOX_CMD} "${CMAKE_CURRENT_SOURCE_DIR}/test_flac.sh"
|
|
|
|
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
|
|
|
|
# UTF-8 must be tested separately on Windows because busybox-w32 doesn't support UTF-8
|
|
|
|
|
if(BUSYBOX_EXE)
|
|
|
|
|
add_test(NAME flac_utf8_test COMMAND $<TARGET_FILE:flacapp> -t
|
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/flac-to-flac-metadata-test-files/שלום.flac"
|
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/flac-to-flac-metadata-test-files/Prøve.flac"
|
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/flac-to-flac-metadata-test-files/🤔.flac")
|
|
|
|
|
list(APPEND ALL_TESTS flac_utf8_test)
|
|
|
|
|
endif()
|
|
|
|
|
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/metaflac-test-files")
|
|
|
|
|
add_test(NAME metaflac
|
|
|
|
|
COMMAND ${BUSYBOX_EXE} ${BUSYBOX_CMD} "${CMAKE_CURRENT_SOURCE_DIR}/test_metaflac.sh"
|
|
|
|
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
|
|
|
|
add_test(NAME replaygain
|
|
|
|
|
COMMAND ${BUSYBOX_EXE} ${BUSYBOX_CMD} "${CMAKE_CURRENT_SOURCE_DIR}/test_replaygain.sh"
|
|
|
|
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
|
|
|
|
add_test(NAME seeking
|
|
|
|
|
COMMAND ${BUSYBOX_EXE} ${BUSYBOX_CMD} "${CMAKE_CURRENT_SOURCE_DIR}/test_seeking.sh"
|
|
|
|
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
|
|
|
|
add_test(NAME streams
|
|
|
|
|
COMMAND ${BUSYBOX_EXE} ${BUSYBOX_CMD} "${CMAKE_CURRENT_SOURCE_DIR}/test_streams.sh"
|
|
|
|
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
|
|
|
|
# increase this if standard 1500 seconds are not enough
|
|
|
|
|
# set_tests_properties(streams PROPERTIES TIMEOUT 1500)
|
|
|
|
|
add_test(NAME compression
|
|
|
|
|
COMMAND ${BUSYBOX_EXE} ${BUSYBOX_CMD} "${CMAKE_CURRENT_SOURCE_DIR}/test_compression.sh"
|
|
|
|
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
|
|
|
|
list(APPEND ALL_TESTS flac metaflac replaygain seeking streams compression)
|
|
|
|
|
endif()
|
2019-04-30 12:44:15 +03:00
|
|
|
|
|
2022-05-12 23:21:39 +03:00
|
|
|
|
|
|
|
|
|
set_property(TEST ${ALL_TESTS} APPEND PROPERTY ENVIRONMENT FLAC__TEST_LEVEL=1)
|
|
|
|
|
if(BUSYBOX_EXE)
|
|
|
|
|
set_property(TEST ${ALL_TESTS} APPEND PROPERTY ENVIRONMENT ECHO_N=-n)
|
|
|
|
|
set_property(TEST ${ALL_TESTS} APPEND PROPERTY ENVIRONMENT WIN32BUSYBOX=yes)
|
|
|
|
|
else()
|
|
|
|
|
set_property(TEST ${ALL_TESTS} APPEND PROPERTY ENVIRONMENT ECHO_C=\\c)
|
|
|
|
|
endif()
|