Skip to content

Commit

Permalink
Improve render_expired/render_list test coverage (#415)
Browse files Browse the repository at this point in the history
  • Loading branch information
hummeltech committed Mar 19, 2024
1 parent 3ad8995 commit 2a4532f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 20 deletions.
14 changes: 7 additions & 7 deletions src/render_expired.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,13 +305,6 @@ int main(int argc, char **argv)
}
}

store = init_storage_backend(tile_dir);

if (store == NULL) {
g_logger(G_LOG_LEVEL_CRITICAL, "Failed to initialise storage backend %s", tile_dir);
return 1;
}

// initialise arrays for tile markings

tile_requested = (unsigned int **)malloc((max_zoom - excess_zoomlevels + 1) * sizeof(unsigned int *));
Expand All @@ -328,6 +321,13 @@ int main(int argc, char **argv)
}
}

store = init_storage_backend(tile_dir);

if (store == NULL) {
g_logger(G_LOG_LEVEL_CRITICAL, "Failed to initialise storage backend %s", tile_dir);
return 1;
}

g_logger(G_LOG_LEVEL_INFO, "Started render_expired with the following options:");

if (config_file_name_passed) {
Expand Down
14 changes: 7 additions & 7 deletions src/render_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,13 +307,6 @@ int main(int argc, char **argv)
}
}

store = init_storage_backend(tile_dir);

if (store == NULL) {
g_logger(G_LOG_LEVEL_CRITICAL, "Failed to initialise storage backend %s", tile_dir);
return 1;
}

if (all) {
if ((min_x != -1 || min_y != -1 || max_x != -1 || max_y != -1) && min_zoom != max_zoom) {
g_logger(G_LOG_LEVEL_CRITICAL, "min-zoom must be equal to max-zoom when using min-x, max-x, min-y, or max-y options");
Expand Down Expand Up @@ -351,6 +344,13 @@ int main(int argc, char **argv)
}
}

store = init_storage_backend(tile_dir);

if (store == NULL) {
g_logger(G_LOG_LEVEL_CRITICAL, "Failed to initialise storage backend %s", tile_dir);
return 1;
}

g_logger(G_LOG_LEVEL_INFO, "Started render_list with the following options:");

if (config_file_name_passed) {
Expand Down
10 changes: 4 additions & 6 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -338,11 +338,10 @@ foreach(STORAGE_BACKEND_INDEX RANGE ${STORAGE_BACKENDS_LENGTH})

add_test(NAME render_expired_${SOCKET_TYPE}_${STORAGE_BACKEND}
COMMAND ${BASH} -c "
echo '0/0/0' | $<TARGET_FILE:render_expired> \
printf '0/0/0\n%.0s' {0..100} | $<TARGET_FILE:render_expired> \
--map ${DEFAULT_MAP_NAME} \
--max-zoom 5 \
--min-zoom 0 \
--no-progress \
--num-threads 1 \
--socket ${SOCKET} \
--tile-dir ${TILE_DIR} \
Expand All @@ -357,8 +356,9 @@ foreach(STORAGE_BACKEND_INDEX RANGE ${STORAGE_BACKENDS_LENGTH})
)
add_test(NAME render_expired_config_${SOCKET_TYPE}_${STORAGE_BACKEND}
COMMAND ${BASH} -c "
echo '3/0/3' | $<TARGET_FILE:render_expired> \
--config ${RENDERD_CONF}
echo '100/100/100' | $<TARGET_FILE:render_expired> \
--config ${RENDERD_CONF} \
--no-progress
"
WORKING_DIRECTORY tests
)
Expand All @@ -374,7 +374,6 @@ foreach(STORAGE_BACKEND_INDEX RANGE ${STORAGE_BACKENDS_LENGTH})
--map ${DEFAULT_MAP_NAME} \
--max-zoom 5 \
--min-zoom 0 \
--no-progress \
--num-threads 1 \
--socket ${SOCKET} \
--tile-dir ${TILE_DIR} \
Expand All @@ -393,7 +392,6 @@ foreach(STORAGE_BACKEND_INDEX RANGE ${STORAGE_BACKENDS_LENGTH})
--map ${DEFAULT_MAP_NAME} \
--max-zoom 5 \
--min-zoom 0 \
--no-progress \
--num-threads 1 \
--socket ${SOCKET} \
--tile-dir ${TILE_DIR} \
Expand Down

0 comments on commit 2a4532f

Please sign in to comment.