/test/*.sh enabled for CTest in UNIX
authorVitaliy Kirsanov <krokoziabla@yandex-team.ru>
Mon, 8 Apr 2019 04:36:05 +0000 (07:36 +0300)
committerErik de Castro Lopo <erikd@mega-nerd.com>
Sat, 4 May 2019 01:41:48 +0000 (11:41 +1000)
CMakeLists.txt
cmake/FindOGG.cmake
src/test_libFLAC++/CMakeLists.txt
src/test_libFLAC/CMakeLists.txt
test/CMakeLists.txt [new file with mode: 0644]

index e1166db..5619005 100644 (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
index a7b2840..4b08040 100644 (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()
index a517fae..27f3cdb 100644 (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++)
index 9a4a475..5679cf2 100644 (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)
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
new file mode 100644 (file)
index 0000000..503baa2
--- /dev/null
@@ -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}")