Skip to content

Commit 83a82dd

Browse files
evpobrrillian
authored andcommitted
Add tests to CMake project
Related to #73. Signed-off-by: Ralph Giles <[email protected]>
1 parent 3c177d0 commit 83a82dd

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

.gitlab-ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ cmake:
2525
- mkdir build
2626
- cmake -S . -B build -G "Ninja" -DCMAKE_BUILD_TYPE=Release
2727
- cmake --build build
28+
- cd build
29+
- ctest

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ project(vorbis)
44
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
55

66
# Required modules
7+
include(CTest)
78
include(GNUInstallDirs)
89
include(CheckIncludeFiles)
910
include(CheckLibraryExists)
@@ -71,6 +72,10 @@ endif()
7172

7273
add_subdirectory(lib)
7374

75+
if(BUILD_TESTING)
76+
add_subdirectory(test)
77+
endif()
78+
7479
configure_pkg_config_file(vorbis.pc.in)
7580
configure_pkg_config_file(vorbisenc.pc.in)
7681
configure_pkg_config_file(vorbisfile.pc.in)

test/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
add_executable(vorbis_test util.c util.h write_read.c write_read.h test.c)
2+
target_link_libraries(vorbis_test PRIVATE Vorbis::vorbisenc)
3+
add_test(NAME vorbis_test COMMAND vorbis_test)

test/Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ AM_CPPFLAGS = -I$(top_srcdir)/include @OGG_CFLAGS@
1212
test_SOURCES = util.c util.h write_read.c write_read.h test.c
1313
test_LDADD = ../lib/libvorbisenc.la ../lib/libvorbis.la @OGG_LIBS@ @VORBIS_LIBS@
1414

15+
EXTRA_DIST = CMakeLists.txt
16+
1517
debug:
1618
$(MAKE) check CFLAGS="@DEBUG@"
1719

0 commit comments

Comments
 (0)