Skip to content

Commit 4db1b7b

Browse files
committed
Implements Cucumber shared vs. static library detection, fixes #2999
1 parent 32c5f14 commit 4db1b7b

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

features/support/env.js

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,26 @@ module.exports = function () {
5151
} else {
5252
this.TERMSIGNAL = 'SIGTERM';
5353
this.EXE = '';
54-
// TODO autodetect if this was build with shared or static libraries
55-
this.LIB = process.env.BUILD_SHARED_LIBS && '.so' || '.a';
54+
55+
// heuristically detect .so/.a suffix
56+
this.LIB = null;
57+
58+
try {
59+
const dot_a = util.format('%s/libosrm%s', this.BIN_PATH, '.a');
60+
fs.accessSync(dot_a, fs.F_OK);
61+
this.LIB = '.a';
62+
} catch(e) { /*nop*/ }
63+
64+
try {
65+
const dot_so = util.format('%s/libosrm%s', this.BIN_PATH, '.so');
66+
fs.accessSync(dot_so, fs.F_OK);
67+
this.LIB = '.so';
68+
} catch(e) { /*nop*/ }
69+
70+
if (!this.LIB) {
71+
throw new Error('*** Unable to detect dynamic or static libosrm libraries');
72+
}
73+
5674
this.QQ = '';
5775
}
5876

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

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

7088
fs.exists(this.TEST_PATH, (exists) => {
7189
if (exists)

0 commit comments

Comments
 (0)