Skip to content

Commit

Permalink
Support OS X custom dylib locations - improves on #1965
Browse files Browse the repository at this point in the history
  • Loading branch information
Dane Springmeyer committed May 24, 2016
1 parent 0587c5f commit 18c070e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
4 changes: 2 additions & 2 deletions features/support/launch_classes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
7 changes: 6 additions & 1 deletion scripts/timer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down
7 changes: 6 additions & 1 deletion test/data/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit 18c070e

Please sign in to comment.