fix tests that use {base} expansion

This commit is contained in:
Emil Tin 2014-10-17 14:48:52 +02:00
parent 48333f73d5
commit cc3646ca16
4 changed files with 22 additions and 13 deletions

View File

@ -1,7 +1,7 @@
@extract @options @files @extract @options @files
Feature: osrm-extract command line options: files Feature: osrm-extract command line options: files
# expansions: # expansions:
# {base} => path to current input file # {osm_base} => path to current input file
# {profile} => path to current profile script # {profile} => path to current profile script
Background: Background:
@ -14,12 +14,12 @@ Feature: osrm-extract command line options: files
And the data has been saved to disk And the data has been saved to disk
Scenario: osrm-extract - Passing base file Scenario: osrm-extract - Passing base file
When I run "osrm-extract {base}.osm --profile {profile}" When I run "osrm-extract {osm_base}.osm --profile {profile}"
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-extract - Order of options should not matter Scenario: osrm-extract - Order of options should not matter
When I run "osrm-extract --profile {profile} {base}.osm" When I run "osrm-extract --profile {profile} {osm_base}.osm"
Then stderr should be empty Then stderr should be empty
And it should exit with code 0 And it should exit with code 0

View File

@ -1,7 +1,7 @@
@prepare @options @files @prepare @options @files
Feature: osrm-prepare command line options: files Feature: osrm-prepare command line options: files
# expansions: # expansions:
# {base} => path to current input file # {extracted_base} => path to current extracted input file
# {profile} => path to current profile script # {profile} => path to current profile script
Background: Background:
@ -14,12 +14,12 @@ Feature: osrm-prepare command line options: files
And the data has been extracted And the data has been extracted
Scenario: osrm-prepare - Passing base file Scenario: osrm-prepare - Passing base file
When I run "osrm-prepare {base}.osrm --profile {profile}" When I run "osrm-prepare {extracted_base}.osrm --profile {profile}"
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-prepare - Order of options should not matter
When I run "osrm-prepare --profile {profile} {base}.osrm" When I run "osrm-prepare --profile {profile} {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

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 {base} part of the options to osrm-routed will be expanded to the actual base path of # The {prepared_base} part of the options to osrm-routed will be expanded to the actual base path of
# the preprocessed file. # the prepared 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.
@ -22,7 +22,7 @@ Feature: osrm-routed command line options: files
And the data has been prepared And the data has been prepared
Scenario: osrm-routed - Passing base file Scenario: osrm-routed - Passing base file
When I run "osrm-routed {base}.osrm --trial" When I run "osrm-routed {prepared_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/

View File

@ -1,12 +1,21 @@
def run_bin bin, options def run_bin bin, options
Dir.chdir TEST_FOLDER do Dir.chdir TEST_FOLDER do
opt = options.dup opt = options.dup
if opt.include? '{base}' if opt.include? '{osm_base}'
raise "*** {base} is missing" unless prepared_file raise "*** {osm_base} is missing" unless osm_file
opt.gsub! "{base}", "#{prepared_file}" opt.gsub! "{osm_base}", "#{osm_file}"
end end
if opt.include? '{extracted_base}'
raise "*** {extracted_base} is missing" unless extracted_file
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}"
end
if opt.include? '{profile}' if opt.include? '{profile}'
opt.gsub! "{profile}", "#{PROFILES_PATH}/#{@profile}.lua" opt.gsub! "{profile}", "#{PROFILES_PATH}/#{@profile}.lua"
end end