2012-12-15 06:34:53 -05:00
|
|
|
require 'rspec/expectations'
|
|
|
|
|
|
|
|
DEFAULT_PORT = 5000
|
2014-03-31 10:05:09 -04:00
|
|
|
DEFAULT_TIMEOUT = 2
|
2012-12-16 13:45:26 -05:00
|
|
|
|
2014-04-21 09:24:42 -04:00
|
|
|
ROOT_FOLDER = Dir.pwd
|
|
|
|
OSM_USER = 'osrm'
|
|
|
|
OSM_GENERATOR = 'osrm-test'
|
|
|
|
OSM_UID = 1
|
|
|
|
TEST_FOLDER = File.join ROOT_FOLDER, 'test'
|
|
|
|
DATA_FOLDER = 'cache'
|
2014-07-31 10:41:38 -04:00
|
|
|
OSM_TIMESTAMP = '2000-01-01T00:00:00Z'
|
2014-04-21 09:24:42 -04:00
|
|
|
DEFAULT_SPEEDPROFILE = 'bicycle'
|
|
|
|
WAY_SPACING = 100
|
|
|
|
DEFAULT_GRID_SIZE = 100 #meters
|
|
|
|
PROFILES_PATH = File.join ROOT_FOLDER, 'profiles'
|
|
|
|
BIN_PATH = File.join ROOT_FOLDER, 'build'
|
|
|
|
DEFAULT_INPUT_FORMAT = 'osm'
|
|
|
|
DEFAULT_ORIGIN = [1,1]
|
2014-01-24 15:14:38 -05:00
|
|
|
LAUNCH_TIMEOUT = 1
|
|
|
|
SHUTDOWN_TIMEOUT = 10
|
|
|
|
|
|
|
|
|
|
|
|
def log_time_and_run cmd
|
|
|
|
log_time cmd
|
|
|
|
`#{cmd}`
|
|
|
|
end
|
|
|
|
|
|
|
|
def log_time cmd
|
|
|
|
puts "[#{Time.now.strftime('%Y-%m-%d %H:%M:%S:%L')}] #{cmd}"
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2014-04-21 09:24:42 -04:00
|
|
|
|
|
|
|
|
2012-12-16 13:45:26 -05:00
|
|
|
puts "Ruby version #{RUBY_VERSION}"
|
2013-08-02 03:34:58 -04:00
|
|
|
unless RUBY_VERSION.to_f >= 1.9
|
2012-12-16 13:45:26 -05:00
|
|
|
raise "*** Please upgrade to Ruby 1.9.x to run the OSRM cucumber tests"
|
|
|
|
end
|
|
|
|
|
2012-12-15 06:34:53 -05:00
|
|
|
if ENV["OSRM_PORT"]
|
|
|
|
OSRM_PORT = ENV["OSRM_PORT"].to_i
|
|
|
|
puts "Port set to #{OSRM_PORT}"
|
|
|
|
else
|
|
|
|
OSRM_PORT = DEFAULT_PORT
|
|
|
|
puts "Using default port #{OSRM_PORT}"
|
2012-12-16 13:45:26 -05:00
|
|
|
end
|
|
|
|
|
2014-03-31 10:05:09 -04:00
|
|
|
if ENV["OSRM_TIMEOUT"]
|
|
|
|
OSRM_TIMEOUT = ENV["OSRM_TIMEOUT"].to_i
|
|
|
|
puts "Timeout set to #{OSRM_TIMEOUT}"
|
|
|
|
else
|
|
|
|
OSRM_TIMEOUT = DEFAULT_TIMEOUT
|
|
|
|
puts "Using default timeout #{OSRM_TIMEOUT}"
|
|
|
|
end
|
|
|
|
|
2014-04-21 09:24:42 -04:00
|
|
|
unless File.exists? TEST_FOLDER
|
|
|
|
raise "*** Test folder #{TEST_FOLDER} doesn't exist."
|
|
|
|
end
|
|
|
|
|
2014-04-30 04:30:51 -04:00
|
|
|
if ENV['OS']=~/Windows.*/ then
|
|
|
|
EXE='.exe'
|
|
|
|
QQ='"'
|
|
|
|
else
|
|
|
|
EXE=''
|
|
|
|
QQ=''
|
|
|
|
end
|
2014-03-27 05:37:04 -04:00
|
|
|
|
|
|
|
AfterConfiguration do |config|
|
|
|
|
clear_log_files
|
2014-07-31 10:41:38 -04:00
|
|
|
end
|
2014-01-24 15:14:38 -05:00
|
|
|
|
|
|
|
at_exit do
|
|
|
|
OSRMLoader.shutdown
|
|
|
|
end
|