Skip to content

Commit ba21b06

Browse files
committed
reinstate ctest labels
1 parent 5aaf8fa commit ba21b06

1 file changed

Lines changed: 57 additions & 41 deletions

File tree

tests/CMakeLists.txt

Lines changed: 57 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,66 @@
1-
set (TESTS
2-
test-db-copy-thread.cpp
3-
test-db-copy-mgr.cpp
4-
test-expire-tiles.cpp
5-
test-middle.cpp
6-
test-options-database.cpp
7-
test-options-parse.cpp
8-
test-options-projection.cpp
9-
test-output-gazetteer.cpp
10-
test-output-multi-line.cpp
11-
test-output-multi-line-storage.cpp
12-
test-output-multi-point.cpp
13-
test-output-multi-point-multi-table.cpp
14-
test-output-multi-poly-trivial.cpp
15-
test-output-multi-polygon.cpp
16-
test-output-multi-tags.cpp
17-
test-output-pgsql.cpp
18-
test-output-pgsql-area.cpp
19-
test-output-pgsql-hstore-match-only.cpp
20-
test-output-pgsql-int4.cpp
21-
test-output-pgsql-schema.cpp
22-
test-output-pgsql-tablespace.cpp
23-
test-output-pgsql-validgeom.cpp
24-
test-output-pgsql-z_order.cpp
25-
test-parse-osmium.cpp
26-
test-persistent-cache.cpp
27-
test-ram-cache.cpp
28-
test-wildcard-match.cpp
29-
)
1+
# Add a new test
2+
#
3+
# set_test(name [LABELS labels])
4+
#
5+
# name - Name of test (source file without suffix)
6+
# labels - optional labels for the test
7+
function(set_test test_name)
8+
cmake_parse_arguments(test_param "" "" "LABELS" ${ARGN})
9+
10+
add_executable(${test_name} ${test_name}.cpp)
11+
target_link_libraries(${test_name} osm2pgsql_lib catch_main_lib)
12+
add_test(NAME ${test_name}
13+
COMMAND ${test_name}
14+
WORKING_DIRECTORY ${osm2pgsql_SOURCE_DIR})
15+
16+
set_tests_properties(${test_name} PROPERTIES TIMEOUT ${TESTING_TIMEOUT})
17+
18+
if (DEFINED test_param_LABELS)
19+
set_tests_properties(${test_name} PROPERTIES LABELS "${test_param_LABELS}")
20+
21+
list(FIND ${test_param_LABELS} Tablespace test_num_labels)
22+
if (${test_num_labels} EQUAL -1)
23+
set_tests_properties(${test_name}
24+
PROPERTIES FIXTURES_REQUIRED Tablespace)
25+
endif()
26+
endif()
27+
28+
message(STATUS "Added test: ${test_name}...")
29+
endfunction()
3030

3131
add_definitions( -DTESTDATA_DIR=\"${osm2pgsql_SOURCE_DIR}/tests/data/\" )
3232
add_definitions( -DOSM2PGSQLDATA_DIR=\"${osm2pgsql_SOURCE_DIR}/\" )
3333
3434
add_library(catch_main_lib STATIC catch-main.cpp)
3535
36-
foreach (test ${TESTS})
37-
get_filename_component(test_name ${test} NAME_WE)
38-
add_executable(${test_name} ${test})
39-
target_link_libraries(${test_name} osm2pgsql_lib catch_main_lib)
40-
add_test(NAME ${test_name} COMMAND ${test_name}
41-
WORKING_DIRECTORY ${osm2pgsql_SOURCE_DIR})
42-
message(STATUS "Added test: ${test_name}...")
43-
set_tests_properties(${test_name} PROPERTIES TIMEOUT ${TESTING_TIMEOUT})
44-
endforeach()
36+
set_test(test-db-copy-thread)
37+
set_test(test-db-copy-mgr)
38+
set_test(test-expire-tiles LABELS NoDB)
39+
set_test(test-middle)
40+
set_test(test-options-database LABELS NoDB)
41+
set_test(test-options-parse LABELS NoDB)
42+
set_test(test-options-projection)
43+
set_test(test-output-gazetteer)
44+
set_test(test-output-multi-line)
45+
set_test(test-output-multi-line-storage)
46+
set_test(test-output-multi-point)
47+
set_test(test-output-multi-point-multi-table)
48+
set_test(test-output-multi-poly-trivial)
49+
set_test(test-output-multi-polygon)
50+
set_test(test-output-multi-tags)
51+
set_test(test-output-pgsql)
52+
set_test(test-output-pgsql-area)
53+
set_test(test-output-pgsql-hstore-match-only)
54+
set_test(test-output-pgsql-int4)
55+
set_test(test-output-pgsql-schema)
56+
set_test(test-output-pgsql-tablespace LABELS Tablespace)
57+
set_test(test-output-pgsql-validgeom)
58+
set_test(test-output-pgsql-z_order)
59+
set_test(test-parse-osmium)
60+
set_test(test-persistent-cache LABELS NoDB)
61+
set_test(test-ram-cache LABELS NoDB)
62+
set_test(test-wildcard-match LABELS NoDB)
63+
4564
4665
# Fixture for creating test tablespace under a pg_virtualenv
4766
if (NOT WIN32)
@@ -57,9 +76,6 @@ if (NOT WIN32)
5776
set_tests_properties(FixtureTablespaceCleanup PROPERTIES FIXTURES_CLEANUP Tablespace)
5877
endif()
5978
60-
set_tests_properties(test-output-pgsql-tablespace
61-
PROPERTIES FIXTURES_REQUIRED Tablespace)
62-
6379
if (NOT HAVE_LUA)
6480
# these tests require LUA support
6581
set_tests_properties(test-output-multi-poly-trivial PROPERTIES WILL_FAIL on)

0 commit comments

Comments
 (0)