osrm-backend/features/support/run.rb
2016-03-04 16:12:10 +01:00

29 lines
857 B
Ruby

def run_bin bin, options
Dir.chdir TEST_FOLDER do
opt = options.dup
if opt.include? '{osm_base}'
raise "*** {osm_base} is missing" unless osm_file
opt.gsub! "{osm_base}", "#{osm_file}"
end
if opt.include? '{extracted_base}'
raise "*** {extracted_base} is missing" unless extracted_file
opt.gsub! "{extracted_base}", "#{extracted_file}"
end
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"
end
cmd = "#{QQ}#{LOAD_LIBRARIES}#{BIN_PATH}/#{bin}#{EXE}#{QQ} #{opt} 2>error.log"
@stdout = `#{cmd}`
@stderr = File.read 'error.log'
@exit_code = $?.exitstatus
end
end