From 18c070e199b5ff10461c7e84aabdf3f186b5e228 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Tue, 24 May 2016 10:54:29 -0400 Subject: [PATCH] Support OS X custom dylib locations - improves on #1965 --- features/support/launch_classes.js | 4 ++-- scripts/timer.sh | 7 ++++++- test/data/Makefile | 7 ++++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/features/support/launch_classes.js b/features/support/launch_classes.js index 976f89eadc9..9231fcf2900 100644 --- a/features/support/launch_classes.js +++ b/features/support/launch_classes.js @@ -86,7 +86,7 @@ var OSRMDirectLoader = class extends OSRMBaseLoader { fs.appendFile(this.scope.OSRM_ROUTED_LOG_FILE, data, (err) => { if (err) throw err; }); }; - var child = spawn(util.format('%s%s/osrm-routed', this.scope.LOAD_LIBRARIES, this.scope.BIN_PATH), [this.inputFile, util.format('-p%d', this.scope.OSRM_PORT)]); + var child = spawn(util.format('%s/osrm-routed', this.scope.BIN_PATH), [this.inputFile, util.format('-p%d', this.scope.OSRM_PORT)]); this.scope.pid = child.pid; child.stdout.on('data', writeToLog); child.stderr.on('data', writeToLog); @@ -122,7 +122,7 @@ var OSRMDatastoreLoader = class extends OSRMBaseLoader { fs.appendFile(this.scope.OSRM_ROUTED_LOG_FILE, data, (err) => { if (err) throw err; }); }; - var child = spawn(util.format('%s%s/osrm-routed', this.scope.LOAD_LIBRARIES, this.scope.BIN_PATH), ['--shared-memory=1', util.format('-p%d', this.scope.OSRM_PORT)]); + var child = spawn(util.format('%s/osrm-routed', this.scope.BIN_PATH), ['--shared-memory=1', util.format('-p%d', this.scope.OSRM_PORT)]); this.child = child; this.scope.pid = child.pid; child.stdout.on('data', writeToLog); diff --git a/scripts/timer.sh b/scripts/timer.sh index 39d8e5b3429..a8ae6fde88c 100755 --- a/scripts/timer.sh +++ b/scripts/timer.sh @@ -4,7 +4,12 @@ TIMINGS_FILE=/tmp/osrm.timings NAME=$1 CMD=${@:2} START=$(date "+%s.%N") -/bin/bash -c "$CMD" +if [[ $(uname -s) == 'Darwin' ]] && [[ ${OSRM_SHARED_LIBRARY_PATH:-false} != false ]]; then + /bin/bash -c "DYLD_LIBRARY_PATH=${OSRM_SHARED_LIBRARY_PATH} $CMD" +else + /bin/bash -c "$CMD" +fi + END=$(date "+%s.%N") TIME="$(echo "$END - $START" | bc)s" NEW_ENTRY="$NAME\t$TIME\t$(date -Iseconds)" diff --git a/test/data/Makefile b/test/data/Makefile index 8684bc88575..883d1d862e7 100755 --- a/test/data/Makefile +++ b/test/data/Makefile @@ -11,6 +11,11 @@ POLY2REQ:=$(SCRIPT_ROOT)/poly2req.js TIMER:=$(SCRIPT_ROOT)/timer.sh PROFILE:=$(PROFILE_ROOT)/car.lua +LOAD_LIBRARIES:= +ifneq ($(OSRM_SHARED_LIBRARY_PATH),) + LOAD_LIBRARIES=DYLD_LIBRARY_PATH=$(OSRM_SHARED_LIBRARY_PATH) +endif + all: $(DATA_NAME).osrm.hsgr clean: @@ -36,7 +41,7 @@ $(DATA_NAME).requests: $(DATA_NAME).poly $(POLY2REQ) $(DATA_NAME).poly > $(DATA_NAME).requests osrm-routed.pid: $(DATA_NAME).osrm.hsgr - @/bin/sh -c '$(OSRM_ROUTED) $(DATA_NAME).osrm& echo "$$!" > osrm-routed.pid' + @/bin/sh -c '$(LOAD_LIBRARIES) $(OSRM_ROUTED) $(DATA_NAME).osrm& echo "$$!" > osrm-routed.pid' sleep 1 benchmark: $(DATA_NAME).requests osrm-routed.pid