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
# 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 prepared input file.
# The {contracted_base} part of the options to osrm-routed will be expanded to the actual base path of
# the contracted input file.
# TODO
# 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
| nodes |
| ab |
And the data has been prepared
And the data has been contracted
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/
And stdout should contain /\d{1,2}\.\d{1,2}\.\d{1,2}/
And stdout should contain /compiled at/
And stdout should contain /^\[info\] loaded plugin: viaroute/
And stdout should contain /^\[info\] trial run/
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
Given /^the data has been prepared$/ do
Given /^the data has been contracted$/ do
begin
reprocess
rescue OSRMError => e

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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