Limit test names to 64 chars to avoid hitting windows MAX_PATH limit

also in the change this.child is reset to null in case of error.
This commit is contained in:
Michael Krasnyk 2017-01-24 13:33:43 +01:00 committed by Patrick Niklaus
parent 7deff5837c
commit e463733138
2 changed files with 8 additions and 4 deletions

View File

@ -78,9 +78,10 @@ class OSRMDirectLoader extends OSRMBaseLoader {
if (this.osrmIsRunning()) return callback(new Error("osrm-routed already running!")); if (this.osrmIsRunning()) return callback(new Error("osrm-routed already running!"));
this.child = this.scope.runBin('osrm-routed', util.format("%s -p %d", this.inputFile, this.scope.OSRM_PORT), this.scope.environment, (err) => { this.child = this.scope.runBin('osrm-routed', util.format("%s -p %d", this.inputFile, this.scope.OSRM_PORT), this.scope.environment, (err) => {
if (err && err.signal !== 'SIGINT') { if (err && err.signal !== 'SIGINT') {
throw new Error(util.format('osrm-routed %s: %s', errorReason(err), err.cmd)); this.child = null;
} throw new Error(util.format('osrm-routed %s: %s', errorReason(err), err.cmd));
}
}); });
callback(); callback();
} }
@ -116,6 +117,7 @@ class OSRMDatastoreLoader extends OSRMBaseLoader {
this.child = this.scope.runBin('osrm-routed', util.format('--shared-memory=1 -p %d', this.scope.OSRM_PORT), this.scope.environment, (err) => { this.child = this.scope.runBin('osrm-routed', util.format('--shared-memory=1 -p %d', this.scope.OSRM_PORT), this.scope.environment, (err) => {
if (err && err.signal !== 'SIGINT') { if (err && err.signal !== 'SIGINT') {
this.child = null;
throw new Error(util.format('osrm-routed %s: %s', errorReason(err), err.cmd)); throw new Error(util.format('osrm-routed %s: %s', errorReason(err), err.cmd));
} }
}); });

View File

@ -141,7 +141,9 @@ module.exports = function() {
// converts the scenario titles in file prefixes // converts the scenario titles in file prefixes
this.getScenarioID = (scenario) => { this.getScenarioID = (scenario) => {
let name = scenario.getName().toLowerCase().replace(/[\/\-'=,\(\):\*#]/g, '').replace(/\s/g, '_').replace(/__/g, '_').replace(/\.\./g, '.'); let name = scenario.getName().toLowerCase().replace(/[\/\-'=,\(\):\*#]/g, '')
.replace(/\s/g, '_').replace(/__/g, '_').replace(/\.\./g, '.')
.substring(0, 64);
return util.format('%d_%s', scenario.getLine(), name); return util.format('%d_%s', scenario.getLine(), name);
}; };