diff --git a/.github/workflows/build-macos-latest.yml b/.github/workflows/build-macos-latest.yml index 485cdb8..9b83801 100644 --- a/.github/workflows/build-macos-latest.yml +++ b/.github/workflows/build-macos-latest.yml @@ -42,17 +42,17 @@ jobs: # Note the current convention is to use the -S and -B options here to specify source # and build directories, but this is only available with CMake 3.13 and higher. # The CMake binaries on the Github Actions machines are (as of this writing) 3.12 - run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE + run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DENABLE_TESTS=1 - name: Build working-directory: ${{github.workspace}}/build shell: bash # Execute the build. You can specify a specific target with "--target " - run: cmake --build . --config $BUILD_TYPE + run: cmake --build . --config $BUILD_TYPE -j 16 - name: Test working-directory: ${{github.workspace}}/build shell: bash # Execute tests defined by the CMake configuration. # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail - run: ctest -C $BUILD_TYPE + run: ctest -C $BUILD_TYPE -j 16 --output-on-failure diff --git a/.github/workflows/build-ubuntu-latest.yml b/.github/workflows/build-ubuntu-latest.yml index e34e6cc..ef35b91 100644 --- a/.github/workflows/build-ubuntu-latest.yml +++ b/.github/workflows/build-ubuntu-latest.yml @@ -42,17 +42,17 @@ jobs: # Note the current convention is to use the -S and -B options here to specify source # and build directories, but this is only available with CMake 3.13 and higher. # The CMake binaries on the Github Actions machines are (as of this writing) 3.12 - run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE + run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DENABLE_TESTS=1 - name: Build working-directory: ${{github.workspace}}/build shell: bash # Execute the build. You can specify a specific target with "--target " - run: cmake --build . --config $BUILD_TYPE + run: cmake --build . --config $BUILD_TYPE -j 16 - name: Test working-directory: ${{github.workspace}}/build shell: bash # Execute tests defined by the CMake configuration. # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail - run: ctest -C $BUILD_TYPE + run: ctest -C $BUILD_TYPE -j 16 --output-on-failure diff --git a/CMakeLists.txt b/CMakeLists.txt index 80d93e5..173f226 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ # ############################# INITIAL SECTION ########################## -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.20) project(ssdpd C) @@ -21,7 +21,13 @@ set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}") ############################# OPTIONS SECTION ########################## -option(INSTALL_PHP_MEDIA_SERVER "Install PHP UPnP/DLNA Media server [default: ON]" OFF) +option(INSTALL_PHP_MEDIA_SERVER "Install PHP UPnP/DLNA Media server [default: OFF]" OFF) +option(ENABLE_TESTS "Enable tests [default: OFF]" OFF) +if (ENABLE_TESTS) + # Enable testing functionality. + enable_testing() + set(ENABLE_LIBLCB_TESTS TRUE) +endif() # Now CMAKE_INSTALL_PREFIX is a base prefix for everything. if (NOT CONFDIR) @@ -241,6 +247,10 @@ add_definitions(-DSOCKET_XML_CONFIG) include(src/liblcb/CMakeLists.txt) add_subdirectory(src) +if (ENABLE_TESTS) + #add_subdirectory(tests) +endif() + ############################ TARGETS SECTION ########################### add_custom_target(dist ${CMAKE_CURRENT_SOURCE_DIR}/dist.sh diff --git a/readme.md b/readme.md index 9643a4d..1b944bb 100644 --- a/readme.md +++ b/readme.md @@ -48,6 +48,15 @@ UPnP/DLNA PHP server requires 2. PHP with fpm, fileinfo, soap, xml. +## Run tests +``` +mkdir -p build +cd build +cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_TESTS=1 .. +cmake --build . --config Release -j 16 +ctest -C Release --output-on-failure -j 16 +``` + ## Usage ``` ssdpd [-d] [-v] [-c file] diff --git a/src/liblcb b/src/liblcb index a9d53c0..4db42f6 160000 --- a/src/liblcb +++ b/src/liblcb @@ -1 +1 @@ -Subproject commit a9d53c0401af5c28d64a67fd327f4ce27f379e2d +Subproject commit 4db42f6a957e9b96595268c381e8a3930aea2cff