Renamed prepared -> contracted

This commit is contained in:
Patrick Niklaus 2016-03-04 16:12:10 +01:00
parent e595bdb20a
commit 92a06c9a28
12 changed files with 27 additions and 27 deletions

View File

@ -4,8 +4,8 @@ Feature: osrm-routed command line options: files
# For testing program options, the --trial option is used, which causes osrm-routed to quit # For testing program options, the --trial option is used, which causes osrm-routed to quit
# immediately after initialization. This makes testing easier and faster. # immediately after initialization. This makes testing easier and faster.
# #
# The {prepared_base} part of the options to osrm-routed will be expanded to the actual base path of # The {contracted_base} part of the options to osrm-routed will be expanded to the actual base path of
# the prepared input file. # the contracted input file.
# TODO # TODO
# Since we're not using osmr-datastore for all testing, osrm-routed is kept running. # Since we're not using osmr-datastore for all testing, osrm-routed is kept running.
@ -19,14 +19,14 @@ Feature: osrm-routed command line options: files
And the ways And the ways
| nodes | | nodes |
| ab | | ab |
And the data has been prepared And the data has been contracted
Scenario: osrm-routed - Passing base file Scenario: osrm-routed - Passing base file
When I run "osrm-routed {prepared_base}.osrm --trial" When I run "osrm-routed {contracted_base}.osrm --trial"
Then stdout should contain /^\[info\] starting up engines/ Then stdout should contain /^\[info\] starting up engines/
And stdout should contain /\d{1,2}\.\d{1,2}\.\d{1,2}/ And stdout should contain /\d{1,2}\.\d{1,2}\.\d{1,2}/
And stdout should contain /compiled at/ And stdout should contain /compiled at/
And stdout should contain /^\[info\] loaded plugin: viaroute/ And stdout should contain /^\[info\] loaded plugin: viaroute/
And stdout should contain /^\[info\] trial run/ And stdout should contain /^\[info\] trial run/
And stdout should contain /^\[info\] shutdown completed/ And stdout should contain /^\[info\] shutdown completed/
And it should exit with code 0 And it should exit with code 0

View File

@ -173,7 +173,7 @@ Given /^the data has been extracted$/ do
end end
end end
Given /^the data has been prepared$/ do Given /^the data has been contracted$/ do
begin begin
reprocess reprocess
rescue OSRMError => e rescue OSRMError => e

View File

@ -29,7 +29,7 @@ When /^I request a travel time matrix I should get$/ do |table|
reprocess reprocess
actual = [] actual = []
actual << table.headers actual << table.headers
OSRMLoader.load(self,"#{prepared_file}.osrm") do OSRMLoader.load(self,"#{contracted_file}.osrm") do
# compute matrix # compute matrix
params = @query_params params = @query_params

View File

@ -1,7 +1,7 @@
When /^I match I should get$/ do |table| When /^I match I should get$/ do |table|
reprocess reprocess
actual = [] actual = []
OSRMLoader.load(self,"#{prepared_file}.osrm") do OSRMLoader.load(self,"#{contracted_file}.osrm") do
table.hashes.each_with_index do |row,ri| table.hashes.each_with_index do |row,ri|
if row['request'] if row['request']
got = {'request' => row['request'] } got = {'request' => row['request'] }

View File

@ -1,7 +1,7 @@
When /^I request nearest I should get$/ do |table| When /^I request nearest I should get$/ do |table|
reprocess reprocess
actual = [] actual = []
OSRMLoader.load(self,"#{prepared_file}.osrm") do OSRMLoader.load(self,"#{contracted_file}.osrm") do
table.hashes.each_with_index do |row,ri| table.hashes.each_with_index do |row,ri|
in_node = find_node_by_name row['in'] in_node = find_node_by_name row['in']
raise "*** unknown in-node '#{row['in']}" unless in_node raise "*** unknown in-node '#{row['in']}" unless in_node

View File

@ -1,6 +1,6 @@
When /^I request \/(.*)$/ do |path| When /^I request \/(.*)$/ do |path|
reprocess reprocess
OSRMLoader.load(self,"#{prepared_file}.osrm") do OSRMLoader.load(self,"#{contracted_file}.osrm") do
@response = request_path path, [] @response = request_path path, []
end end
end end

View File

@ -44,7 +44,7 @@ Then /^routability should be$/ do |table|
if table.headers&["forw","backw","bothw"] == [] if table.headers&["forw","backw","bothw"] == []
raise "*** routability tabel must contain either 'forw', 'backw' or 'bothw' column" raise "*** routability tabel must contain either 'forw', 'backw' or 'bothw' column"
end end
OSRMLoader.load(self,"#{prepared_file}.osrm") do OSRMLoader.load(self,"#{contracted_file}.osrm") do
table.hashes.each_with_index do |row,i| table.hashes.each_with_index do |row,i|
output_row = row.dup output_row = row.dup
attempts = [] attempts = []

