From 5435f15be46289770a833dba6cc19e035faecf47 Mon Sep 17 00:00:00 2001 From: Vitaliy Kirsanov Date: Mon, 8 Apr 2019 07:36:05 +0300 Subject: [PATCH] /test/*.sh enabled for CTest in UNIX --- CMakeLists.txt | 8 ++---- cmake/FindOGG.cmake | 21 +++++++++------ src/test_libFLAC++/CMakeLists.txt | 2 -- src/test_libFLAC/CMakeLists.txt | 2 -- test/CMakeLists.txt | 45 +++++++++++++++++++++++++++++++ 5 files changed, 60 insertions(+), 18 deletions(-) create mode 100644 test/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index e1166db5..56190050 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/cmake/FindOGG.cmake b/cmake/FindOGG.cmake index a7b2840f..4b08040d 100644 --- a/cmake/FindOGG.cmake +++ b/cmake/FindOGG.cmake @@ -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() diff --git a/src/test_libFLAC++/CMakeLists.txt b/src/test_libFLAC++/CMakeLists.txt index a517faed..27f3cdb7 100644 --- a/src/test_libFLAC++/CMakeLists.txt +++ b/src/test_libFLAC++/CMakeLists.txt @@ -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++) diff --git a/src/test_libFLAC/CMakeLists.txt b/src/test_libFLAC/CMakeLists.txt index 9a4a475b..5679cf25 100644 --- a/src/test_libFLAC/CMakeLists.txt +++ b/src/test_libFLAC/CMakeLists.txt @@ -16,5 +16,3 @@ target_compile_definitions(test_libFLAC PRIVATE $<$:ENABLE_64_BIT_WORDS>) target_include_directories(test_libFLAC PRIVATE "$/include") target_link_libraries(test_libFLAC FLAC-static grabbag test_libs_common) - -add_test(NAME FLAC COMMAND test_libFLAC) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 00000000..503baa2c --- /dev/null +++ b/test/CMakeLists.txt @@ -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}")