diff options
author | evpobr <evpobr@gmail.com> | 2020-11-06 11:38:42 +0500 |
---|---|---|
committer | Ralph Giles <giles@thaumas.net> | 2020-11-06 09:06:28 -0800 |
commit | 83a82dd9296400d811b78c06e9ca429e24dd1e5c (patch) | |
tree | 3e5d19793e2078f5c9d9530d20f99514eb8f2799 | |
parent | 3c177d011684fce294edce5ea93f27d3453e6830 (diff) | |
download | libvorbis-git-83a82dd9296400d811b78c06e9ca429e24dd1e5c.tar.gz |
Add tests to CMake project
Related to https://github.com/xiph/vorbis/issues/73.
Signed-off-by: Ralph Giles <giles@thaumas.net>
-rw-r--r-- | .gitlab-ci.yml | 2 | ||||
-rw-r--r-- | CMakeLists.txt | 5 | ||||
-rw-r--r-- | test/CMakeLists.txt | 3 | ||||
-rw-r--r-- | test/Makefile.am | 2 |
4 files changed, 12 insertions, 0 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e438d972..8b117e1d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -25,3 +25,5 @@ cmake: - mkdir build - cmake -S . -B build -G "Ninja" -DCMAKE_BUILD_TYPE=Release - cmake --build build + - cd build + - ctest diff --git a/CMakeLists.txt b/CMakeLists.txt index c42f6a5b..197dfc23 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,7 @@ project(vorbis) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") # Required modules +include(CTest) include(GNUInstallDirs) include(CheckIncludeFiles) include(CheckLibraryExists) @@ -71,6 +72,10 @@ endif() add_subdirectory(lib) +if(BUILD_TESTING) + add_subdirectory(test) +endif() + configure_pkg_config_file(vorbis.pc.in) configure_pkg_config_file(vorbisenc.pc.in) configure_pkg_config_file(vorbisfile.pc.in) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 00000000..8cc5abe8 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,3 @@ +add_executable(vorbis_test util.c util.h write_read.c write_read.h test.c) +target_link_libraries(vorbis_test PRIVATE Vorbis::vorbisenc) +add_test(NAME vorbis_test COMMAND vorbis_test) diff --git a/test/Makefile.am b/test/Makefile.am index b68ebdb1..a9207794 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -12,6 +12,8 @@ AM_CPPFLAGS = -I$(top_srcdir)/include @OGG_CFLAGS@ test_SOURCES = util.c util.h write_read.c write_read.h test.c test_LDADD = ../lib/libvorbisenc.la ../lib/libvorbis.la @OGG_LIBS@ @VORBIS_LIBS@ +EXTRA_DIST = CMakeLists.txt + debug: $(MAKE) check CFLAGS="@DEBUG@" |