From 085bab749f0ba6f04e78ffa8ae4f6d499d7e7d19 Mon Sep 17 00:00:00 2001 From: Patrick Niklaus Date: Sun, 14 Feb 2016 19:35:37 +0100 Subject: [PATCH] osrm-prepare -> osrm-contract --- CMakeLists.txt | 8 ++--- .../{prepare => contract}/files.feature | 15 +++------ .../{prepare => contract}/help.feature | 32 ++++++++----------- .../{prepare => contract}/invalid.feature | 6 ++-- .../{prepare => contract}/version.feature | 10 +++--- features/raster/weights.feature | 6 ++-- features/step_definitions/options.rb | 4 +-- features/support/data.rb | 4 +-- features/support/env.rb | 2 +- features/support/exceptions.rb | 2 +- features/support/hash.rb | 2 +- features/support/run.rb | 2 +- 12 files changed, 41 insertions(+), 52 deletions(-) rename features/options/{prepare => contract}/files.feature (52%) rename features/options/{prepare => contract}/help.feature (61%) rename features/options/{prepare => contract}/invalid.feature (60%) rename features/options/{prepare => contract}/version.feature (74%) diff --git a/CMakeLists.txt b/CMakeLists.txt index efc6d36bb..f95c6b201 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,7 +76,7 @@ add_dependencies(UTIL FingerPrintConfigure) set_target_properties(UTIL PROPERTIES LINKER_LANGUAGE CXX) 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 $ $) add_executable(osrm-datastore src/tools/store.cpp $) add_library(osrm src/osrm/osrm.cpp $ $) @@ -287,7 +287,7 @@ endif() # Binaries target_link_libraries(osrm-datastore osrm_store ${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}) set(EXTRACTOR_LIBRARIES @@ -372,7 +372,7 @@ endif() # (i.e., from /usr/local/bin/) the linker can find library dependencies. For # 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-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-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 ${VariantGlob} DESTINATION include/variant) 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-routed DESTINATION bin) install(TARGETS osrm DESTINATION lib) diff --git a/features/options/prepare/files.feature b/features/options/contract/files.feature similarity index 52% rename from features/options/prepare/files.feature rename to features/options/contract/files.feature index 6e82a6b1b..5e50e14f2 100644 --- a/features/options/prepare/files.feature +++ b/features/options/contract/files.feature @@ -1,5 +1,5 @@ @prepare @options @files -Feature: osrm-prepare command line options: files +Feature: osrm-contract command line options: files # expansions: # {extracted_base} => path to current extracted input file # {profile} => path to current profile script @@ -13,18 +13,13 @@ Feature: osrm-prepare command line options: files | ab | And the data has been extracted - Scenario: osrm-prepare - Passing base file - When I run "osrm-prepare {extracted_base}.osrm --profile {profile}" + Scenario: osrm-contract - Passing base file + When I run "osrm-contract {extracted_base}.osrm" Then stderr should be empty And it should exit with code 0 - Scenario: osrm-prepare - Order of options should not matter - When I run "osrm-prepare --profile {profile} {extracted_base}.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}" + Scenario: osrm-contract - Missing input file + When I run "osrm-contract over-the-rainbow.osrm" And stderr should contain "over-the-rainbow.osrm" And stderr should contain "not found" And it should exit with code 1 diff --git a/features/options/prepare/help.feature b/features/options/contract/help.feature similarity index 61% rename from features/options/prepare/help.feature rename to features/options/contract/help.feature index 6d19dcbeb..4079efcbe 100644 --- a/features/options/prepare/help.feature +++ b/features/options/contract/help.feature @@ -1,53 +1,47 @@ @prepare @options @help -Feature: osrm-prepare command line options: help +Feature: osrm-contract command line options: help - Background: - Given the profile "testbot" - - Scenario: osrm-prepare - Help should be shown when no options are passed - When I run "osrm-prepare" + Scenario: osrm-contract - Help should be shown when no options are passed + When I run "osrm-contract" Then stderr should be empty - And stdout should contain "osrm-prepare [options]:" + And stdout should contain "osrm-contract [options]:" And stdout should contain "Options:" And stdout should contain "--version" And stdout should contain "--help" And stdout should contain "Configuration:" - And stdout should contain "--profile" And stdout should contain "--threads" And stdout should contain "--core" And stdout should contain "--level-cache" 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 - Scenario: osrm-prepare - Help, short - When I run "osrm-prepare -h" + Scenario: osrm-contract - Help, short + When I run "osrm-contract -h" Then stderr should be empty - And stdout should contain "osrm-prepare [options]:" + And stdout should contain "osrm-contract [options]:" And stdout should contain "Options:" And stdout should contain "--version" And stdout should contain "--help" And stdout should contain "Configuration:" - And stdout should contain "--profile" And stdout should contain "--threads" And stdout should contain "--core" And stdout should contain "--level-cache" 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 - Scenario: osrm-prepare - Help, long - When I run "osrm-prepare --help" + Scenario: osrm-contract - Help, long + When I run "osrm-contract --help" Then stderr should be empty - And stdout should contain "osrm-prepare [options]:" + And stdout should contain "osrm-contract [options]:" And stdout should contain "Options:" And stdout should contain "--version" And stdout should contain "--help" And stdout should contain "Configuration:" - And stdout should contain "--profile" And stdout should contain "--threads" And stdout should contain "--core" And stdout should contain "--level-cache" 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 diff --git a/features/options/prepare/invalid.feature b/features/options/contract/invalid.feature similarity index 60% rename from features/options/prepare/invalid.feature rename to features/options/contract/invalid.feature index 7450390a8..38ee3ace9 100644 --- a/features/options/prepare/invalid.feature +++ b/features/options/contract/invalid.feature @@ -1,11 +1,11 @@ @prepare @options @invalid -Feature: osrm-prepare command line options: invalid options +Feature: osrm-contract command line options: invalid options Background: Given the profile "testbot" - Scenario: osrm-prepare - Non-existing option - When I run "osrm-prepare --fly-me-to-the-moon" + Scenario: osrm-contract - Non-existing option + When I run "osrm-contract --fly-me-to-the-moon" Then stdout should be empty And stderr should contain "option" And stderr should contain "fly-me-to-the-moon" diff --git a/features/options/prepare/version.feature b/features/options/contract/version.feature similarity index 74% rename from features/options/prepare/version.feature rename to features/options/contract/version.feature index 7a821c626..be99bbed1 100644 --- a/features/options/prepare/version.feature +++ b/features/options/contract/version.feature @@ -1,5 +1,5 @@ @prepare @options @version -Feature: osrm-prepare command line options: version +Feature: osrm-contract command line options: version # the regex will match these two formats: # 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) @@ -7,15 +7,15 @@ Feature: osrm-prepare command line options: version Background: Given the profile "testbot" - Scenario: osrm-prepare - Version, short - When I run "osrm-prepare --v" + Scenario: osrm-contract - Version, short + When I run "osrm-contract --v" Then stderr should be empty And stdout should contain 1 line And stdout should contain /(v\d{1,2}\.\d{1,2}\.\d{1,2}|\w*-\d+-\w+)/ And it should exit with code 0 - Scenario: osrm-prepare - Version, long - When I run "osrm-prepare --version" + Scenario: osrm-contract - Version, long + When I run "osrm-contract --version" Then stderr should be empty And stdout should contain 1 line And stdout should contain /(v\d{1,2}\.\d{1,2}\.\d{1,2}|\w*-\d+-\w+)/ diff --git a/features/raster/weights.feature b/features/raster/weights.feature index 1d521d076..ade8458f5 100644 --- a/features/raster/weights.feature +++ b/features/raster/weights.feature @@ -32,7 +32,7 @@ Feature: Raster - weights Scenario: Weighting not based on raster sources Given the profile "testbot" 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 | from | to | route | speed | | a | b | ab | 36 km/h | @@ -45,7 +45,7 @@ Feature: Raster - weights Given the profile "rasterbot" When I run "osrm-extract {osm_base}.osm -p {profile}" 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 | from | to | route | speed | | a | b | ab | 8 km/h | @@ -63,7 +63,7 @@ Feature: Raster - weights Given the profile "rasterbot-interp" When I run "osrm-extract {osm_base}.osm -p {profile}" 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 | from | to | route | speed | | a | b | ab | 8 km/h | diff --git a/features/step_definitions/options.rb b/features/step_definitions/options.rb index 62329d514..6a033803d 100644 --- a/features/step_definitions/options.rb +++ b/features/step_definitions/options.rb @@ -10,8 +10,8 @@ When(/^I run "osrm\-extract\s?(.*?)"$/) do |options| run_bin 'osrm-extract', options end -When(/^I run "osrm\-prepare\s?(.*?)"$/) do |options| - run_bin 'osrm-prepare', options +When(/^I run "osrm\-contract\s?(.*?)"$/) do |options| + run_bin 'osrm-contract', options end When(/^I run "osrm\-datastore\s?(.*?)"$/) do |options| diff --git a/features/support/data.rb b/features/support/data.rb index 7fc31dc68..c0f46967e 100644 --- a/features/support/data.rb +++ b/features/support/data.rb @@ -277,9 +277,9 @@ def prepare_data Dir.chdir TEST_FOLDER do log_preprocess_info 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 - raise PrepareError.new $?.exitstatus, "osrm-prepare exited with code #{$?.exitstatus}." + raise PrepareError.new $?.exitstatus, "osrm-contract exited with code #{$?.exitstatus}." end begin ["osrm.hsgr","osrm.fileIndex","osrm.geometry","osrm.nodes","osrm.ramIndex","osrm.core","osrm.edges"].each do |file| diff --git a/features/support/env.rb b/features/support/env.rb index 35d23eccb..80bda262d 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -81,7 +81,7 @@ def verify_osrm_is_not_running end 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}" raise "*** #{BIN_PATH}/#{bin}#{EXE} is missing. Build failed?" end diff --git a/features/support/exceptions.rb b/features/support/exceptions.rb index d04dc385c..e3d37b30a 100644 --- a/features/support/exceptions.rb +++ b/features/support/exceptions.rb @@ -45,7 +45,7 @@ end class PrepareError < OSRMError def initialize code, msg - super 'osrm-prepare', code, msg, PREPROCESS_LOG_FILE, 3 + super 'osrm-contract', code, msg, PREPROCESS_LOG_FILE, 3 end end diff --git a/features/support/hash.rb b/features/support/hash.rb index 6980b6645..cfc1fe758 100644 --- a/features/support/hash.rb +++ b/features/support/hash.rb @@ -37,7 +37,7 @@ def bin_extract_hash end 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 def bin_routed_hash diff --git a/features/support/run.rb b/features/support/run.rb index 4c77adfcb..5f86a9ecb 100644 --- a/features/support/run.rb +++ b/features/support/run.rb @@ -25,4 +25,4 @@ def run_bin bin, options @stderr = File.read 'error.log' @exit_code = $?.exitstatus end -end \ No newline at end of file +end