add log extracts if osrm-routed or osmosis fails during tests

This commit is contained in:
Emil Tin 2012-12-17 18:31:04 +01:00
parent 10513784c7
commit 604043e3d8
3 changed files with 12 additions and 4 deletions

View File

@ -177,7 +177,10 @@ def convert_osm_to_pbf
log_preprocess_info
log "== Converting #{@osm_file}.osm to protobuffer format...", :preprocess
unless system "osmosis --read-xml #{@osm_file}.osm --write-pbf #{@osm_file}.osm.pbf omitmetadata=true 1>>#{PREPROCESS_LOG_FILE} 2>>#{PREPROCESS_LOG_FILE}"
raise "Failed to convert to proto buffer format. Please see #{hash}.log for more info."
log_path = 'preprocessing.log'
log_lines = 30
tail = log_tail log_path,log_lines
raise OSRMError.new 'osmosis', $?.exitstatus, "*** Failed to convert .oms to .pbf. osmosis exited with code #{$?.exitstatus}. Last #{log_lines} lines from #{log_path}:\n#{tail}\n"
end
log '', :preprocess
end

View File

@ -24,7 +24,10 @@ class OSRMLauncher
wait_for_connection
end
rescue Timeout::Error
raise "*** Launching osrm-routed timed out."
log_path = 'osrm-routed.log'
log_lines = 3
tail = log_tail log_path,log_lines
raise OSRMError.new 'osrm-routed', nil, "*** Launching osrm-routed timed out. Last #{log_lines} lines from #{log_path}:\n#{tail}\n"
end
def shutdown
@ -33,7 +36,10 @@ class OSRMLauncher
end
rescue Timeout::Error
kill
raise "*** Shutting down osrm-routed timed out."
log_path = 'osrm-routed.log'
log_lines = 3
tail = log_tail log_path,log_lines
raise OSRMError.new 'osrm-routed', nil, "*** Shutting down osrm-routed timed out. Last #{log_lines} lines from #{log_path}:\n#{tail}\n"
end

View File

@ -7,7 +7,6 @@ DESTINATION_REACHED = 15 #OSRM instruction code
def request_path path
@query = path
log path
uri = URI.parse "#{HOST}/#{path}"
Timeout.timeout(REQUEST_TIMEOUT) do
Net::HTTP.get_response uri