/test/*.sh enabled for CTest in UNIX

This commit is contained in:
Vitaliy Kirsanov 2019-04-08 07:36:05 +03:00 committed by Erik de Castro Lopo
parent 6cd2b6cded
commit 5435f15be4
5 changed files with 60 additions and 18 deletions

View File

@ -101,13 +101,9 @@ add_subdirectory("microbench")
if(BUILD_EXAMPLES)
add_subdirectory("examples")
endif()
if(WIN32)
set(EXEEXT .exe)
if(BUILD_TESTING)
add_subdirectory("test")
endif()
set(top_srcdir "${CMAKE_CURRENT_SOURCE_DIR}")
set(top_builddir "${CMAKE_CURRENT_BINARY_DIR}")
configure_file(test/common.sh.in test/common.sh @ONLY)
install(
EXPORT targets

View File

@ -1,34 +1,39 @@
find_package(PkgConfig)
pkg_check_modules(_OGG QUIET ogg)
find_path(_OGG_INCLUDE_DIR
find_path(OGG_INCLUDE_DIR
NAMES "ogg/ogg.h"
PATHS ${_OGG_INCLUDE_DIRS})
find_library(_OGG_LIBRARY
find_library(OGG_LIBRARY
NAMES ogg libogg
HINTS ${_OGG_LIBRARY_DIRS})
find_library(_OGG_LIBRARY_STATIC
find_library(OGG_LIBRARY_STATIC
NAMES libogg.a libogg_static
HINTS ${_OGG_LIBRARY_DIRS})
mark_as_advanced(
OGG_INCLUDE_DIR
OGG_LIBRARY
OGG_LIBRARY_DIRS)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OGG
REQUIRED_VARS _OGG_INCLUDE_DIR _OGG_LIBRARY
REQUIRED_VARS OGG_INCLUDE_DIR OGG_LIBRARY
VERSION_VAR _OGG_VERSION)
if(OGG_FOUND)
if(NOT Ogg::Ogg)
add_library(Ogg::Ogg UNKNOWN IMPORTED)
set_target_properties(Ogg::Ogg PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_OGG_INCLUDE_DIR}"
IMPORTED_LOCATION "${_OGG_LIBRARY}")
INTERFACE_INCLUDE_DIRECTORIES "${OGG_INCLUDE_DIR}"
IMPORTED_LOCATION "${OGG_LIBRARY}")
endif()
if(NOT Ogg::Ogg-static AND _OGG_LIBRARY_STATIC)
add_library(Ogg::Ogg-static STATIC IMPORTED)
set_target_properties(Ogg::Ogg-static PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_OGG_INCLUDE_DIR}"
IMPORTED_LOCATION "${_OGG_LIBRARY_STATIC}")
INTERFACE_INCLUDE_DIRECTORIES "${OGG_INCLUDE_DIR}"
IMPORTED_LOCATION "${OGG_LIBRARY_STATIC}")
endif()
endif()

View File

@ -6,5 +6,3 @@ add_executable(test_libFLAC++
metadata_manip.cpp
metadata_object.cpp)
target_link_libraries(test_libFLAC++ FLACXX-static test_libs_common grabbag)
add_test(NAME FLACXX COMMAND test_libFLAC++)

View File

@ -16,5 +16,3 @@ target_compile_definitions(test_libFLAC PRIVATE
$<$<BOOL:${ENABLE_64_BIT_WORDS}>:ENABLE_64_BIT_WORDS>)
target_include_directories(test_libFLAC PRIVATE "$<TARGET_PROPERTY:FLAC-static,SOURCE_DIR>/include")
target_link_libraries(test_libFLAC FLAC-static grabbag test_libs_common)
add_test(NAME FLAC COMMAND test_libFLAC)

45
test/CMakeLists.txt Normal file
View File

@ -0,0 +1,45 @@
if(NOT UNIX)
return()
endif()
if(WIN32)
set(EXEEXT .exe)
endif()
set(top_srcdir "${PROJECT_SOURCE_DIR}")
set(top_builddir "${PROJECT_BINARY_DIR}")
configure_file(common.sh.in common.sh @ONLY)
add_test(NAME libFLAC
COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/test_libFLAC.sh"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
if(BUILD_CXXLIBS)
add_test(NAME libFLAC++
COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/test_libFLAC++.sh"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
endif()
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/cuesheets")
add_test(NAME grabbag
COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/test_grabbag.sh"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
add_test(NAME flac
COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/test_flac.sh"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/metaflac-test-files")
add_test(NAME metaflac
COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/test_metaflac.sh"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
add_test(NAME replaygain
COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/test_replaygain.sh"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
add_test(NAME seeking
COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/test_seeking.sh"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
add_test(NAME streams
COMMAND "${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 "${CMAKE_CURRENT_SOURCE_DIR}/test_compression.sh"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")