diff --git a/appveyor-build.bat b/appveyor-build.bat index ec1fd0c24..189a06d56 100644 --- a/appveyor-build.bat +++ b/appveyor-build.bat @@ -10,10 +10,10 @@ ECHO NUMBER_OF_PROCESSORS^: %NUMBER_OF_PROCESSORS% ECHO cmake^: && cmake --version 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 -SET CMAKE_VERSION=3.7.0-rc2 +SET CMAKE_VERSION=3.7.1 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 %ERRORLEVEL% NEQ 0 GOTO ERROR @@ -119,16 +119,27 @@ SET PATH=%PROJECT_DIR%\osrm-deps\libs\bin;%PATH% ECHO running extractor-tests.exe ... unit_tests\%Configuration%\extractor-tests.exe IF %ERRORLEVEL% NEQ 0 GOTO ERROR + ECHO running engine-tests.exe ... unit_tests\%Configuration%\engine-tests.exe IF %ERRORLEVEL% NEQ 0 GOTO ERROR + ECHO running util-tests.exe ... unit_tests\%Configuration%\util-tests.exe IF %ERRORLEVEL% NEQ 0 GOTO ERROR + ECHO running server-tests.exe ... unit_tests\%Configuration%\server-tests.exe 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 ECHO ========= CREATING PACKAGES ========== diff --git a/appveyor.yml b/appveyor.yml index ff9532878..0e6b00f3c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,6 +3,9 @@ environment: - configuration: Release # - configuration: Debug +install: + - ps: Install-Product node 6 + # scripts that are called at very beginning, before repo cloning init: - git config --global core.autocrlf input @@ -17,7 +20,14 @@ platform: x64 build_script: - 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: - path: osrm_Release.zip diff --git a/features/lib/utils.js b/features/lib/utils.js index 27b63af6c..321264368 100644 --- a/features/lib/utils.js +++ b/features/lib/utils.js @@ -11,7 +11,7 @@ module.exports = { errorReason: (err) => { return err.signal ? - util.format('killed by signal %s', err.signal) : - util.format('exited with code %d', err.code); + 'killed by signal ' + err.signal : + 'exited with code ' + err.code; } }; diff --git a/features/step_definitions/data.js b/features/step_definitions/data.js index a5f38e4bb..99f6a5786 100644 --- a/features/step_definitions/data.js +++ b/features/step_definitions/data.js @@ -239,11 +239,12 @@ module.exports = function () { }); 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) { text += data + '\n'; } 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 += 'f:close()\n'; text += 'm()\n'; diff --git a/features/support/cache.js b/features/support/cache.js index 130e87650..c312d2f26 100644 --- a/features/support/cache.js +++ b/features/support/cache.js @@ -141,7 +141,7 @@ module.exports = function() { // converts the scenario titles in file prefixes 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); }; diff --git a/features/support/env.js b/features/support/env.js index 5df8c6644..173ceab86 100644 --- a/features/support/env.js +++ b/features/support/env.js @@ -42,44 +42,33 @@ module.exports = function () { this.OSRM_PORT = process.env.OSRM_PORT && parseInt(process.env.OSRM_PORT) || 5000; this.HOST = 'http://127.0.0.1:' + this.OSRM_PORT; - // TODO make sure this works on win - if (process.platform.match(/indows.*/)) { + if (process.platform.match(/^win.*/)) { this.TERMSIGNAL = 9; this.EXE = '.exe'; - this.LIB = '.dll'; - this.QQ = '"'; } else { this.TERMSIGNAL = 'SIGTERM'; this.EXE = ''; + } - // heuristically detect .so/.a suffix - this.LIB = null; - + // heuristically detect .so/.a/.dll/.lib suffix + this.LIB = ['lib%s.a', 'lib%s.so', '%s.dll', '%s.lib'].find((format) => { 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*/ } + const lib = this.BIN_PATH + '/' + util.format(format, 'osrm'); + fs.accessSync(lib, fs.F_OK); + } catch(e) { return false; } + return true; + }); - 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 = ''; + 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_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.LIB_OSRM_EXTRACT_PATH = util.format('%s/libosrm_extract%s', this.BIN_PATH, this.LIB), - this.LIB_OSRM_CONTRACT_PATH = util.format('%s/libosrm_contract%s', this.BIN_PATH, this.LIB), - this.LIB_OSRM_PATH = util.format('%s/libosrm%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/' + this.LIB, this.BIN_PATH, 'osrm_contract'), + this.LIB_OSRM_PATH = util.format('%s/' + this.LIB, this.BIN_PATH, 'osrm'); // eslint-disable-next-line no-console console.info(util.format('Node Version', process.version)); @@ -108,7 +97,7 @@ module.exports = function () { var verify = (binPath, cb) => { fs.exists(binPath, (exists) => { 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) => { if (err) { return cb(new Error(util.format('*** %s exited with code %d', helpPath, err.code))); diff --git a/features/support/run.js b/features/support/run.js index f6be19744..4427814ad 100644 --- a/features/support/run.js +++ b/features/support/run.js @@ -1,5 +1,6 @@ 'use strict'; +const path = require('path'); const fs = require('fs'); const util = require('util'); const child_process = require('child_process'); @@ -36,7 +37,7 @@ module.exports = function () { }; 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 log = fs.createWriteStream(this.scenarioLogFile, {'flags': 'a'}); log.write(util.format('*** running %s %s\n', cmd, options)); diff --git a/package.json b/package.json index d24480145..0aead113d 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ }, "scripts": { "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", "cucumber": "./node_modules/cucumber/bin/cucumber.js", "build-api-docs": "./scripts/build_api_docs.sh"