Skip to content

Commit d660a79

Browse files
authored
Merge pull request #3336 from eseiler/infra/cleanup_header
[TEST] Cleanup header tests
2 parents e6a6f1b + 5cb2ed1 commit d660a79

File tree

2 files changed

+20
-28
lines changed

2 files changed

+20
-28
lines changed

test/header/CMakeLists.txt

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ include (../seqan3-test.cmake)
1010
CPMGetPackage (googletest)
1111
CPMGetPackage (benchmark)
1212

13-
option (SEQAN3_FULL_HEADER_TEST "Test seqan3 headers as well as the headers of external libraries" OFF)
14-
1513
# We compile each header twice in separate compilation units, where the second compilation omits the header guard (check
1614
# for cyclic includes). Each alone is sufficient to test that the header is functional, but both are needed to check for
1715
# link errors, which can happen if the header accidentally defines a variable, e.g. a global or class static member.
@@ -133,15 +131,3 @@ endmacro ()
133131
# note: seqan3/version.hpp is one of the only header that is not required to have a seqan3/core/platform.hpp include
134132
seqan3_header_test (seqan3 "${SEQAN3_CLONE_DIR}/include" "seqan3/version.hpp|seqan3/contrib/std|seqan3/vendor")
135133
seqan3_header_test (seqan3_test "${SEQAN3_CLONE_DIR}/test/include" "")
136-
137-
if (SEQAN3_FULL_HEADER_TEST)
138-
139-
# not self-contained headers; error: extra ‘;’ [-Werror=pedantic]
140-
# seqan3_header_test (lemon "${SEQAN3_CLONE_DIR}/submodules/lemon/include" "")
141-
142-
# not complete self-contained headers
143-
seqan3_header_test (cereal "${SEQAN3_CLONE_DIR}/submodules/cereal/include" "/external/|polymorphic_impl\.hpp")
144-
145-
seqan3_header_test (sdsl-lite "${SEQAN3_CLONE_DIR}/submodules/sdsl-lite/include" "")
146-
147-
endif ()

test/header/generate_header_source.cmake

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,53 +11,59 @@ option (HEADER_SUB_TEST "")
1111

1212
file (WRITE "${HEADER_TARGET_SOURCE}" "") # write empty file
1313

14+
# cmake-format: off
15+
1416
if (HEADER_SUB_TEST STREQUAL "no-self-include")
1517
# this test ensures that a header will not be included by itself later
1618
file (READ "${HEADER_FILE_ABSOLUTE}" header_content)
1719

1820
string (REPLACE "#pragma once" "" header_content "${header_content}")
1921

20-
file (APPEND "${HEADER_TARGET_SOURCE}" "${header_content}\n")
22+
file (APPEND "${HEADER_TARGET_SOURCE}"
23+
"// seqan3-header-test-no-self-include-start\n"
24+
"${header_content}\n"
25+
"// seqan3-header-test-no-self-include-end\n\n")
2126
else ()
2227
# this test ensures that a header guard is in place
2328
file (APPEND "${HEADER_TARGET_SOURCE}" #
29+
"// seqan3-header-test-header-guard-start\n"
2430
"#include <${HEADER_FILE_INCLUDE}>\n" #
25-
"#include <${HEADER_FILE_INCLUDE}>\n")
31+
"#include <${HEADER_FILE_INCLUDE}>\n"
32+
"// seqan3-header-test-header-guard-end\n\n")
2633
endif ()
2734

2835
# these includes are required by some headers (note that they follow)
2936
file (APPEND "${HEADER_TARGET_SOURCE}" #
37+
"// seqan3-header-test-dependencies-start\n"
3038
"#include <gtest/gtest.h>\n" #
3139
"#include <benchmark/benchmark.h>\n" #
32-
"TEST(${HEADER_TEST_NAME_SAFE}) {}\n")
40+
"TEST(${HEADER_TEST_NAME_SAFE}) {}\n"
41+
"// seqan3-header-test-dependencies-end\n\n")
3342

3443
# test that seqan3 headers include platform.hpp
3544
if ("${HEADER_COMPONENT}" MATCHES "seqan3")
3645

3746
# exclude seqan3/std/* and seqan3/contrib/* from platform test
3847
if (NOT HEADER_FILE_INCLUDE MATCHES "seqan3/(std|contrib)/")
3948
file (APPEND "${HEADER_TARGET_SOURCE}" #
49+
"// seqan3-header-test-platform-start\n"
4050
"#ifndef SEQAN3_DOXYGEN_ONLY\n" #
4151
"#error \"Your header '${HEADER_FILE_INCLUDE}' file is missing #include <seqan3/core/platform.hpp>\"\n" #
42-
"#endif\n")
52+
"#endif\n"
53+
"// seqan3-header-test-platform-end\n\n")
4354
endif ()
4455

4556
# seqan3/std/* must not include platform.hpp (and therefore any other seqan3 header)
4657
# See https://github.com/seqan/product_backlog/issues/135
4758
if (HEADER_FILE_INCLUDE MATCHES "seqan3/std/")
4859
file (APPEND "${HEADER_TARGET_SOURCE}" #
60+
"// seqan3-header-test-no-platform-start\n"
4961
"#ifdef SEQAN3_DOXYGEN_ONLY" #
5062
"#error \"The standard header '${HEADER_FILE_INCLUDE}' file MUST NOT include any other " #
5163
"seqan3 header (except for seqan3/contrib)\"\n" #
52-
"#endif\n")
64+
"#endif\n"
65+
"// seqan3-header-test-no-platform-end\n\n")
5366
endif ()
54-
55-
# test whether seqan3 has the visibility bug on lower gcc versions
56-
# https://github.com/seqan/seqan3/issues/1317
57-
file (APPEND "${HEADER_TARGET_SOURCE}" #
58-
"#include <seqan3/core/platform.hpp>\n\n" #
59-
"class A{ int i{5}; };\n\n" #
60-
"template <typename t>\n" #
61-
"concept private_bug = requires(t a){a.i;};\n\n" #
62-
"static_assert(!private_bug<A>, \"See https://github.com/seqan/seqan3/issues/1317\");\n")
6367
endif ()
68+
69+
# cmake-format: on

0 commit comments

Comments
 (0)