From 2464270fcdfe844d967e2ae1eb3bacf00de8cf5c Mon Sep 17 00:00:00 2001 From: Enrico Seiler Date: Mon, 11 Mar 2024 12:06:31 +0100 Subject: [PATCH] [INFRA] Simplify --- .github/workflows/ci_coverage.yml | 14 ++-- .github/workflows/ci_license.yml | 2 +- .github/workflows/ci_linux.yml | 2 +- .github/workflows/ci_macos.yml | 2 +- CMakeLists.txt | 50 +++++------ cmake/CPMGetSystemPackage.cmake | 30 ------- {test/cmake => cmake}/app_datasources.cmake | 0 cmake/test_config.cmake | 63 ++++++++++++++ src/CMakeLists.txt | 21 ----- test/CMakeLists.txt | 83 ++----------------- test/api/CMakeLists.txt | 9 -- test/api/README.md | 12 --- ..._test.cpp => api_fastq_coversion_test.cpp} | 5 +- test/cli/CMakeLists.txt | 9 -- test/cli/README.md | 24 ------ ..._test.cpp => cli_fastq_coversion_test.cpp} | 2 +- test/coverage/CMakeLists.txt | 28 ------- test/coverage/README.md | 15 ---- test/data/datasources.cmake | 2 +- test/header/CMakeLists.txt | 56 ------------- 20 files changed, 103 insertions(+), 326 deletions(-) delete mode 100644 cmake/CPMGetSystemPackage.cmake rename {test/cmake => cmake}/app_datasources.cmake (100%) create mode 100644 cmake/test_config.cmake delete mode 100644 src/CMakeLists.txt delete mode 100644 test/api/CMakeLists.txt delete mode 100644 test/api/README.md rename test/{api/convert_fastq_test.cpp => api_fastq_coversion_test.cpp} (95%) delete mode 100644 test/cli/CMakeLists.txt delete mode 100644 test/cli/README.md rename test/{cli/fastq_to_fasta_options_test.cpp => cli_fastq_coversion_test.cpp} (99%) delete mode 100644 test/coverage/CMakeLists.txt delete mode 100644 test/coverage/README.md delete mode 100644 test/header/CMakeLists.txt diff --git a/.github/workflows/ci_coverage.yml b/.github/workflows/ci_coverage.yml index cd123d1..cc101c4 100644 --- a/.github/workflows/ci_coverage.yml +++ b/.github/workflows/ci_coverage.yml @@ -32,8 +32,6 @@ jobs: include: - name: "gcc13" compiler: "gcc-13" - build: coverage - build_type: Coverage steps: # How many commits do we need to fetch to also fetch the branch point? @@ -56,7 +54,7 @@ jobs: - name: Install CMake uses: seqan/actions/setup-cmake@main with: - cmake: 3.21.7 + cmake: 3.25.3 - name: Install gcovr run: | @@ -67,12 +65,14 @@ jobs: run: | mkdir build cd build - cmake .. -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + cmake .. -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_CXX_FLAGS="--coverage -fprofile-arcs -ftest-coverage" \ + -DCMAKE_C_FLAGS="--coverage -fprofile-arcs -ftest-coverage" \ + -DCMAKE_EXE_LINKER_FLAGS="-Wl,-lgcov" \ + -DCMAKE_SHARED_LINKER_FLAGS="-Wl,-lgcov" make -j2 -k gtest_main yaml-cpp - name: Build tests - env: - CCACHE_IGNOREOPTIONS: "-fprofile-abs-path" run: | ccache -z cd build @@ -82,7 +82,7 @@ jobs: - name: Generate coverage report run: | gcovr --gcov-executable ${{ github.workspace }}/.github/workflows/scripts/gcov.sh \ - --root ${{ github.workspace }}/test/coverage \ + --root ${{ github.workspace }}/test \ ${{ github.workspace }}/build \ --filter ${{ github.workspace }}/include \ --filter ${{ github.workspace }}/src \ diff --git a/.github/workflows/ci_license.yml b/.github/workflows/ci_license.yml index b1ed92d..b0970b9 100644 --- a/.github/workflows/ci_license.yml +++ b/.github/workflows/ci_license.yml @@ -20,7 +20,7 @@ jobs: check: name: REUSE Compliance runs-on: ubuntu-22.04 - timeout-minutes: 120 + timeout-minutes: 5 steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/ci_linux.yml b/.github/workflows/ci_linux.yml index af13384..71f555c 100644 --- a/.github/workflows/ci_linux.yml +++ b/.github/workflows/ci_linux.yml @@ -67,7 +67,7 @@ jobs: - name: Install CMake uses: seqan/actions/setup-cmake@main with: - cmake: 3.21.7 + cmake: 3.25.3 - name: Configure run: | diff --git a/.github/workflows/ci_macos.yml b/.github/workflows/ci_macos.yml index b1b593d..acf65e6 100644 --- a/.github/workflows/ci_macos.yml +++ b/.github/workflows/ci_macos.yml @@ -67,7 +67,7 @@ jobs: - name: Install CMake uses: seqan/actions/setup-cmake@main with: - cmake: 3.21.7 + cmake: 3.25.3 - name: Configure run: | diff --git a/CMakeLists.txt b/CMakeLists.txt index c28ee2f..9ea5069 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,34 +4,9 @@ cmake_minimum_required (VERSION 3.16) -## CUSTOMISE - # Define the application name and version. project (app-template VERSION 1.0.0) -# Needed for CPM -find_package (Git REQUIRED) - -## BUILD - -# Make Release default build type -if (NOT CMAKE_BUILD_TYPE) - set (CMAKE_BUILD_TYPE - Release - CACHE STRING "Choose the type of build, options are: Debug Release Coverage RelWithDebInfo MinSizeRel." FORCE - ) -endif () - -# Specify the directories where to store the built archives, libraries and executables -set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") -set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") -set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") - -# Messages -string (ASCII 27 Esc) -set (FontBold "${Esc}[1m") -set (FontReset "${Esc}[m") - # Allow to include CMake scripts from the app-template. list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") @@ -42,16 +17,29 @@ require_ccache () # Add packages. set (CPM_INDENT " CMake Package Manager CPM: ") include (CPM) -include (CPMGetSystemPackage) CPMUsePackageLock (${CMAKE_CURRENT_LIST_DIR}/cmake/package-lock.cmake) -CPMGetSystemPackage (hibf) -CPMGetSystemPackage (sharg) -CPMGetSystemPackage (seqan3) +CPMGetPackage (hibf) +CPMGetPackage (sharg) +CPMGetPackage (seqan3) # Add the application. -add_subdirectory (src) -message (STATUS "${FontBold}You can run `make` to build the application.${FontReset}") +# A interface to reuse common properties. +# You can add more external include paths of other projects that are needed for your project. +add_library ("${PROJECT_NAME}_interface" INTERFACE) +target_link_libraries ("${PROJECT_NAME}_interface" INTERFACE seqan3::seqan3) +target_link_libraries ("${PROJECT_NAME}_interface" INTERFACE sharg::sharg) +target_link_libraries ("${PROJECT_NAME}_interface" INTERFACE seqan::hibf) +target_include_directories ("${PROJECT_NAME}_interface" INTERFACE "include") +target_compile_options ("${PROJECT_NAME}_interface" INTERFACE "-pedantic" "-Wall" "-Wextra") + +# An object library (without main) to be used in multiple targets. +add_library ("${PROJECT_NAME}_lib" STATIC src/fastq_conversion.cpp) +target_link_libraries ("${PROJECT_NAME}_lib" PUBLIC "${PROJECT_NAME}_interface") + +add_executable ("${PROJECT_NAME}" src/main.cpp) +target_link_libraries ("${PROJECT_NAME}" PRIVATE "${PROJECT_NAME}_lib") + ## TEST option (${PROJECT_NAME}_TEST "Enable testing for ${PROJECT_NAME}." ON) diff --git a/cmake/CPMGetSystemPackage.cmake b/cmake/CPMGetSystemPackage.cmake deleted file mode 100644 index dc1860a..0000000 --- a/cmake/CPMGetSystemPackage.cmake +++ /dev/null @@ -1,30 +0,0 @@ -# SPDX-FileCopyrightText: 2006-2023, Knut Reinert & Freie Universität Berlin -# SPDX-FileCopyrightText: 2016-2023, Knut Reinert & MPI für molekulare Genetik -# SPDX-License-Identifier: BSD-3-Clause - -# SYSTEM property is only implemented with CMake 3.25 -macro (CPMGetSystemPackage package) - CPMGetPackage (${package}) - - if (CMAKE_VERSION VERSION_LESS 3.25) - set (target_name "${package}") - if ("${package}" STREQUAL "seqan3") - set (target_name "seqan3_seqan3") - elseif ("${package}" STREQUAL "sharg") - set (target_name "sharg_sharg") - endif () - - if (${package}_ADDED) - set (interface_include "$") - set (include "$") - set_target_properties (${target_name} - PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES - "$<$:${interface_include}>;$<$:${include}>" - ) - unset (interface_include) - unset (include) - endif () - - unset (target_name) - endif () -endmacro () diff --git a/test/cmake/app_datasources.cmake b/cmake/app_datasources.cmake similarity index 100% rename from test/cmake/app_datasources.cmake rename to cmake/app_datasources.cmake diff --git a/cmake/test_config.cmake b/cmake/test_config.cmake new file mode 100644 index 0000000..9ce9518 --- /dev/null +++ b/cmake/test_config.cmake @@ -0,0 +1,63 @@ +# SPDX-FileCopyrightText: 2006-2024 Knut Reinert & Freie Universität Berlin +# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik +# SPDX-License-Identifier: CC0-1.0 + +# Add googletest. +CPMGetPackage (googletest) +include (GoogleTest OPTIONAL) + +# Set directories for test output files, input data and binaries. +file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/output) +add_definitions (-DOUTPUTDIR=\"${CMAKE_CURRENT_BINARY_DIR}/output/\") +add_definitions (-DDATADIR=\"${CMAKE_CURRENT_BINARY_DIR}/data/\") +add_definitions (-DBINDIR=\"${CMAKE_CURRENT_BINARY_DIR}/../\") +add_definitions (-DAPPNAME=\"${PROJECT_NAME}\") + +# # Test executables and libraries should not mix with the application files. +# # This must happen after setting the output directories. +# unset (CMAKE_ARCHIVE_OUTPUT_DIRECTORY) +# unset (CMAKE_LIBRARY_OUTPUT_DIRECTORY) +# unset (CMAKE_RUNTIME_OUTPUT_DIRECTORY) + +# Add the test interface library. +if (NOT TARGET ${PROJECT_NAME}_test) + add_library (${PROJECT_NAME}_test INTERFACE) + target_compile_options (${PROJECT_NAME}_test INTERFACE "-pedantic" "-Wall" "-Wextra" "-Werror") + + # GCC12 and above: Disable warning about std::hardware_destructive_interference_size not being ABI-stable. + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12) + target_compile_options (${PROJECT_NAME}_test INTERFACE "-Wno-interference-size") + endif () + endif () + + # GCC12 has some bogus warnings. They will not be fixed in googletest. + # https://github.com/google/googletest/issues/4232 + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12 AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13) + target_compile_options (${PROJECT_NAME}_test INTERFACE "-Wno-restrict") + endif () + endif () + + target_link_libraries (${PROJECT_NAME}_test INTERFACE "${PROJECT_NAME}_lib" "GTest::gtest_main") + add_library (${PROJECT_NAME}::test ALIAS ${PROJECT_NAME}_test) +endif () + +# Add the check target that builds and runs tests. +add_custom_target (check COMMAND ${CMAKE_CTEST_COMMAND} ${CMAKE_CTEST_ARGUMENTS}) + +macro (add_app_test test_filename) + file (RELATIVE_PATH source_file "${CMAKE_SOURCE_DIR}" "${CMAKE_CURRENT_LIST_DIR}/${test_filename}") + get_filename_component (target "${source_file}" NAME_WE) + + add_executable (${target} ${test_filename}) + target_link_libraries (${target} ${PROJECT_NAME}::test) + + add_dependencies (${target} ${PROJECT_NAME}) + add_dependencies (check ${target}) + + add_test (NAME ${target} COMMAND ${target}) + + unset (source_file) + unset (target) +endmacro () diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt deleted file mode 100644 index b9fe825..0000000 --- a/src/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -# SPDX-FileCopyrightText: 2006-2024 Knut Reinert & Freie Universität Berlin -# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik -# SPDX-License-Identifier: CC0-1.0 - -cmake_minimum_required (VERSION 3.16) - -# A interface to reuse common properties. -# You can add more external include paths of other projects that are needed for your project. -add_library ("${PROJECT_NAME}_interface" INTERFACE) -target_link_libraries ("${PROJECT_NAME}_interface" INTERFACE seqan3::seqan3) -target_link_libraries ("${PROJECT_NAME}_interface" INTERFACE sharg::sharg) -target_link_libraries ("${PROJECT_NAME}_interface" INTERFACE seqan::hibf) -target_include_directories ("${PROJECT_NAME}_interface" INTERFACE "${CMAKE_CURRENT_LIST_DIR}/../include") -target_compile_options ("${PROJECT_NAME}_interface" INTERFACE "-pedantic" "-Wall" "-Wextra") - -# An object library (without main) to be used in multiple targets. -add_library ("${PROJECT_NAME}_lib" STATIC fastq_conversion.cpp) -target_link_libraries ("${PROJECT_NAME}_lib" PUBLIC "${PROJECT_NAME}_interface") - -add_executable ("${PROJECT_NAME}" main.cpp) -target_link_libraries ("${PROJECT_NAME}" PRIVATE "${PROJECT_NAME}_lib") diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index c134283..3650fe6 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -4,83 +4,12 @@ cmake_minimum_required (VERSION 3.16) -# Add googletest. -CPMGetSystemPackage (googletest) -include (GoogleTest OPTIONAL) - -# Allow to include CMake scripts from seqan3. -list (APPEND CMAKE_MODULE_PATH "${seqan3_SOURCE_DIR}/test/cmake/") -# Allow to include CMake scripts from the app-template. -list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/") - -# Set directories for test output files, input data and binaries. -file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/output) -add_definitions (-DOUTPUTDIR=\"${CMAKE_CURRENT_BINARY_DIR}/output/\") -add_definitions (-DDATADIR=\"${CMAKE_CURRENT_BINARY_DIR}/data/\") -add_definitions (-DBINDIR=\"${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/\") -add_definitions (-DAPPNAME=\"${PROJECT_NAME}\") - -# Test executables and libraries should not mix with the application files. -# This must happen after setting the output directories. -unset (CMAKE_ARCHIVE_OUTPUT_DIRECTORY) -unset (CMAKE_LIBRARY_OUTPUT_DIRECTORY) -unset (CMAKE_RUNTIME_OUTPUT_DIRECTORY) - -# Add the test interface library. -if (NOT TARGET ${PROJECT_NAME}_test) - add_library (${PROJECT_NAME}_test INTERFACE) - target_compile_options (${PROJECT_NAME}_test INTERFACE "-pedantic" "-Wall" "-Wextra" "-Werror") - - # GCC12 and above: Disable warning about std::hardware_destructive_interference_size not being ABI-stable. - if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12) - target_compile_options (${PROJECT_NAME}_test INTERFACE "-Wno-interference-size") - endif () - endif () - - # GCC12 has some bogus warnings. They will not be fixed in googletest. - # https://github.com/google/googletest/issues/4232 - if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12 AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13) - target_compile_options (${PROJECT_NAME}_test INTERFACE "-Wno-restrict") - endif () - endif () - - target_link_libraries (${PROJECT_NAME}_test INTERFACE "${PROJECT_NAME}_lib" "GTest::gtest_main") - target_include_directories (${PROJECT_NAME}_test INTERFACE "${seqan3_SOURCE_DIR}/test/include") - add_library (${PROJECT_NAME}::test ALIAS ${PROJECT_NAME}_test) -endif () - -# Add the check target that builds and runs tests. -add_custom_target (check COMMAND ${CMAKE_CTEST_COMMAND} ${CMAKE_CTEST_ARGUMENTS}) - -include (seqan3_test_component) -# A macro that adds an api or cli test. -macro (add_app_test test_filename) - # Extract the test target name. - file (RELATIVE_PATH source_file "${CMAKE_SOURCE_DIR}" "${CMAKE_CURRENT_LIST_DIR}/${test_filename}") - seqan3_test_component (target "${source_file}" TARGET_NAME) - seqan3_test_component (test_name "${source_file}" TEST_NAME) - - # Create the test target. - add_executable (${target} ${test_filename}) - target_link_libraries (${target} ${PROJECT_NAME}::test) - add_dependencies (${target} ${PROJECT_NAME}) - add_dependencies (check ${target}) - - # Generate and set the test name. - add_test (NAME "${test_name}" COMMAND ${target}) +include (test_config) +include (data/datasources.cmake) - unset (source_file) - unset (target) - unset (test_name) -endmacro () +message (STATUS "You can run `make check` to build and run tests.") -# Fetch data and add the tests. -include (data/datasources.cmake) -add_subdirectory (api) -add_subdirectory (cli) -add_subdirectory (header) -add_subdirectory (coverage) +add_app_test (api_fastq_coversion_test.cpp) +add_app_test (cli_fastq_coversion_test.cpp) -message (STATUS "${FontBold}You can run `make check` to build and run tests.${FontReset}") +target_use_datasources (check FILES in.fastq out.fasta) diff --git a/test/api/CMakeLists.txt b/test/api/CMakeLists.txt deleted file mode 100644 index 8608b59..0000000 --- a/test/api/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# SPDX-FileCopyrightText: 2006-2024 Knut Reinert & Freie Universität Berlin -# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik -# SPDX-License-Identifier: CC0-1.0 - -cmake_minimum_required (VERSION 3.16) - -add_app_test (convert_fastq_test.cpp) -target_use_datasources (convert_fastq_test FILES in.fastq) -target_use_datasources (convert_fastq_test FILES out.fasta) diff --git a/test/api/README.md b/test/api/README.md deleted file mode 100644 index 8cf6d5b..0000000 --- a/test/api/README.md +++ /dev/null @@ -1,12 +0,0 @@ - - -# API Test - -Here are test files for API tests, i.e. the internal functions of the app are executed with different input parameters. -The test then validates whether the functions work correctly. -Attention: The default `make` target does not build tests. -Please invoke the build with `make api_test` or use `make test` to build and run all kinds of tests. diff --git a/test/api/convert_fastq_test.cpp b/test/api_fastq_coversion_test.cpp similarity index 95% rename from test/api/convert_fastq_test.cpp rename to test/api_fastq_coversion_test.cpp index c63cbe5..0fe41a4 100644 --- a/test/api/convert_fastq_test.cpp +++ b/test/api_fastq_coversion_test.cpp @@ -4,8 +4,9 @@ #include -#include "../app_test.hpp" -#include "fastq_conversion.hpp" +#include + +#include "app_test.hpp" // To prevent issues when running multiple API tests in parallel, give each API test unique names: struct fastq_to_fasta : public app_test diff --git a/test/cli/CMakeLists.txt b/test/cli/CMakeLists.txt deleted file mode 100644 index c7cdfb1..0000000 --- a/test/cli/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# SPDX-FileCopyrightText: 2006-2024 Knut Reinert & Freie Universität Berlin -# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik -# SPDX-License-Identifier: CC0-1.0 - -cmake_minimum_required (VERSION 3.16) - -add_app_test (fastq_to_fasta_options_test.cpp) -target_use_datasources (fastq_to_fasta_options_test FILES in.fastq) -target_use_datasources (fastq_to_fasta_options_test FILES out.fasta) diff --git a/test/cli/README.md b/test/cli/README.md deleted file mode 100644 index fea0b5d..0000000 --- a/test/cli/README.md +++ /dev/null @@ -1,24 +0,0 @@ - - -# CLI Test - -Here are test files for command line interface tests, i.e. the app is executed with defined input files and parameters. -The test then validates whether the output is correct. - -Each test fixture should be inherited from the `cli_test` class: It provides the functionality of executing the app, -finding the input files, capturing the output and creating individual test directories. -We provide a new test macro `EXPECT_RANGE_EQ` for the comparison of whole ranges. -It provides more insights about differences than an implementation with `EXPECT_TRUE(std::ranges::equal())`. -The test output files are stored in the directory `test/output`. - -To prevent issues when running multiple CLI tests in parallel, each CLI should use its own derived test fixture. -For example, if two CLI tests run a test called `my_test` and both use the `cli_test` test fixture, there may -be issues because both tests will use the same working directory. Instead, define different test fixtures for both -tests, e.g. `struct my_test_fixture : public cli_test {};`. - -Attention: The default `make` target does not build tests. -Please invoke the build with `make cli_test` or use `make test` to build and run all kinds of tests. diff --git a/test/cli/fastq_to_fasta_options_test.cpp b/test/cli_fastq_coversion_test.cpp similarity index 99% rename from test/cli/fastq_to_fasta_options_test.cpp rename to test/cli_fastq_coversion_test.cpp index cc9fe9b..5b94951 100644 --- a/test/cli/fastq_to_fasta_options_test.cpp +++ b/test/cli_fastq_coversion_test.cpp @@ -2,7 +2,7 @@ // SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik // SPDX-License-Identifier: CC0-1.0 -#include "../app_test.hpp" +#include "app_test.hpp" // To prevent issues when running multiple CLI tests in parallel, give each CLI test unique names: struct fastq_to_fasta : public app_test diff --git a/test/coverage/CMakeLists.txt b/test/coverage/CMakeLists.txt deleted file mode 100644 index 075c40b..0000000 --- a/test/coverage/CMakeLists.txt +++ /dev/null @@ -1,28 +0,0 @@ -# SPDX-FileCopyrightText: 2006-2024 Knut Reinert & Freie Universität Berlin -# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik -# SPDX-License-Identifier: CC0-1.0 - -cmake_minimum_required (VERSION 3.16) - -# Add a custom build type: Coverage - -set (CMAKE_CXX_FLAGS_COVERAGE - "${CMAKE_CXX_FLAGS_DEBUG} --coverage -fprofile-arcs -ftest-coverage ${FPROFILE_ABS_PATH}" - CACHE STRING "Flags used by the C++ compiler during coverage builds." FORCE -) -set (CMAKE_C_FLAGS_COVERAGE - "${CMAKE_C_FLAGS_DEBUG} --coverage -fprofile-arcs -ftest-coverage ${FPROFILE_ABS_PATH}" - CACHE STRING "Flags used by the C compiler during coverage builds." FORCE -) -set (CMAKE_EXE_LINKER_FLAGS_COVERAGE - "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -Wl,-lgcov" - CACHE STRING "Flags used for linking binaries during coverage builds." FORCE -) -set (CMAKE_SHARED_LINKER_FLAGS_COVERAGE - "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -Wl,-lgcov" - CACHE STRING "Flags used by the shared libraries linker during coverage builds." FORCE -) - -mark_as_advanced (CMAKE_CXX_FLAGS_COVERAGE CMAKE_C_FLAGS_COVERAGE CMAKE_EXE_LINKER_FLAGS_COVERAGE - CMAKE_SHARED_LINKER_FLAGS_COVERAGE -) diff --git a/test/coverage/README.md b/test/coverage/README.md deleted file mode 100644 index f11e41e..0000000 --- a/test/coverage/README.md +++ /dev/null @@ -1,15 +0,0 @@ - - -# Coverage Test - -This is the test for the code coverage. -It reaches 100% if each code line is executed at least once through the app tests. - -Coverage tests are not yet part of the CMake configuration like it is in SeqAn3. -However, the CI tests code coverage by running gcov and uploading the results to codecov. - -The custom build type `Coverage` can be used to configure the project such that coverage reports are possible. diff --git a/test/data/datasources.cmake b/test/data/datasources.cmake index d7cd6ba..b6cf131 100644 --- a/test/data/datasources.cmake +++ b/test/data/datasources.cmake @@ -4,7 +4,7 @@ cmake_minimum_required (VERSION 3.16) -include (cmake/app_datasources.cmake) +include (app_datasources) # copies file to /data/in.fastq declare_datasource (FILE in.fastq URL ${CMAKE_SOURCE_DIR}/test/data/in.fastq URL_HASH diff --git a/test/header/CMakeLists.txt b/test/header/CMakeLists.txt deleted file mode 100644 index 31223b2..0000000 --- a/test/header/CMakeLists.txt +++ /dev/null @@ -1,56 +0,0 @@ -# SPDX-FileCopyrightText: 2006-2024 Knut Reinert & Freie Universität Berlin -# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik -# SPDX-License-Identifier: CC0-1.0 - -cmake_minimum_required (VERSION 3.16) - -include (seqan3_test_files) -include (seqan3_test_component) - -add_library ("${PROJECT_NAME}_header_test_lib" INTERFACE) -target_link_libraries ("${PROJECT_NAME}_header_test_lib" INTERFACE "${PROJECT_NAME}_test") -# SeqAn3 script adds an include for -file (WRITE "${PROJECT_BINARY_DIR}/dummy_include/benchmark/benchmark.h" "#pragma once") -target_include_directories ("${PROJECT_NAME}_header_test_lib" INTERFACE "${PROJECT_BINARY_DIR}/dummy_include") -set (target "${PROJECT_NAME}_header_test") - -set (header_base_path "${CMAKE_CURRENT_LIST_DIR}/../../include/") - -file (GLOB_RECURSE header_files - RELATIVE "${header_base_path}" - "${header_base_path}/*.hpp" -) - -file (WRITE "${PROJECT_BINARY_DIR}/${target}.cpp" "") -add_executable (${target} ${PROJECT_BINARY_DIR}/${target}.cpp) -target_link_libraries (${target} ${PROJECT_NAME}_header_test_lib) -add_test (NAME "${target}" COMMAND ${target}) -add_dependencies (check ${target}) - -foreach (header ${header_files}) - seqan3_test_component (header_test_name "${header}" TEST_NAME) - seqan3_test_component (header_target_name "${header}" TARGET_UNIQUE_NAME) - - foreach (header_sub_test "header-guard" "no-self-include") - set (header_target_source - "${PROJECT_BINARY_DIR}/${target}_files/${header_test_name}.hpp-${header_sub_test}.cpp" - ) - set (header_target "${target}--${header_target_name}-${header_sub_test}") - string (REPLACE "-" "__" header_test_name_safe "${target}, ${header_target}") - - # we use add_custom_command to detect changes to a header file, which will update the generated source file - add_custom_command (OUTPUT "${header_target_source}" - COMMAND "${CMAKE_COMMAND}" "-DHEADER_FILE_ABSOLUTE=${header_base_path}/${header}" - "-DHEADER_FILE_INCLUDE=${header}" "-DHEADER_TARGET_SOURCE=${header_target_source}" - "-DHEADER_TEST_NAME_SAFE=${header_test_name_safe}" - "-DHEADER_COMPONENT=${PROJECT_NAME}" "-DHEADER_SUB_TEST=${header_sub_test}" "-P" - "${SEQAN3_CLONE_DIR}/test/header/generate_header_source.cmake" - DEPENDS "${header_base_path}/${header}" - "${SEQAN3_CLONE_DIR}/test/header/generate_header_source.cmake" - ) - - add_library (${header_target} OBJECT "${header_target_source}") - target_link_libraries (${header_target} ${PROJECT_NAME}_header_test_lib) - target_sources (${target} PRIVATE $) - endforeach () -endforeach ()