upgrade libosmium dependency

This commit is contained in:
Dennis Luxen
2015-03-04 12:50:42 +01:00
32 changed files with 628 additions and 150 deletions
+19 -22
View File
@@ -87,32 +87,29 @@ set_tests_properties(testdata-overview PROPERTIES
# multipolygon
#
#-----------------------------------------------------------------------------
add_executable(testdata-multipolygon testdata-multipolygon.cpp)
target_link_libraries(testdata-multipolygon
${OSMIUM_XML_LIBRARIES}
${GDAL_LIBRARIES}
)
if(WIN32)
set(MULTIPOLYGON_TEST_SCRIPT "run-testdata-multipolygon.bat")
find_package(Ruby 1.9)
find_package(Gem COMPONENTS json)
find_program(SPATIALITE spatialite)
if(RUBY_FOUND AND GEM_json_FOUND AND SPATIALITE)
add_executable(testdata-multipolygon testdata-multipolygon.cpp)
target_link_libraries(testdata-multipolygon
${OSMIUM_XML_LIBRARIES}
${GDAL_LIBRARIES}
)
add_test(NAME testdata-multipolygon
COMMAND ${CMAKE_COMMAND}
-D OSM_TESTDATA=${OSM_TESTDATA}
-D RUBY=${RUBY_EXECUTABLE}
-P ${CMAKE_CURRENT_SOURCE_DIR}/run-testdata-multipolygon.cmake)
set_tests_properties(testdata-multipolygon PROPERTIES LABELS "data;slow")
else()
set(MULTIPOLYGON_TEST_SCRIPT "run-testdata-multipolygon.sh")
message(WARNING "Disabled testdata-multipolygon test because 'ruby' and/or 'json' ruby gem and/or 'spatialite' was not found")
endif()
if(MSVC)
set(EXE_DIR ${CMAKE_BUILD_TYPE})
else()
set(EXE_DIR .)
endif()
add_test(NAME testdata-multipolygon
COMMAND ${CMAKE_SOURCE_DIR}/test/data-tests/${MULTIPOLYGON_TEST_SCRIPT}
${OSM_TESTDATA}
${EXE_DIR}
)
set_tests_properties(testdata-multipolygon PROPERTIES
LABELS "data;slow")
#-----------------------------------------------------------------------------
message(STATUS "Configuring data tests - done")
+2 -15
View File
@@ -5,19 +5,6 @@ repository at https://github.com/osmcode/osm-testdata . To use it, clone
the `osm-testdata` repository in the same directory where you cloned the
`libosmium` repository.
## Overview
The `testdata-overview` program can be used to create a Spatialite file
containing all the nodes and ways from the test data files.
Compile it by running `make testdata-overview`, run it my calling
`make overview`.
## Running the Tests
Actual tests are in `testcases` subdirectory, one per test from the
osm-testdata repository.
To compile the tests, call `make runtests`, to run them call
`make test`.
Tests will be built if the CMake option `BUILD_DATA_TESTS` is set and run as
part of the `ctest` run.
@@ -1,7 +0,0 @@
set TESTDATA_DIR=%1
del multipolygon.db multipolygon-tests.json
%2\testdata-multipolygon %TESTDATA_DIR%\grid\data\all.osm >multipolygon.log 2>&1
if ERRORLEVEL 1 (exit /b 1)
ruby %TESTDATA_DIR%\bin\compare-areas.rb %TESTDATA_DIR%\grid\data\tests.json multipolygon-tests.json
if ERRORLEVEL 1 (exit /b 1)
@@ -0,0 +1,46 @@
#-----------------------------------------------------------------------------
#
# Helper script that runs the 'multipolygon' test.
#
#-----------------------------------------------------------------------------
# Remove files that might be left over from previous run
file(REMOVE multipolygon.db multipolygon-tests.json)
#-----------------------------------------------------------------------------
#
# Create multipolygons from test data.
#
#-----------------------------------------------------------------------------
execute_process(
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/testdata-multipolygon
${OSM_TESTDATA}/grid/data/all.osm
RESULT_VARIABLE _result
OUTPUT_FILE multipolygon.log
ERROR_FILE multipolygon.log
)
if(_result)
message(FATAL_ERROR "Error running testdata-multipolygon command")
endif()
#-----------------------------------------------------------------------------
#
# Compare created multipolygons with reference data.
#
#-----------------------------------------------------------------------------
execute_process(
COMMAND ${RUBY} ${OSM_TESTDATA}/bin/compare-areas.rb
${OSM_TESTDATA}/grid/data/tests.json
multipolygon-tests.json
RESULT_VARIABLE _result
)
if(_result)
message(FATAL_ERROR "Error running compare-areas command")
endif()
#-----------------------------------------------------------------------------
@@ -1,10 +0,0 @@
#!/bin/sh
# helper script needed by cmake to run test
TESTDATA_DIR=$1
rm -f multipolygon.db multipolygon-tests.json
./testdata-multipolygon ${TESTDATA_DIR}/grid/data/all.osm >multipolygon.log 2>&1 &&
${TESTDATA_DIR}/bin/compare-areas.rb ${TESTDATA_DIR}/grid/data/tests.json multipolygon-tests.json
+1 -1
View File
@@ -46,7 +46,7 @@ std::string read_file(const char* test_id) {
assert(fd >= 0);
std::string input(10000, '\0');
ssize_t n = ::read(fd, reinterpret_cast<unsigned char*>(const_cast<char*>(input.data())), 10000);
auto n = ::read(fd, reinterpret_cast<unsigned char*>(const_cast<char*>(input.data())), 10000);
assert(n >= 0);
input.resize(static_cast<std::string::size_type>(n));