From db06cdb4cedc960161dc32f37859d9d5c2e904f0 Mon Sep 17 00:00:00 2001 From: Emil Tin Date: Thu, 9 Oct 2014 14:30:06 +0200 Subject: [PATCH] adjust datastore testing --- features/support/data.rb | 2 +- features/support/launch.rb | 12 +----------- features/support/route.rb | 2 -- features/support/run.rb | 3 ++- features/testbot/bad.feature | 2 +- features/testbot/basic.feature | 2 +- features/testbot/bearing.feature | 2 +- features/testbot/bearing_param.feature | 2 +- features/testbot/compression.feature | 2 +- features/testbot/datastore.feature | 2 +- features/testbot/distance.feature | 2 +- features/testbot/fastest.feature | 2 +- features/testbot/geometry.feature | 2 +- features/testbot/graph.feature | 2 +- features/testbot/loop.feature | 2 +- features/testbot/origin.feature | 2 +- features/testbot/penalty.feature | 2 +- features/testbot/planetary.feature | 2 +- features/testbot/projection.feature | 2 +- features/testbot/protobuffer.feature | 2 +- features/testbot/snap.feature | 2 +- features/testbot/status.feature | 2 +- features/testbot/time.feature | 2 +- features/testbot/turns.feature | 2 +- features/testbot/utf.feature | 2 +- features/testbot/uturn.feature | 2 +- 26 files changed, 26 insertions(+), 37 deletions(-) diff --git a/features/support/data.rb b/features/support/data.rb index c09b763bd..76822811b 100644 --- a/features/support/data.rb +++ b/features/support/data.rb @@ -21,7 +21,7 @@ def input_format end def sanitized_scenario_title - @sanitized_scenario_title ||= @scenario_title.gsub /[^0-9A-Za-z.\-]/, '_' + @sanitized_scenario_title ||= @scenario_title.to_s.gsub /[^0-9A-Za-z.\-]/, '_' end def set_grid_size meters diff --git a/features/support/launch.rb b/features/support/launch.rb index 8a458da17..cf4c422de 100644 --- a/features/support/launch.rb +++ b/features/support/launch.rb @@ -23,9 +23,7 @@ class OSRMLoader end def self.load_data - puts "=== loading data with osrm-datastore" - log_time_and_run "#{BIN_PATH}/osrm-datastore --springclean" - log_time_and_run "#{BIN_PATH}/osrm-datastore #{@input_file}" + run_bin "osrm-datastore", @input_file end def self.launch @@ -50,7 +48,6 @@ class OSRMLoader if @@pid s = `ps -o state -p #{@@pid}`.split[1].to_s.strip up = (s =~ /^[DRST]/) != nil - # puts "=== osrm-routed, status pid #{@@pid}: #{s} (#{up ? 'up' : 'down'})" up else false @@ -59,15 +56,11 @@ class OSRMLoader def self.osrm_up return if self.osrm_up? - puts "=== launching osrm-routed" - log %[Process.spawn("#{BIN_PATH}/osrm-routed --sharedmemory=1 --port #{OSRM_PORT}",:out=>'#{OSRM_ROUTED_LOG_FILE}', :err=>'#{OSRM_ROUTED_LOG_FILE}')] @@pid = Process.spawn("#{BIN_PATH}/osrm-routed --sharedmemory=1 --port #{OSRM_PORT}",:out=>OSRM_ROUTED_LOG_FILE, :err=>OSRM_ROUTED_LOG_FILE) end def self.osrm_down if @@pid - puts '=== shutting down osrm' - log_time "Process.kill 'TERM', #{@@pid}" Process.kill 'TERM', @@pid self.wait_for_shutdown end @@ -75,8 +68,6 @@ class OSRMLoader def self.kill if @@pid - puts '=== killing osrm' - log_time "Process.kill 'KILL', @@pid" Process.kill 'KILL', @@pid end end @@ -84,7 +75,6 @@ class OSRMLoader def self.wait_for_connection while true begin - log_time "TCPSocket.new('127.0.0.1', OSRM_PORT)" socket = TCPSocket.new('127.0.0.1', OSRM_PORT) return rescue Errno::ECONNREFUSED diff --git a/features/support/route.rb b/features/support/route.rb index cf81d9e37..745edc0fd 100644 --- a/features/support/route.rb +++ b/features/support/route.rb @@ -18,7 +18,6 @@ def request_path path, waypoints=[], options={} uri = URI.parse ["#{HOST}/#{path}", params].compact.join('?') @query = uri.to_s Timeout.timeout(OSRM_TIMEOUT) do - log_time "Net::HTTP.get_response #{uri}" Net::HTTP.get_response uri end rescue Errno::ECONNREFUSED => e @@ -31,7 +30,6 @@ def request_url path uri = URI.parse"#{HOST}/#{path}" @query = uri.to_s Timeout.timeout(OSRM_TIMEOUT) do - log_time "Net::HTTP.get_response #{uri}" Net::HTTP.get_response uri end rescue Errno::ECONNREFUSED => e diff --git a/features/support/run.rb b/features/support/run.rb index 794050a32..1b52d6348 100644 --- a/features/support/run.rb +++ b/features/support/run.rb @@ -11,7 +11,8 @@ def run_bin bin, options opt.gsub! "{profile}", "#{PROFILES_PATH}/#{@profile}.lua" end - @stdout = `#{QQ}#{BIN_PATH}/#{bin}#{EXE}#{QQ} #{opt} 2>error.log` + cmd = "#{QQ}#{BIN_PATH}/#{bin}#{EXE}#{QQ} #{opt} 2>error.log" + @stdout = `#{cmd}` @stderr = File.read 'error.log' @exit_code = $?.exitstatus end diff --git a/features/testbot/bad.feature b/features/testbot/bad.feature index f0f3cfacc..d7e3c95af 100644 --- a/features/testbot/bad.feature +++ b/features/testbot/bad.feature @@ -1,4 +1,4 @@ -@routing @bad +@routing @bad @testbot Feature: Handle bad data in a graceful manner Background: diff --git a/features/testbot/basic.feature b/features/testbot/basic.feature index 41643193d..599b0628a 100644 --- a/features/testbot/basic.feature +++ b/features/testbot/basic.feature @@ -1,4 +1,4 @@ -@routing @basic +@routing @basic @testbot Feature: Basic Routing Background: diff --git a/features/testbot/bearing.feature b/features/testbot/bearing.feature index c306af92d..9b3dc4eb7 100644 --- a/features/testbot/bearing.feature +++ b/features/testbot/bearing.feature @@ -1,4 +1,4 @@ -@routing @bearing +@routing @bearing @testbot Feature: Compass bearing Background: diff --git a/features/testbot/bearing_param.feature b/features/testbot/bearing_param.feature index e9db87331..810f69038 100644 --- a/features/testbot/bearing_param.feature +++ b/features/testbot/bearing_param.feature @@ -1,4 +1,4 @@ -@routing @bearing_param @todo +@routing @bearing_param @todo @testbot Feature: Bearing parameter Background: diff --git a/features/testbot/compression.feature b/features/testbot/compression.feature index 12c1219a0..146ad63df 100644 --- a/features/testbot/compression.feature +++ b/features/testbot/compression.feature @@ -1,4 +1,4 @@ -@routing @graph +@routing @graph @testbot Feature: Geometry Compression Background: diff --git a/features/testbot/datastore.feature b/features/testbot/datastore.feature index 7814f3b47..568ae7aa4 100644 --- a/features/testbot/datastore.feature +++ b/features/testbot/datastore.feature @@ -1,4 +1,4 @@ -@routing @datastore +@routing @datastore @testbot Feature: Temporary tests related to osrm-datastore Background: diff --git a/features/testbot/distance.feature b/features/testbot/distance.feature index f9f166bd7..1f777d24f 100644 --- a/features/testbot/distance.feature +++ b/features/testbot/distance.feature @@ -1,4 +1,4 @@ -@routing @distance +@routing @distance @testbot Feature: Distance calculation Background: diff --git a/features/testbot/fastest.feature b/features/testbot/fastest.feature index 9a5cf24a3..8c24a5334 100644 --- a/features/testbot/fastest.feature +++ b/features/testbot/fastest.feature @@ -1,4 +1,4 @@ -@routing @fastest +@routing @fastest @testbot Feature: Choosing fastest route Background: diff --git a/features/testbot/geometry.feature b/features/testbot/geometry.feature index 553af9393..8b38c06f8 100644 --- a/features/testbot/geometry.feature +++ b/features/testbot/geometry.feature @@ -1,4 +1,4 @@ -@routing +@routing @testbot Feature: Retrieve geometry Background: Use some profile diff --git a/features/testbot/graph.feature b/features/testbot/graph.feature index a870106dc..aa75da339 100644 --- a/features/testbot/graph.feature +++ b/features/testbot/graph.feature @@ -1,4 +1,4 @@ -@routing @graph +@routing @graph @testbot Feature: Basic Routing #Test the input data descibed on https://github.com/DennisOSRM/Project-OSRM/wiki/Graph-representation diff --git a/features/testbot/loop.feature b/features/testbot/loop.feature index ac9ae30ff..fe898ecf0 100644 --- a/features/testbot/loop.feature +++ b/features/testbot/loop.feature @@ -1,4 +1,4 @@ -@routing @726 +@routing @726 @testbot Feature: Avoid weird loops caused by rounding errors Background: diff --git a/features/testbot/origin.feature b/features/testbot/origin.feature index c43e04e61..b5b194502 100644 --- a/features/testbot/origin.feature +++ b/features/testbot/origin.feature @@ -1,4 +1,4 @@ -@routing @origin +@routing @origin @testbot Feature: Routing close to the [0,0] origin Background: diff --git a/features/testbot/penalty.feature b/features/testbot/penalty.feature index 85f43c7ed..e4f3cb632 100644 --- a/features/testbot/penalty.feature +++ b/features/testbot/penalty.feature @@ -1,4 +1,4 @@ -@routing @penalty @signal +@routing @penalty @signal @testbot Feature: Penalties # Testbot uses a signal penalty of 7s. diff --git a/features/testbot/planetary.feature b/features/testbot/planetary.feature index f2ba21e88..19925fe27 100644 --- a/features/testbot/planetary.feature +++ b/features/testbot/planetary.feature @@ -1,4 +1,4 @@ -@routing @planetary +@routing @planetary @testbot Feature: Distance calculation Scenario: Approximated Longitudinal distances at equator diff --git a/features/testbot/projection.feature b/features/testbot/projection.feature index ed2f2fcc4..d7a0b8993 100644 --- a/features/testbot/projection.feature +++ b/features/testbot/projection.feature @@ -1,4 +1,4 @@ -@routing @projection +@routing @projection @testbot Feature: Projection to nearest point on road # Waypoints are projected perpendiculary onto the closest road diff --git a/features/testbot/protobuffer.feature b/features/testbot/protobuffer.feature index a77ff34a6..e32de26c2 100644 --- a/features/testbot/protobuffer.feature +++ b/features/testbot/protobuffer.feature @@ -1,4 +1,4 @@ -@routing @pbf +@routing @pbf @testbot Feature: Importing protobuffer (.pbf) format # Test normally read .osm, which is faster than .pbf files, # since we don't need to use osmosis to first convert to .pbf diff --git a/features/testbot/snap.feature b/features/testbot/snap.feature index c8a04bfd7..bee75bc44 100644 --- a/features/testbot/snap.feature +++ b/features/testbot/snap.feature @@ -1,4 +1,4 @@ -@routing @snap +@routing @snap @testbot Feature: Snap start/end point to the nearest way Background: diff --git a/features/testbot/status.feature b/features/testbot/status.feature index 4fa15ebb3..1b12b33ea 100644 --- a/features/testbot/status.feature +++ b/features/testbot/status.feature @@ -1,4 +1,4 @@ -@routing @status +@routing @status @testbot Feature: Status messages Background: diff --git a/features/testbot/time.feature b/features/testbot/time.feature index e0ccc3760..c838796f2 100644 --- a/features/testbot/time.feature +++ b/features/testbot/time.feature @@ -1,4 +1,4 @@ -@routing @time +@routing @time @testbot Feature: Estimation of travel time # Testbot speeds: # Primary road: 36km/h = 36000m/3600s = 100m/10s diff --git a/features/testbot/turns.feature b/features/testbot/turns.feature index 87bf21f55..6eba4f9e9 100644 --- a/features/testbot/turns.feature +++ b/features/testbot/turns.feature @@ -1,4 +1,4 @@ -@routing @turns +@routing @turns @testbot Feature: Turn directions/codes Background: diff --git a/features/testbot/utf.feature b/features/testbot/utf.feature index e9d324c1b..d979e9f92 100644 --- a/features/testbot/utf.feature +++ b/features/testbot/utf.feature @@ -1,4 +1,4 @@ -@routing @utf +@routing @utf @testbot Feature: Handling of UTF characters Background: diff --git a/features/testbot/uturn.feature b/features/testbot/uturn.feature index aa81fc284..943796e69 100644 --- a/features/testbot/uturn.feature +++ b/features/testbot/uturn.feature @@ -1,4 +1,4 @@ -@routing @uturn @via +@routing @uturn @via @testbot Feature: U-turns at via points Background: