Skip to content

Commit

Permalink
Implements Cucumber shared vs. static library detection, fixes #2999
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-j-h committed Oct 4, 2016
1 parent 32c5f14 commit 4db1b7b
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions features/support/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,26 @@ module.exports = function () {
} else {
this.TERMSIGNAL = 'SIGTERM';
this.EXE = '';
// TODO autodetect if this was build with shared or static libraries
this.LIB = process.env.BUILD_SHARED_LIBS && '.so' || '.a';

// heuristically detect .so/.a suffix
this.LIB = null;

try {
const dot_a = util.format('%s/libosrm%s', this.BIN_PATH, '.a');
fs.accessSync(dot_a, fs.F_OK);
this.LIB = '.a';
} catch(e) { /*nop*/ }

try {
const dot_so = util.format('%s/libosrm%s', this.BIN_PATH, '.so');
fs.accessSync(dot_so, fs.F_OK);
this.LIB = '.so';
} catch(e) { /*nop*/ }

if (!this.LIB) {
throw new Error('*** Unable to detect dynamic or static libosrm libraries');
}

this.QQ = '';
}

Expand All @@ -65,7 +83,7 @@ module.exports = function () {

// eslint-disable-next-line no-console
console.info(util.format('Node Version', process.version));
if (parseInt(process.version.match(/v(\d)/)[1]) < 4) throw new Error('*** PLease upgrade to Node 4.+ to run OSRM cucumber tests');
if (parseInt(process.version.match(/v(\d)/)[1]) < 4) throw new Error('*** Please upgrade to Node 4.+ to run OSRM cucumber tests');

fs.exists(this.TEST_PATH, (exists) => {
if (exists)
Expand Down

0 comments on commit 4db1b7b

Please sign in to comment.