osrm-prepare -> osrm-contract

This commit is contained in:
Patrick Niklaus 2016-02-14 19:35:37 +01:00 committed by Daniel J. Hofmann
parent 96a5e594b3
commit 085bab749f
12 changed files with 41 additions and 52 deletions

View File

@ -76,7 +76,7 @@ add_dependencies(UTIL FingerPrintConfigure)
set_target_properties(UTIL PROPERTIES LINKER_LANGUAGE CXX) set_target_properties(UTIL PROPERTIES LINKER_LANGUAGE CXX)
add_executable(osrm-extract src/tools/extract.cpp) add_executable(osrm-extract src/tools/extract.cpp)
add_executable(osrm-prepare src/tools/contract.cpp) add_executable(osrm-contract src/tools/contract.cpp)
add_executable(osrm-routed src/tools/routed.cpp $<TARGET_OBJECTS:SERVER> $<TARGET_OBJECTS:UTIL>) add_executable(osrm-routed src/tools/routed.cpp $<TARGET_OBJECTS:SERVER> $<TARGET_OBJECTS:UTIL>)
add_executable(osrm-datastore src/tools/store.cpp $<TARGET_OBJECTS:UTIL>) add_executable(osrm-datastore src/tools/store.cpp $<TARGET_OBJECTS:UTIL>)
add_library(osrm src/osrm/osrm.cpp $<TARGET_OBJECTS:ENGINE> $<TARGET_OBJECTS:UTIL>) add_library(osrm src/osrm/osrm.cpp $<TARGET_OBJECTS:ENGINE> $<TARGET_OBJECTS:UTIL>)
@ -287,7 +287,7 @@ endif()
# Binaries # Binaries
target_link_libraries(osrm-datastore osrm_store ${Boost_LIBRARIES}) target_link_libraries(osrm-datastore osrm_store ${Boost_LIBRARIES})
target_link_libraries(osrm-extract osrm_extract ${Boost_LIBRARIES}) target_link_libraries(osrm-extract osrm_extract ${Boost_LIBRARIES})
target_link_libraries(osrm-prepare osrm_contract ${Boost_LIBRARIES}) target_link_libraries(osrm-contract osrm_contract ${Boost_LIBRARIES})
target_link_libraries(osrm-routed osrm ${Boost_LIBRARIES} ${OPTIONAL_SOCKET_LIBS} ${ZLIB_LIBRARY}) target_link_libraries(osrm-routed osrm ${Boost_LIBRARIES} ${OPTIONAL_SOCKET_LIBS} ${ZLIB_LIBRARY})
set(EXTRACTOR_LIBRARIES set(EXTRACTOR_LIBRARIES
@ -372,7 +372,7 @@ endif()
# (i.e., from /usr/local/bin/) the linker can find library dependencies. For # (i.e., from /usr/local/bin/) the linker can find library dependencies. For
# more info see http://www.cmake.org/Wiki/CMake_RPATH_handling # more info see http://www.cmake.org/Wiki/CMake_RPATH_handling
set_property(TARGET osrm-extract PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE) set_property(TARGET osrm-extract PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
set_property(TARGET osrm-prepare PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE) set_property(TARGET osrm-contract PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
set_property(TARGET osrm-datastore PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE) set_property(TARGET osrm-datastore PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
set_property(TARGET osrm-routed PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE) set_property(TARGET osrm-routed PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
@ -390,7 +390,7 @@ install(FILES ${ContractorHeader} DESTINATION include/osrm/contractor)
install(FILES ${LibraryGlob} DESTINATION include/osrm) install(FILES ${LibraryGlob} DESTINATION include/osrm)
install(FILES ${VariantGlob} DESTINATION include/variant) install(FILES ${VariantGlob} DESTINATION include/variant)
install(TARGETS osrm-extract DESTINATION bin) install(TARGETS osrm-extract DESTINATION bin)
install(TARGETS osrm-prepare DESTINATION bin) install(TARGETS osrm-contract DESTINATION bin)
install(TARGETS osrm-datastore DESTINATION bin) install(TARGETS osrm-datastore DESTINATION bin)
install(TARGETS osrm-routed DESTINATION bin) install(TARGETS osrm-routed DESTINATION bin)
install(TARGETS osrm DESTINATION lib) install(TARGETS osrm DESTINATION lib)

View File

@ -1,5 +1,5 @@
@prepare @options @files @prepare @options @files
Feature: osrm-prepare command line options: files Feature: osrm-contract command line options: files
# expansions: # expansions:
# {extracted_base} => path to current extracted input file # {extracted_base} => path to current extracted input file
# {profile} => path to current profile script # {profile} => path to current profile script
@ -13,18 +13,13 @@ Feature: osrm-prepare command line options: files
| ab | | ab |
And the data has been extracted And the data has been extracted
Scenario: osrm-prepare - Passing base file Scenario: osrm-contract - Passing base file
When I run "osrm-prepare {extracted_base}.osrm --profile {profile}" When I run "osrm-contract {extracted_base}.osrm"
Then stderr should be empty Then stderr should be empty
And it should exit with code 0 And it should exit with code 0
Scenario: osrm-prepare - Order of options should not matter Scenario: osrm-contract - Missing input file
When I run "osrm-prepare --profile {profile} {extracted_base}.osrm" When I run "osrm-contract over-the-rainbow.osrm"
Then stderr should be empty
And it should exit with code 0
Scenario: osrm-prepare - Missing input file
When I run "osrm-prepare over-the-rainbow.osrm --profile {profile}"
And stderr should contain "over-the-rainbow.osrm" And stderr should contain "over-the-rainbow.osrm"
And stderr should contain "not found" And stderr should contain "not found"
And it should exit with code 1 And it should exit with code 1

View File

@ -1,53 +1,47 @@
@prepare @options @help @prepare @options @help
Feature: osrm-prepare command line options: help Feature: osrm-contract command line options: help
Background: Scenario: osrm-contract - Help should be shown when no options are passed
Given the profile "testbot" When I run "osrm-contract"
Scenario: osrm-prepare - Help should be shown when no options are passed
When I run "osrm-prepare"
Then stderr should be empty Then stderr should be empty
And stdout should contain "osrm-prepare <input.osrm> [options]:" And stdout should contain "osrm-contract <input.osrm> [options]:"
And stdout should contain "Options:" And stdout should contain "Options:"
And stdout should contain "--version" And stdout should contain "--version"
And stdout should contain "--help" And stdout should contain "--help"
And stdout should contain "Configuration:" And stdout should contain "Configuration:"
And stdout should contain "--profile"
And stdout should contain "--threads" And stdout should contain "--threads"
And stdout should contain "--core" And stdout should contain "--core"
And stdout should contain "--level-cache" And stdout should contain "--level-cache"
And stdout should contain "--segment-speed-file" And stdout should contain "--segment-speed-file"
And stdout should contain 18 lines And stdout should contain 17 lines
And it should exit with code 1 And it should exit with code 1
Scenario: osrm-prepare - Help, short Scenario: osrm-contract - Help, short
When I run "osrm-prepare -h" When I run "osrm-contract -h"
Then stderr should be empty Then stderr should be empty
And stdout should contain "osrm-prepare <input.osrm> [options]:" And stdout should contain "osrm-contract <input.osrm> [options]:"
And stdout should contain "Options:" And stdout should contain "Options:"
And stdout should contain "--version" And stdout should contain "--version"
And stdout should contain "--help" And stdout should contain "--help"
And stdout should contain "Configuration:" And stdout should contain "Configuration:"
And stdout should contain "--profile"
And stdout should contain "--threads" And stdout should contain "--threads"
And stdout should contain "--core" And stdout should contain "--core"
And stdout should contain "--level-cache" And stdout should contain "--level-cache"
And stdout should contain "--segment-speed-file" And stdout should contain "--segment-speed-file"
And stdout should contain 18 lines And stdout should contain 17 lines
And it should exit with code 0 And it should exit with code 0
Scenario: osrm-prepare - Help, long Scenario: osrm-contract - Help, long
When I run "osrm-prepare --help" When I run "osrm-contract --help"
Then stderr should be empty Then stderr should be empty
And stdout should contain "osrm-prepare <input.osrm> [options]:" And stdout should contain "osrm-contract <input.osrm> [options]:"
And stdout should contain "Options:" And stdout should contain "Options:"
And stdout should contain "--version" And stdout should contain "--version"
And stdout should contain "--help" And stdout should contain "--help"
And stdout should contain "Configuration:" And stdout should contain "Configuration:"
And stdout should contain "--profile"
And stdout should contain "--threads" And stdout should contain "--threads"
And stdout should contain "--core" And stdout should contain "--core"
And stdout should contain "--level-cache" And stdout should contain "--level-cache"
And stdout should contain "--segment-speed-file" And stdout should contain "--segment-speed-file"
And stdout should contain 18 lines And stdout should contain 17 lines
And it should exit with code 0 And it should exit with code 0

View File

@ -1,11 +1,11 @@
@prepare @options @invalid @prepare @options @invalid
Feature: osrm-prepare command line options: invalid options Feature: osrm-contract command line options: invalid options
Background: Background:
Given the profile "testbot" Given the profile "testbot"
Scenario: osrm-prepare - Non-existing option Scenario: osrm-contract - Non-existing option
When I run "osrm-prepare --fly-me-to-the-moon" When I run "osrm-contract --fly-me-to-the-moon"
Then stdout should be empty Then stdout should be empty
And stderr should contain "option" And stderr should contain "option"
And stderr should contain "fly-me-to-the-moon" And stderr should contain "fly-me-to-the-moon"

View File

@ -1,5 +1,5 @@
@prepare @options @version @prepare @options @version
Feature: osrm-prepare command line options: version Feature: osrm-contract command line options: version
# the regex will match these two formats: # the regex will match these two formats:
# v0.3.7.0 # this is the normal format when you build from a git clone # v0.3.7.0 # this is the normal format when you build from a git clone
# -128-NOTFOUND # if you build from a shallow clone (used on Travis) # -128-NOTFOUND # if you build from a shallow clone (used on Travis)
@ -7,15 +7,15 @@ Feature: osrm-prepare command line options: version
Background: Background:
Given the profile "testbot" Given the profile "testbot"
Scenario: osrm-prepare - Version, short Scenario: osrm-contract - Version, short
When I run "osrm-prepare --v" When I run "osrm-contract --v"
Then stderr should be empty Then stderr should be empty
And stdout should contain 1 line And stdout should contain 1 line
And stdout should contain /(v\d{1,2}\.\d{1,2}\.\d{1,2}|\w*-\d+-\w+)/ And stdout should contain /(v\d{1,2}\.\d{1,2}\.\d{1,2}|\w*-\d+-\w+)/
And it should exit with code 0 And it should exit with code 0
Scenario: osrm-prepare - Version, long Scenario: osrm-contract - Version, long
When I run "osrm-prepare --version" When I run "osrm-contract --version"
Then stderr should be empty Then stderr should be empty
And stdout should contain 1 line And stdout should contain 1 line
And stdout should contain /(v\d{1,2}\.\d{1,2}\.\d{1,2}|\w*-\d+-\w+)/ And stdout should contain /(v\d{1,2}\.\d{1,2}\.\d{1,2}|\w*-\d+-\w+)/

View File

@ -32,7 +32,7 @@ Feature: Raster - weights
Scenario: Weighting not based on raster sources Scenario: Weighting not based on raster sources
Given the profile "testbot" Given the profile "testbot"
When I run "osrm-extract {osm_base}.osm -p {profile}" When I run "osrm-extract {osm_base}.osm -p {profile}"
And I run "osrm-prepare {osm_base}.osm" And I run "osrm-contract {osm_base}.osm"
And I route I should get And I route I should get
| from | to | route | speed | | from | to | route | speed |
| a | b | ab | 36 km/h | | a | b | ab | 36 km/h |
@ -45,7 +45,7 @@ Feature: Raster - weights
Given the profile "rasterbot" Given the profile "rasterbot"
When I run "osrm-extract {osm_base}.osm -p {profile}" When I run "osrm-extract {osm_base}.osm -p {profile}"
Then stdout should contain "evaluating segment" Then stdout should contain "evaluating segment"
And I run "osrm-prepare {osm_base}.osm" And I run "osrm-contract {osm_base}.osm"
And I route I should get And I route I should get
| from | to | route | speed | | from | to | route | speed |
| a | b | ab | 8 km/h | | a | b | ab | 8 km/h |
@ -63,7 +63,7 @@ Feature: Raster - weights
Given the profile "rasterbot-interp" Given the profile "rasterbot-interp"
When I run "osrm-extract {osm_base}.osm -p {profile}" When I run "osrm-extract {osm_base}.osm -p {profile}"
Then stdout should contain "evaluating segment" Then stdout should contain "evaluating segment"
And I run "osrm-prepare {osm_base}.osm" And I run "osrm-contract {osm_base}.osm"
And I route I should get And I route I should get
| from | to | route | speed | | from | to | route | speed |
| a | b | ab | 8 km/h | | a | b | ab | 8 km/h |

View File

@ -10,8 +10,8 @@ When(/^I run "osrm\-extract\s?(.*?)"$/) do |options|
run_bin 'osrm-extract', options run_bin 'osrm-extract', options
end end
When(/^I run "osrm\-prepare\s?(.*?)"$/) do |options| When(/^I run "osrm\-contract\s?(.*?)"$/) do |options|
run_bin 'osrm-prepare', options run_bin 'osrm-contract', options
end end
When(/^I run "osrm\-datastore\s?(.*?)"$/) do |options| When(/^I run "osrm\-datastore\s?(.*?)"$/) do |options|

View File

@ -277,9 +277,9 @@ def prepare_data
Dir.chdir TEST_FOLDER do Dir.chdir TEST_FOLDER do
log_preprocess_info log_preprocess_info
log "== Preparing #{extracted_file}.osm...", :preprocess log "== Preparing #{extracted_file}.osm...", :preprocess
unless system "#{LOAD_LIBRARIES}#{BIN_PATH}/osrm-prepare #{extracted_file}.osrm --profile #{PROFILES_PATH}/#{@profile}.lua >>#{PREPROCESS_LOG_FILE} 2>&1" unless system "#{LOAD_LIBRARIES}#{BIN_PATH}/osrm-contract #{extracted_file}.osrm >>#{PREPROCESS_LOG_FILE} 2>&1"
log "*** Exited with code #{$?.exitstatus}.", :preprocess log "*** Exited with code #{$?.exitstatus}.", :preprocess
raise PrepareError.new $?.exitstatus, "osrm-prepare exited with code #{$?.exitstatus}." raise PrepareError.new $?.exitstatus, "osrm-contract exited with code #{$?.exitstatus}."
end end
begin begin
["osrm.hsgr","osrm.fileIndex","osrm.geometry","osrm.nodes","osrm.ramIndex","osrm.core","osrm.edges"].each do |file| ["osrm.hsgr","osrm.fileIndex","osrm.geometry","osrm.nodes","osrm.ramIndex","osrm.core","osrm.edges"].each do |file|

View File

@ -81,7 +81,7 @@ def verify_osrm_is_not_running
end end
def verify_existance_of_binaries def verify_existance_of_binaries
["osrm-extract", "osrm-prepare", "osrm-routed"].each do |bin| ["osrm-extract", "osrm-contract", "osrm-routed"].each do |bin|
unless File.exists? "#{BIN_PATH}/#{bin}#{EXE}" unless File.exists? "#{BIN_PATH}/#{bin}#{EXE}"
raise "*** #{BIN_PATH}/#{bin}#{EXE} is missing. Build failed?" raise "*** #{BIN_PATH}/#{bin}#{EXE} is missing. Build failed?"
end end

View File

@ -45,7 +45,7 @@ end
class PrepareError < OSRMError class PrepareError < OSRMError
def initialize code, msg def initialize code, msg
super 'osrm-prepare', code, msg, PREPROCESS_LOG_FILE, 3 super 'osrm-contract', code, msg, PREPROCESS_LOG_FILE, 3
end end
end end

View File

@ -37,7 +37,7 @@ def bin_extract_hash
end end
def bin_prepare_hash def bin_prepare_hash
@bin_prepare_hash ||= hash_of_files "#{BIN_PATH}/osrm-prepare#{EXE}" @bin_prepare_hash ||= hash_of_files "#{BIN_PATH}/osrm-contract#{EXE}"
end end
def bin_routed_hash def bin_routed_hash