osrm-backend/features/support/run.rb
Dane Springmeyer 6eebb1c089 Support passing OSRM_SHARED_LIBRARY_PATH env variable for cucumber tests
The need for this is that:

  - On OS X if libraries are stored in custom locations (not /usr/lib or /usr/local)
    and they do not embed an rpath (which is common to not have) then the developer
    needs to set DYLD_LIBRARY_PATH to ensure that osrm tools can find dependent libraries
    at runtime (this is normal and common).
  - But as of OS X > 10.11 DYLD_LIBRARY_PATH no longer is inherited. While it works in
    the main shell when running a command like `osrm-extract` you will find that when
    `osrm-extract` is run by cucumber (ruby child process) then DYLD_LIBRARY_PATH
    is blocked and the command cannot start.
  - So, this introduces the ability to pass in a variable that the cucumber tests will
    understand and can manually forward along to ensure that DYLD_LIBRARY_PATH is respected
    where it counts.

The intended usage of this is therefore:

    # set the environment variable
    export OSRM_SHARED_LIBRARY_PATH=${DYLD_LIBRARY_PATH}
    # then run cucumber tests
    cucumber -p verify
2016-02-11 02:43:51 +01:00

28 lines
846 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? '{prepared_base}'
raise "*** {prepared_base} is missing" unless prepared_file
opt.gsub! "{prepared_base}", "#{prepared_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