Enable npm and library tests on windows
This commit is contained in:
parent
bd2a5ebe10
commit
f48bbb78de
@ -10,10 +10,10 @@ ECHO NUMBER_OF_PROCESSORS^: %NUMBER_OF_PROCESSORS%
|
|||||||
ECHO cmake^: && cmake --version
|
ECHO cmake^: && cmake --version
|
||||||
IF %ERRORLEVEL% NEQ 0 ECHO CMAKE not found && GOTO CMAKE_NOT_OK
|
IF %ERRORLEVEL% NEQ 0 ECHO CMAKE not found && GOTO CMAKE_NOT_OK
|
||||||
|
|
||||||
cmake --version | findstr /C:"3.7.0" && GOTO CMAKE_OK
|
cmake --version | findstr /C:"3.7.1" && GOTO CMAKE_OK
|
||||||
|
|
||||||
:CMAKE_NOT_OK
|
:CMAKE_NOT_OK
|
||||||
SET CMAKE_VERSION=3.7.0-rc2
|
SET CMAKE_VERSION=3.7.1
|
||||||
ECHO CMAKE NOT OK - downloading new CMake %CMAKE_VERSION%
|
ECHO CMAKE NOT OK - downloading new CMake %CMAKE_VERSION%
|
||||||
IF NOT EXIST cm.zip powershell Invoke-WebRequest https://cmake.org/files/v3.7/cmake-%CMAKE_VERSION%-win32-x86.zip -OutFile $env:PROJECT_DIR\cm.zip
|
IF NOT EXIST cm.zip powershell Invoke-WebRequest https://cmake.org/files/v3.7/cmake-%CMAKE_VERSION%-win32-x86.zip -OutFile $env:PROJECT_DIR\cm.zip
|
||||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||||
@ -119,16 +119,27 @@ SET PATH=%PROJECT_DIR%\osrm-deps\libs\bin;%PATH%
|
|||||||
ECHO running extractor-tests.exe ...
|
ECHO running extractor-tests.exe ...
|
||||||
unit_tests\%Configuration%\extractor-tests.exe
|
unit_tests\%Configuration%\extractor-tests.exe
|
||||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||||
|
|
||||||
ECHO running engine-tests.exe ...
|
ECHO running engine-tests.exe ...
|
||||||
unit_tests\%Configuration%\engine-tests.exe
|
unit_tests\%Configuration%\engine-tests.exe
|
||||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||||
|
|
||||||
ECHO running util-tests.exe ...
|
ECHO running util-tests.exe ...
|
||||||
unit_tests\%Configuration%\util-tests.exe
|
unit_tests\%Configuration%\util-tests.exe
|
||||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||||
|
|
||||||
ECHO running server-tests.exe ...
|
ECHO running server-tests.exe ...
|
||||||
unit_tests\%Configuration%\server-tests.exe
|
unit_tests\%Configuration%\server-tests.exe
|
||||||
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
|
||||||
|
|
||||||
|
ECHO running library-tests.exe ...
|
||||||
|
SET test_region=monaco
|
||||||
|
SET test_osm=%test_region%.osm.pbf
|
||||||
|
IF NOT EXIST %test_osm% powershell Invoke-WebRequest https://s3.amazonaws.com/mapbox/osrm/testing/monaco.osm.pbf -OutFile %test_osm%
|
||||||
|
%Configuration%\osrm-extract.exe -p ../profiles/car.lua %test_osm%
|
||||||
|
%Configuration%\osrm-contract.exe %test_region%.osrm
|
||||||
|
unit_tests\%Configuration%\library-tests.exe %test_region%.osrm
|
||||||
|
|
||||||
IF NOT "%APPVEYOR_REPO_BRANCH%"=="master" GOTO DONE
|
IF NOT "%APPVEYOR_REPO_BRANCH%"=="master" GOTO DONE
|
||||||
ECHO ========= CREATING PACKAGES ==========
|
ECHO ========= CREATING PACKAGES ==========
|
||||||
|
|
||||||
|
12
appveyor.yml
12
appveyor.yml
@ -3,6 +3,9 @@ environment:
|
|||||||
- configuration: Release
|
- configuration: Release
|
||||||
# - configuration: Debug
|
# - configuration: Debug
|
||||||
|
|
||||||
|
install:
|
||||||
|
- ps: Install-Product node 6
|
||||||
|
|
||||||
# scripts that are called at very beginning, before repo cloning
|
# scripts that are called at very beginning, before repo cloning
|
||||||
init:
|
init:
|
||||||
- git config --global core.autocrlf input
|
- git config --global core.autocrlf input
|
||||||
@ -17,7 +20,14 @@ platform: x64
|
|||||||
build_script:
|
build_script:
|
||||||
- CALL appveyor-build.bat
|
- CALL appveyor-build.bat
|
||||||
|
|
||||||
test: off
|
before_test:
|
||||||
|
- node --version
|
||||||
|
- npm --version
|
||||||
|
- npm install
|
||||||
|
- npm link
|
||||||
|
- SET PATH=%CD%\osrm-deps\libs\bin;%PATH%
|
||||||
|
- SET OSRM_BUILD_DIR=build\%Configuration%
|
||||||
|
- npm test
|
||||||
|
|
||||||
artifacts:
|
artifacts:
|
||||||
- path: osrm_Release.zip
|
- path: osrm_Release.zip
|
||||||
|
@ -11,7 +11,7 @@ module.exports = {
|
|||||||
|
|
||||||
errorReason: (err) => {
|
errorReason: (err) => {
|
||||||
return err.signal ?
|
return err.signal ?
|
||||||
util.format('killed by signal %s', err.signal) :
|
'killed by signal ' + err.signal :
|
||||||
util.format('exited with code %d', err.code);
|
'exited with code ' + err.code;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -239,11 +239,12 @@ module.exports = function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.Given(/^the profile file(?: "([^"]*)" extended with)?$/, (profile, data, callback) => {
|
this.Given(/^the profile file(?: "([^"]*)" extended with)?$/, (profile, data, callback) => {
|
||||||
let text = 'package.path = "' + this.PROFILES_PATH + '/?.lua;" .. package.path\n';
|
const lua_profiles_path = this.PROFILES_PATH.split(path.sep).join('/');
|
||||||
|
let text = 'package.path = "' + lua_profiles_path + '/?.lua;" .. package.path\n';
|
||||||
if (profile == null) {
|
if (profile == null) {
|
||||||
text += data + '\n';
|
text += data + '\n';
|
||||||
} else {
|
} else {
|
||||||
text += 'local f = assert(io.open("' + this.PROFILES_PATH + '/' + profile + '.lua", "r"))\n';
|
text += 'local f = assert(io.open("' + lua_profiles_path + '/' + profile + '.lua", "r"))\n';
|
||||||
text += 'local m = assert(loadstring(f:read("*all") .. [[\n' + data + '\n]]))\n';
|
text += 'local m = assert(loadstring(f:read("*all") .. [[\n' + data + '\n]]))\n';
|
||||||
text += 'f:close()\n';
|
text += 'f:close()\n';
|
||||||
text += 'm()\n';
|
text += 'm()\n';
|
||||||
|
@ -141,7 +141,7 @@ 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, '.');
|
||||||
return util.format('%d_%s', scenario.getLine(), name);
|
return util.format('%d_%s', scenario.getLine(), name);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -42,44 +42,33 @@ module.exports = function () {
|
|||||||
this.OSRM_PORT = process.env.OSRM_PORT && parseInt(process.env.OSRM_PORT) || 5000;
|
this.OSRM_PORT = process.env.OSRM_PORT && parseInt(process.env.OSRM_PORT) || 5000;
|
||||||
this.HOST = 'http://127.0.0.1:' + this.OSRM_PORT;
|
this.HOST = 'http://127.0.0.1:' + this.OSRM_PORT;
|
||||||
|
|
||||||
// TODO make sure this works on win
|
if (process.platform.match(/^win.*/)) {
|
||||||
if (process.platform.match(/indows.*/)) {
|
|
||||||
this.TERMSIGNAL = 9;
|
this.TERMSIGNAL = 9;
|
||||||
this.EXE = '.exe';
|
this.EXE = '.exe';
|
||||||
this.LIB = '.dll';
|
|
||||||
this.QQ = '"';
|
|
||||||
} else {
|
} else {
|
||||||
this.TERMSIGNAL = 'SIGTERM';
|
this.TERMSIGNAL = 'SIGTERM';
|
||||||
this.EXE = '';
|
this.EXE = '';
|
||||||
|
|
||||||
// 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 = '';
|
// heuristically detect .so/.a/.dll/.lib suffix
|
||||||
|
this.LIB = ['lib%s.a', 'lib%s.so', '%s.dll', '%s.lib'].find((format) => {
|
||||||
|
try {
|
||||||
|
const lib = this.BIN_PATH + '/' + util.format(format, 'osrm');
|
||||||
|
fs.accessSync(lib, fs.F_OK);
|
||||||
|
} catch(e) { return false; }
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (this.LIB === undefined) {
|
||||||
|
throw new Error('*** Unable to detect dynamic or static libosrm libraries');
|
||||||
}
|
}
|
||||||
|
|
||||||
this.OSRM_EXTRACT_PATH = path.resolve(util.format('%s/%s%s', this.BIN_PATH, 'osrm-extract', this.EXE));
|
this.OSRM_EXTRACT_PATH = path.resolve(util.format('%s/%s%s', this.BIN_PATH, 'osrm-extract', this.EXE));
|
||||||
this.OSRM_CONTRACT_PATH = path.resolve(util.format('%s/%s%s', this.BIN_PATH, 'osrm-contract', this.EXE));
|
this.OSRM_CONTRACT_PATH = path.resolve(util.format('%s/%s%s', this.BIN_PATH, 'osrm-contract', this.EXE));
|
||||||
this.OSRM_ROUTED_PATH = path.resolve(util.format('%s/%s%s', this.BIN_PATH, 'osrm-routed', this.EXE));
|
this.OSRM_ROUTED_PATH = path.resolve(util.format('%s/%s%s', this.BIN_PATH, 'osrm-routed', this.EXE));
|
||||||
this.LIB_OSRM_EXTRACT_PATH = util.format('%s/libosrm_extract%s', this.BIN_PATH, this.LIB),
|
this.LIB_OSRM_EXTRACT_PATH = util.format('%s/' + this.LIB, this.BIN_PATH, 'osrm_extract'),
|
||||||
this.LIB_OSRM_CONTRACT_PATH = util.format('%s/libosrm_contract%s', this.BIN_PATH, this.LIB),
|
this.LIB_OSRM_CONTRACT_PATH = util.format('%s/' + this.LIB, this.BIN_PATH, 'osrm_contract'),
|
||||||
this.LIB_OSRM_PATH = util.format('%s/libosrm%s', this.BIN_PATH, this.LIB);
|
this.LIB_OSRM_PATH = util.format('%s/' + this.LIB, this.BIN_PATH, 'osrm');
|
||||||
|
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.info(util.format('Node Version', process.version));
|
console.info(util.format('Node Version', process.version));
|
||||||
@ -108,7 +97,7 @@ module.exports = function () {
|
|||||||
var verify = (binPath, cb) => {
|
var verify = (binPath, cb) => {
|
||||||
fs.exists(binPath, (exists) => {
|
fs.exists(binPath, (exists) => {
|
||||||
if (!exists) return cb(new Error(util.format('%s is missing. Build failed?', binPath)));
|
if (!exists) return cb(new Error(util.format('%s is missing. Build failed?', binPath)));
|
||||||
var helpPath = util.format('%s --help > /dev/null 2>&1', binPath);
|
var helpPath = util.format('%s --help', binPath);
|
||||||
child_process.exec(helpPath, (err) => {
|
child_process.exec(helpPath, (err) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
return cb(new Error(util.format('*** %s exited with code %d', helpPath, err.code)));
|
return cb(new Error(util.format('*** %s exited with code %d', helpPath, err.code)));
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
const path = require('path');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const util = require('util');
|
const util = require('util');
|
||||||
const child_process = require('child_process');
|
const child_process = require('child_process');
|
||||||
@ -36,7 +37,7 @@ module.exports = function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.runBin = (bin, options, env, callback) => {
|
this.runBin = (bin, options, env, callback) => {
|
||||||
let cmd = util.format('%s%s/%s%s%s', this.QQ, this.BIN_PATH, bin, this.EXE, this.QQ);
|
let cmd = path.resolve(util.format('%s/%s%s', this.BIN_PATH, bin, this.EXE));
|
||||||
let opts = options.split(' ').filter((x) => { return x && x.length > 0; });
|
let opts = options.split(' ').filter((x) => { return x && x.length > 0; });
|
||||||
let log = fs.createWriteStream(this.scenarioLogFile, {'flags': 'a'});
|
let log = fs.createWriteStream(this.scenarioLogFile, {'flags': 'a'});
|
||||||
log.write(util.format('*** running %s %s\n', cmd, options));
|
log.write(util.format('*** running %s %s\n', cmd, options));
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "eslint -c ./.eslintrc features/step_definitions/ features/support/",
|
"lint": "eslint -c ./.eslintrc features/step_definitions/ features/support/",
|
||||||
"test": "npm run lint && ./node_modules/cucumber/bin/cucumber.js features/ -p verify",
|
"test": "npm run lint && node ./node_modules/cucumber/bin/cucumber.js features/ -p verify",
|
||||||
"clean-test": "rm -rf test/cache",
|
"clean-test": "rm -rf test/cache",
|
||||||
"cucumber": "./node_modules/cucumber/bin/cucumber.js",
|
"cucumber": "./node_modules/cucumber/bin/cucumber.js",
|
||||||
"build-api-docs": "./scripts/build_api_docs.sh"
|
"build-api-docs": "./scripts/build_api_docs.sh"
|
||||||
|
Loading…
Reference in New Issue
Block a user