View File

@ -1,7 +1,7 @@
When /^I route I should get$/ do |table| When /^I route I should get$/ do |table|
reprocess reprocess
actual = [] actual = []
OSRMLoader.load(self,"#{prepared_file}.osrm") do OSRMLoader.load(self,"#{contracted_file}.osrm") do
table.hashes.each_with_index do |row,ri| table.hashes.each_with_index do |row,ri|
if row['request'] if row['request']
got = {'request' => row['request'] } got = {'request' => row['request'] }

View File

@ -1,7 +1,7 @@
When /^I plan a trip I should get$/ do |table| When /^I plan a trip I should get$/ do |table|
reprocess reprocess
actual = [] actual = []
OSRMLoader.load(self,"#{prepared_file}.osrm") do OSRMLoader.load(self,"#{contracted_file}.osrm") do
table.hashes.each_with_index do |row,ri| table.hashes.each_with_index do |row,ri|
if row['request'] if row['request']
got = {'request' => row['request'] } got = {'request' => row['request'] }

View File

@ -218,8 +218,8 @@ def extracted_file
@extracted_file ||= "#{osm_file}_#{fingerprint_extract}" @extracted_file ||= "#{osm_file}_#{fingerprint_extract}"
end end
def prepared_file def contracted_file
@prepared_file ||= "#{osm_file}_#{fingerprint_extract}_#{fingerprint_prepare}" @contracted_file ||= "#{osm_file}_#{fingerprint_extract}_#{fingerprint_prepare}"
end end
def write_osm def write_osm
@ -237,14 +237,14 @@ def extracted?
end end
end end
def prepared? def contracted?
Dir.chdir TEST_FOLDER do Dir.chdir TEST_FOLDER do
File.exist?("#{prepared_file}.osrm.hsgr") File.exist?("#{contracted_file}.osrm.hsgr")
end end
end end
def write_timestamp def write_timestamp
File.open( "#{prepared_file}.osrm.timestamp", 'w') {|f| f.write(OSM_TIMESTAMP) } File.open( "#{contracted_file}.osrm.timestamp", 'w') {|f| f.write(OSM_TIMESTAMP) }
end end
def write_input_data def write_input_data
@ -295,16 +295,16 @@ def prepare_data
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|
log "Renaming #{extracted_file}.#{file} to #{prepared_file}.#{file}", :preprocess log "Renaming #{extracted_file}.#{file} to #{contracted_file}.#{file}", :preprocess
File.rename "#{extracted_file}.#{file}", "#{prepared_file}.#{file}" File.rename "#{extracted_file}.#{file}", "#{contracted_file}.#{file}"
end end
rescue Exception => e rescue Exception => e
raise FileError.new nil, "failed to rename data file after preparing." raise FileError.new nil, "failed to rename data file after preparing."
end end
begin begin
["osrm.names","osrm.restrictions","osrm"].each do |file| ["osrm.names","osrm.restrictions","osrm"].each do |file|
log "Copying #{extracted_file}.#{file} to #{prepared_file}.#{file}", :preprocess log "Copying #{extracted_file}.#{file} to #{contracted_file}.#{file}", :preprocess
FileUtils.cp "#{extracted_file}.#{file}", "#{prepared_file}.#{file}" FileUtils.cp "#{extracted_file}.#{file}", "#{contracted_file}.#{file}"
end end
rescue Exception => e rescue Exception => e
raise FileError.new nil, "failed to copy data file after preparing." raise FileError.new nil, "failed to copy data file after preparing."
@ -316,6 +316,6 @@ end
def reprocess def reprocess
write_input_data write_input_data
extract_data unless extracted? extract_data unless extracted?
prepare_data unless prepared? prepare_data unless contracted?
log_preprocess_done log_preprocess_done
end end

View File

@ -12,9 +12,9 @@ def run_bin bin, options
opt.gsub! "{extracted_base}", "#{extracted_file}" opt.gsub! "{extracted_base}", "#{extracted_file}"
end end
if opt.include? '{prepared_base}' if opt.include? '{contracted_base}'
raise "*** {prepared_base} is missing" unless prepared_file raise "*** {contracted_base} is missing" unless contracted_file
opt.gsub! "{prepared_base}", "#{prepared_file}" opt.gsub! "{contracted_base}", "#{contracted_file}"
end end
if opt.include? '{profile}' if opt.include? '{profile}'
opt.gsub! "{profile}", "#{PROFILES_PATH}/#{@profile}.lua" opt.gsub! "{profile}", "#{PROFILES_PATH}/#{@profile}.lua"

View File

@ -11,7 +11,7 @@ Feature: Handle bad data in a graceful manner
Given the ways Given the ways
| nodes | | nodes |
When the data has been prepared When the data has been contracted
Then "osrm-extract" should return code 1 Then "osrm-extract" should return code 1
Scenario: Only dead-end oneways Scenario: Only dead-end oneways