Compare commits

..

24 Commits

Author SHA1 Message Date
Daniel Patterson c3c7b6bdb1 Merge branch 'master' into 5.26 2021-09-21 13:28:17 -07:00
Michael Bell 37cfc7f99d Revert "Executables use hyphens" (#6131)
This reverts commit 5bf3c7b659.
2021-09-21 13:28:01 -07:00
Daniel Patterson a6bab049e9 rc2 2021-09-21 12:36:10 -07:00
Daniel Patterson e2d0dc3d76 Merge branch 'master' into 5.26 2021-09-21 12:35:52 -07:00
Michael Bell 2d1e620429 Fix test cache to consider MLD executable changes (#6129)
* Fix test cache to consider MLD executable changes

Currently the test cache is not invalidated if changes to
osrm-partition or osrm-customize executables. This is problematic
when these executables make breaking changes to the data format.

We fix this by including both in the list of executables that
can invalidate the test cache.

* Executables use hyphens
2021-09-21 12:35:34 -07:00
Daniel Patterson 520135931e Prep rc.1 2021-09-21 12:20:56 -07:00
Daniel Patterson 999daf9e94 Bookkeeping for 5.26.0 release. 2021-09-21 11:56:36 -07:00
Michael Bell f6349a7fbe Fix metric offset overflow for large MLD partitions (#6124)
Each MLD cell has source and destination nodes.
MLD is keeping a |source| x |destination| sized table
for various metrics (distances, durations, etc) from each
source to all destinations in a cell.

It stores all of the values for a metric in one large array, with
an offset for each cell to find its values. The offset is currently
limited to 32 bit values, which overflows on very large graphs
(e.g. Planet OSM).

We fix this by changing the offsets to be uint64_t types.
2021-09-21 19:25:30 +01:00
Michael Bell f1f96166c5 Fix MLD level mask generation to support 64-bit masks. (#6123)
The generation of level masks for compactly storing partition cells
supports sizes that can be stored in 64 bits.

The current implementation fails if the total bit sum is 64 bits
exactly. A bit shift mechanism is used that is undefined when the
shift size is equal to the bit size of the underlying type. This
generates an incorrect mask value.

We fix this by adding a special case for a 64 bit offset. Given this
code is called at most |level| times, there will be no effect on
performance. We also update the assertions to reflect 64 bit masks
are now supported.
2021-09-21 18:09:38 +01:00
Ömer Faruk Özdemir 8e100ea1a0 Update api.md (#6054)
* Update api.md

alternatives_count was missing in this document,

Copied from here:
https://github.com/Project-OSRM/osrm-backend/blob/master/docs/http.md#waypoint-object
2021-09-04 12:33:10 +01:00
Michael Bell f1a6056953 Immediately close bad connections to prevent file exhaustion
osrm-routed does not immediately clean up a keep-alive connection
when the client closes it. Instead it waits for five seconds
of inactivity before removing.

Given a setup with low file limits and clients opening and
closing a lot of keep-alive connections, it's possible for
osrm-routed to run out of file descriptors whilst it waits for
the clean-up to trigger.

Furthermore, this causes the connection acceptor loop to exit.
Even after the old connections are cleaned up, new ones
will not be created. Any new requests will block until the
server is restarted.

This commit improves the situation by:

- Immediately closing connections on error. This includes EOF errors
indicating that the client has closed the connection. This releases
resources early (including the open file) and doesn't wait for the
timer.

- Log when the acceptor loop exits. Whilst this means the behaviour
can still occur for reasons other than too many open files,
we will at least have visibility of the cause and can investigate further.
2021-09-04 01:55:36 +01:00
Michael Bell d413d0639d Fix Boost link flags in pkg-config file.
In newer versions of cmake, FindBoost uses Imported Targets for library
component variables, rather than file paths to the Boost libraries.

cmake uses these targets when linking (e.g. target_link_library) and
knows how to correctly substitute the values. However, the OSRM
pkg-config file that we generate doesn't do this, and ends up writing
the actual target symbols, hence the errors trying to link Boost::<component>.

To fix this for newer cmake versions, we create an intermediate configure step
that references the linker files for the imported targets. This is followed
by a generate step that performs the correct substitution.
See this thread for more details: https://cmake.org/pipermail/cmake/2018-December/068812.html

This is backwards compatible to the existing min cmake version (3.1).
However, building using cmake 3.1 fails with a package.json parsing error,
so this commit also bumps the min version to 3.2.
2021-09-03 23:49:32 +01:00
Michael Bell 9884684701 Fix generation of inefficient MLD partitions
Duplicate restriction nodes in the edge-based-graph are currently
not in included in a mapping (.osrm.cnbg_to_ebg) from
node-based-graph edges to edge-based-graph nodes.
This mapping is used by the MLD partitioner to assign EBG nodes
to partitions.

The omission from the mapping means all restriction nodes are
included in a special 'invalid' partition. This special partition
will break the geolocation properties of the multi-level hierarchy.
The partition and its super levels will have a large number of
border nodes and very few internal paths between them.

Given the partitioner is the only consumer of the mapping, we fix
the issue by including the duplicate restriction nodes in the mapping,
so that they are correctly assigned to a partition.

This has measurable improvement on MLD routing.
For a country-sized routing network, the fix reduces routing and table
request computation time by ~2% and ~6% respectively.
2021-09-03 22:48:10 +01:00
Michael Bell 0911691008 Fix changelog entry 2021-09-03 18:35:01 +02:00
Michael Bell 971f0d3fe2 Format unit_tests 2021-09-03 18:35:01 +02:00
Michael Bell eb0c089574 Replace Travis with Github Actions for CI builds
Replace Travis for continuous integration with Github Actions.
The Github Actions pipeline is functionally equivalent, with
all the same build permutations supported.
Whilst the Github Actions offering is broadly equivalent to
Travis, a few changes have been made as part of the migration.

- The 'core' and 'optional' Travis stages have been consolidated
into one build matrix. This is due to the current inability in
Github Actions to share build steps between jobs, so this avoids
having to duplicate the steps.
Optional stage jobs will now run in parallel with core jobs,
but they still remain optional in the sense that they don't fail
the build.

- A number of existing Github Action plugins are used to replace
functionality provided by Travis or other tools:
Node setup, caching, Codecov, publishing release artifacts.

- Linux builds are updated to build on Ubuntu 18.04.
MacOS builds are updated to run on 10.15. Similar to the
Travis Xenial upgrade attempt, some changes are required due
to underlying platform and compiler upgrades. This means some
Node 10 toolchains will no longer be supported.

Whilst there is opportunity to upgrade some dependencies and
make the CI steps more idiomatic, I've left this for future changes
and just focussed on functional replication.
2021-09-03 18:35:01 +02:00
Mateusz Konieczny 8af4f700f7 fix link in the changelog 2021-09-03 11:14:22 +02:00
Patrick Niklaus 155ca8b1f1 Update src/server/api/url_parser.cpp
Co-authored-by: Michael Bell <moke.byll@gmail.com>
2021-09-03 10:55:53 +02:00
Patrick Niklaus 03001ff90a Fix ranges 2021-09-03 10:55:53 +02:00
Patrick Niklaus ba4e7bfa11 Add changelog entry 2021-09-03 10:55:53 +02:00
Patrick Niklaus 38df7d5e05 Fix the URL parser for special chars in profile 2021-09-03 10:55:53 +02:00
ijleesw dca35dcc86 Add support for lua5.4 in FindLua.cmake 2021-07-20 23:21:49 +01:00
Matt Riggott f7478ba80f Process maxspeed tag before surface, smoothness, and tracktype tags (#6002)
* Handle maxspeed tags before surface and smoothness tags

Let's say we have a tertiary road with the following tags:

   highway=tertiary
   maxspeed=60
   surface=gravel
   smoothness=intermediate

While the maxspeed tag tells us the legal speed limit, the surface and
smoothness tags have much more effect on the real-world speed of a car.
We should process the maxspeed tags first, and then update the road's
forwards/backwards speeds according to any surface and smoothness tags.
For our hypothetical road the process in the car.lua profile now goes
like this:

1. Get default speed from profile (tertiary = 40 on line 150 of car.lua)
2. Change speed to 60 using maxspeed tag (WayHandlers.maxspeed function
   in way_handlers.lua, lines 434-447)
3. Change speed to 40 using surface tag (WayHandlers.surface function
   in way_handlers.lua, lines 360-363)
4. Check speed according to smoothness tag --- but because it's higher
   than the speed according to the surface tag, leave the speed
   unchanged (WayHandlers.surface function again, lines 368-371)

<https://github.com/Project-OSRM/osrm-backend/blob/ec36319232f6b6558080c5586d21fc0bd150de44/profiles/car.lua#L150>
<https://github.com/Project-OSRM/osrm-backend/blob/ec36319232f6b6558080c5586d21fc0bd150de44/profiles/lib/way_handlers.lua#L354-L372>

Note in step 3 above the speed's only changed from 60kph to 40kph
because it's a lower value. If the surface speed was higher than than
the previous value, the speed would remain unchanged. Another example:

   highway=tertiary
   maxspeed=60
   surface=compacted
   smoothness=intermediate

Here, although the profile's speed for compacted is 80, it would stay at
the lower value of 60 (see way_handlers.lua, lines 360-363).

<https://github.com/Project-OSRM/osrm-backend/blob/ec36319232f6b6558080c5586d21fc0bd150de44/profiles/lib/way_handlers.lua#L360-L363>
2021-06-03 17:56:57 +01:00
Daniel Patterson ec36319232 Reset main branch after release. 2021-05-17 14:59:48 -07:00
35 changed files with 783 additions and 648 deletions
+588
View File
@@ -0,0 +1,588 @@
name: osrm-backend CI
on:
push:
branches:
- master
tags:
- v[1-9]+.[0-9]+.[0-9]+
- v[1-9]+.[0-9]+.[0-9]+-[0-9a-zA-Z]+
- v[1-9]+.[0-9]+-[0-9a-zA-Z]+
pull_request:
branches:
- master
env:
CCACHE_TEMPDIR: /tmp/.ccache-temp
CCACHE_COMPRESS: 1
CASHER_TIME_OUT: 599 # one second less than 10m to avoid 10m timeout error: https://github.com/Project-OSRM/osrm-backend/issues/2742
CCACHE_VERSION: 3.3.1
CMAKE_VERSION: 3.7.2
ENABLE_NODE_BINDINGS: "ON"
jobs:
format-taginfo-docs:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: 10
- name: Enable Node.js cache
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Prepare environment
run: |
npm ci --ignore-scripts
export MASON=${GITHUB_WORKSPACE}/scripts/mason.sh
${MASON} install clang-format 10.0.0
echo "$(${MASON} prefix clang-format 10.0.0)/bin" >> $GITHUB_PATH
- name: Run checks
run: |
./scripts/check_taginfo.py taginfo.json profiles/car.lua
./scripts/format.sh && ./scripts/error_on_dirty.sh
node ./scripts/validate_changelog.js
# See issue 4043
#- npm run docs && ./scripts/error_on_dirty.sh
build-test-publish:
needs: format-taginfo-docs
strategy:
matrix:
include:
- name: gcc-7-debug-cov
continue-on-error: false
node: 10
runs-on: ubuntu-18.04
BUILD_TOOLS: ON
BUILD_TYPE: Debug
CCOMPILER: gcc-7
CUCUMBER_TIMEOUT: 20000
CXXCOMPILER: g++-7
ENABLE_COVERAGE: ON
- name: gcc-7-debug-asan
continue-on-error: false
node: 10
runs-on: ubuntu-18.04
BUILD_TOOLS: ON
BUILD_TYPE: Debug
CCOMPILER: gcc-7
CUCUMBER_TIMEOUT: 20000
CXXCOMPILER: g++-7
ENABLE_SANITIZER: ON
TARGET_ARCH: x86_64-asan
- name: clang-5.0-debug
continue-on-error: false
node: 10
runs-on: ubuntu-18.04
BUILD_TOOLS: ON
BUILD_TYPE: Debug
CLANG_VERSION: 5.0.0
CUCUMBER_TIMEOUT: 60000
- name: mason-linux-debug-asan
continue-on-error: false
node: 10
runs-on: ubuntu-18.04
BUILD_TOOLS: ON
BUILD_TYPE: Release
CLANG_VERSION: 5.0.0
ENABLE_MASON: ON
ENABLE_SANITIZER: ON
- name: mason-linux-release
continue-on-error: false
node: 10
runs-on: ubuntu-18.04
BUILD_TOOLS: ON
BUILD_TYPE: Release
CLANG_VERSION: 5.0.0
ENABLE_MASON: ON
- name: gcc-9-release
continue-on-error: false
node: 10
runs-on: ubuntu-18.04
BUILD_TOOLS: ON
BUILD_TYPE: Release
CCOMPILER: gcc-9
CXXCOMPILER: g++-9
CXXFLAGS: -Wno-cast-function-type
- name: gcc-8-release
continue-on-error: false
node: 10
runs-on: ubuntu-18.04
BUILD_TOOLS: ON
BUILD_TYPE: Release
CCOMPILER: gcc-8
CXXCOMPILER: g++-8
CXXFLAGS: -Wno-cast-function-type
- name: gcc-7-release
continue-on-error: false
node: 10
runs-on: ubuntu-18.04
BUILD_TOOLS: ON
BUILD_TYPE: Release
CCOMPILER: gcc-7
CXXCOMPILER: g++-7
- name: gcc-7-release-i686
continue-on-error: false
node: 10
runs-on: ubuntu-18.04
BUILD_TOOLS: ON
BUILD_TYPE: Release
CCOMPILER: gcc-7
CFLAGS: "-m32 -msse2 -mfpmath=sse"
CXXCOMPILER: g++-7
CXXFLAGS: "-m32 -msse2 -mfpmath=sse"
TARGET_ARCH: i686
- name: gcc-5-release
continue-on-error: false
node: 10
runs-on: ubuntu-18.04
BUILD_TOOLS: ON
BUILD_TYPE: Release
CCOMPILER: gcc-5
CXXCOMPILER: g++-5
- name: gcc-6-release
continue-on-error: false
node: 10
runs-on: ubuntu-18.04
BUILD_TOOLS: ON
BUILD_TYPE: Release
CCOMPILER: gcc-6
CXXCOMPILER: g++-6
- name: mason-osx-release-node-10
build_node_package: true
continue-on-error: false
node: 10
runs-on: macos-10.15
BUILD_TOOLS: ON
BUILD_TYPE: Release
CCOMPILER: clang
CXXCOMPILER: clang++
CUCUMBER_TIMEOUT: 60000
ENABLE_ASSERTIONS: ON
ENABLE_MASON: ON
- name: mason-osx-release-node-12
build_node_package: true
continue-on-error: false
node: 12
runs-on: macos-10.15
BUILD_TOOLS: ON
BUILD_TYPE: Release
CCOMPILER: clang
CXXCOMPILER: clang++
CUCUMBER_TIMEOUT: 60000
ENABLE_ASSERTIONS: ON
ENABLE_MASON: ON
- name: mason-osx-release-node-14
build_node_package: true
continue-on-error: false
node: 14
runs-on: macos-10.15
BUILD_TOOLS: ON
BUILD_TYPE: Release
CCOMPILER: clang
CXXCOMPILER: clang++
CUCUMBER_TIMEOUT: 60000
ENABLE_ASSERTIONS: ON
ENABLE_MASON: ON
- name: gcc-7-release-shared
continue-on-error: false
node: 10
runs-on: ubuntu-18.04
BUILD_TOOLS: ON
BUILD_TYPE: Release
BUILD_SHARED_LIBS: ON
CCOMPILER: gcc-7
CXXCOMPILER: g++-7
- name: node-14-mason-linux-release
build_node_package: true
continue-on-error: false
node: 14
runs-on: ubuntu-18.04
BUILD_TYPE: Release
CLANG_VERSION: 5.0.0
ENABLE_GLIBC_WORKAROUND: ON
ENABLE_MASON: ON
NODE_PACKAGE_TESTS_ONLY: ON
- name: node-14-mason-linux-debug
build_node_package: true
continue-on-error: false
node: 14
runs-on: ubuntu-18.04
BUILD_TYPE: Debug
CLANG_VERSION: 5.0.0
ENABLE_GLIBC_WORKAROUND: ON
ENABLE_MASON: ON
NODE_PACKAGE_TESTS_ONLY: ON
- name: node-12-mason-linux-release
build_node_package: true
continue-on-error: false
node: 12
runs-on: ubuntu-18.04
BUILD_TYPE: Release
CLANG_VERSION: 5.0.0
ENABLE_GLIBC_WORKAROUND: ON
ENABLE_MASON: ON
NODE_PACKAGE_TESTS_ONLY: ON
- name: node-12-mason-linux-debug
build_node_package: true
continue-on-error: false
node: 12
runs-on: ubuntu-18.04
BUILD_TYPE: Debug
CLANG_VERSION: 5.0.0
ENABLE_GLIBC_WORKAROUND: ON
ENABLE_MASON: ON
NODE_PACKAGE_TESTS_ONLY: ON
- name: node-10-mason-linux-release
build_node_package: true
continue-on-error: false
node: 10
runs-on: ubuntu-18.04
BUILD_TYPE: Release
CLANG_VERSION: 5.0.0
ENABLE_GLIBC_WORKAROUND: ON
ENABLE_MASON: ON
NODE_PACKAGE_TESTS_ONLY: ON
- name: node-10-mason-linux-debug
build_node_package: true
continue-on-error: false
node: 10
runs-on: ubuntu-18.04
BUILD_TYPE: Debug
CLANG_VERSION: 5.0.0
ENABLE_GLIBC_WORKAROUND: ON
ENABLE_MASON: ON
NODE_PACKAGE_TESTS_ONLY: ON
- name: mason-osx-release-node-latest
build_node_package: true
continue-on-error: true
# TODO: Use node 'latest' once supported: https://github.com/actions/setup-node/issues/257
node: 16
runs-on: macos-10.15
BUILD_TYPE: Release
CCOMPILER: clang
CXXCOMPILER: clang++
CUCUMBER_TIMEOUT: 60000
ENABLE_ASSERTIONS: ON
ENABLE_MASON: ON
- name: node-latest-mason-linux-release
build_node_package: true
continue-on-error: true
# TODO: Use node 'latest' once supported: https://github.com/actions/setup-node/issues/257
node: 16
runs-on: ubuntu-18.04
BUILD_TYPE: Release
CLANG_VERSION: 5.0.0
ENABLE_GLIBC_WORKAROUND: ON
ENABLE_MASON: ON
NODE_PACKAGE_TESTS_ONLY: ON
- name: node-latest-mason-linux-debug
build_node_package: true
continue-on-error: true
# TODO: Use node 'latest' once supported: https://github.com/actions/setup-node/issues/257
node: 16
runs-on: ubuntu-18.04
BUILD_TYPE: Debug
CLANG_VERSION: 5.0.0
ENABLE_GLIBC_WORKAROUND: ON
ENABLE_MASON: ON
NODE_PACKAGE_TESTS_ONLY: ON
- name: mason-osx-release-node-lts
build_node_package: true
continue-on-error: true
node: "lts/*"
runs-on: macos-10.15
BUILD_TYPE: Release
CCOMPILER: clang
CXXCOMPILER: clang++
CUCUMBER_TIMEOUT: 60000
ENABLE_ASSERTIONS: ON
ENABLE_MASON: ON
- name: node-lts-mason-linux-release
build_node_package: true
continue-on-error: true
node: "lts/*"
runs-on: ubuntu-18.04
BUILD_TYPE: Release
CLANG_VERSION: 5.0.0
ENABLE_GLIBC_WORKAROUND: ON
ENABLE_MASON: ON
NODE_PACKAGE_TESTS_ONLY: ON
- name: node-lts-mason-linux-debug
build_node_package: true
continue-on-error: true
node: "lts/*"
runs-on: ubuntu-18.04
BUILD_TYPE: Debug
CLANG_VERSION: 5.0.0
ENABLE_GLIBC_WORKAROUND: ON
ENABLE_MASON: ON
NODE_PACKAGE_TESTS_ONLY: ON
name: ${{ matrix.name}}
continue-on-error: ${{ matrix.continue-on-error }}
runs-on: ${{ matrix.runs-on }}
env:
BUILD_TOOLS: ${{ matrix.BUILD_TOOLS }}
BUILD_TYPE: ${{ matrix.BUILD_TYPE }}
BUILD_SHARED_LIBS: ${{ matrix.BUILD_SHARED_LIBS }}
CCOMPILER: ${{ matrix.CCOMPILER }}
CFLAGS: ${{ matrix.CFLAGS }}
CLANG_VERSION: ${{ matrix.CLANG_VERSION }}
CUCUMBER_TIMEOUT: ${{ matrix.CUCUMBER_TIMEOUT }}
CXXCOMPILER: ${{ matrix.CXXCOMPILER }}
CXXFLAGS: ${{ matrix.CXXFLAGS }}
ENABLE_ASSERTIONS: ${{ matrix.ENABLE_ASSERTIONS }}
ENABLE_COVERAGE: ${{ matrix.ENABLE_COVERAGE }}
ENABLE_GLIBC_WORKAROUND: ${{ matrix.ENABLE_GLIBC_WORKAROUND }}
ENABLE_MASON: ${{ matrix.ENABLE_MASON }}
ENABLE_SANITIZER: ${{ matrix.ENABLE_SANITIZER }}
NODE_PACKAGE_TESTS_ONLY: ${{ matrix.NODE_PACKAGE_TESTS_ONLY }}
TARGET_ARCH: ${{ matrix.TARGET_ARCH }}
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
- name: Enable Node.js cache
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Enable compiler cache
uses: actions/cache@v2
with:
path: ~/.ccache
key: ccache-${{ matrix.name }}-${{ github.sha }}
restore-keys: |
ccache-${{ matrix.name }}-
- name: Enable test cache
uses: actions/cache@v2
with:
path: ${{github.workspace}}/test/cache
key: test-${{ matrix.name }}-${{ github.sha }}
restore-keys: |
test-${{ matrix.name }}-
- name: Prepare environment
run: |
PACKAGE_JSON_VERSION=$(node -e "console.log(require('./package.json').version)")
echo PUBLISH=$([[ "${GITHUB_REF:-}" == "refs/tags/v${PACKAGE_JSON_VERSION}" ]] && echo "On" || echo "Off") >> $GITHUB_ENV
echo "OSRM_INSTALL_DIR=${GITHUB_WORKSPACE}/install-osrm" >> $GITHUB_ENV
echo "OSRM_BUILD_DIR=${GITHUB_WORKSPACE}/build-osrm" >> $GITHUB_ENV
if [[ "$ENABLE_SANITIZER" == 'ON' ]]; then
# We can only set this after checkout once we know the workspace directory
echo "LSAN_OPTIONS=suppressions=${GITHUB_WORKSPACE}/scripts/ci/leaksanitizer.conf" >> $GITHUB_ENV
fi
if [[ "${RUNNER_OS}" == "Linux" ]]; then
echo "JOBS=$((`nproc` + 1))" >> $GITHUB_ENV
export MASON_OS=linux
elif [[ "${RUNNER_OS}" == "macOS" ]]; then
echo "JOBS=$((`sysctl -n hw.ncpu` + 1))" >> $GITHUB_ENV
sudo mdutil -i off /
export MASON_OS=osx
fi
echo "MASON=${GITHUB_WORKSPACE}/scripts/mason.sh" >> $GITHUB_ENV
echo "CMAKE_URL=https://mason-binaries.s3.amazonaws.com/${MASON_OS}-x86_64/cmake/${CMAKE_VERSION}.tar.gz" >> $GITHUB_ENV
echo "CMAKE_DIR=mason_packages/${MASON_OS}-x86_64/cmake/${CMAKE_VERSION}}" >> $GITHUB_ENV
- name: Install dev dependencies
run: |
# CMake
mkdir -p ${CMAKE_DIR}
wget --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C ${CMAKE_DIR}
echo "${CMAKE_DIR}/bin" >> $GITHUB_PATH
# TBB
${MASON} install tbb 2017_U7
echo "LD_LIBRARY_PATH=$(${MASON} prefix tbb 2017_U7)/lib/:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
# ccache
${MASON} install ccache ${CCACHE_VERSION}
echo "$(${MASON} prefix ccache ${CCACHE_VERSION})/bin" >> $GITHUB_PATH
# clang
if [[ -n ${CLANG_VERSION} ]]; then
echo "CCOMPILER=clang" >> $GITHUB_ENV
echo "CXXCOMPILER=clang++" >> $GITHUB_ENV
${MASON} install clang++ ${CLANG_VERSION}
echo "$(${MASON} prefix clang++ ${CLANG_VERSION})/bin" >> $GITHUB_PATH
# we only enable lto for release builds
# and therefore don't need to us ld.gold or llvm tools for linking
# for debug builds
if [[ ${BUILD_TYPE} == 'Release' ]]; then
${MASON} install binutils 2.27
echo "$(${MASON} prefix binutils 2.27)/bin" >> $GITHUB_PATH
fi
fi
# Linux dev packages
if [ "${TARGET_ARCH}" != "i686" ] && [ "${ENABLE_MASON}" != "ON" ]; then
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt-get update -y
sudo apt-get install -y libbz2-dev libxml2-dev libzip-dev liblua5.2-dev libtbb-dev libboost-all-dev
if [[ -z "${CLANG_VERSION}" ]]; then
sudo apt-get install -y ${CXXCOMPILER}
fi
if [[ "${ENABLE_COVERAGE}" == "ON" ]]; then
sudo apt-get install -y lcov
fi
elif [[ $TARGET_ARCH == "i686" ]]; then
source ./scripts/ci/before_install.${TARGET_ARCH}.sh
fi
- name: Prepare build
run: |
mkdir ${OSRM_BUILD_DIR}
ccache --max-size=256M
npm ci --ignore-scripts
if [[ "${ENABLE_COVERAGE}" == "ON" ]]; then
lcov --directory . --zerocounters # clean cached files
fi
echo "CC=${CCOMPILER}" >> $GITHUB_ENV
echo "CXX=${CXXCOMPILER}" >> $GITHUB_ENV
- name: Build and install OSRM
run: |
echo "Using ${JOBS} jobs"
pushd ${OSRM_BUILD_DIR}
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DENABLE_MASON=${ENABLE_MASON:-OFF} \
-DENABLE_ASSERTIONS=${ENABLE_ASSERTIONS:-OFF}} \
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS:-OFF} \
-DENABLE_COVERAGE=${ENABLE_COVERAGE:-OFF} \
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
-DENABLE_SANITIZER=${ENABLE_SANITIZER:-OFF} \
-DBUILD_TOOLS=${BUILD_TOOLS:-OFF} \
-DENABLE_CCACHE=ON \
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \
-DENABLE_GLIBC_WORKAROUND=${ENABLE_GLIBC_WORKAROUND:-OFF}
make --jobs=${JOBS}
if [[ "${NODE_PACKAGE_TESTS_ONLY}" != "ON" ]]; then
make tests --jobs=${JOBS}
make benchmarks --jobs=${JOBS}
ccache -s
sudo make install
if [[ "${RUNNER_OS}" == "Linux" ]]; then
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${OSRM_INSTALL_DIR}/lib" >> $GITHUB_ENV
fi
echo "PKG_CONFIG_PATH=${OSRM_INSTALL_DIR}/lib/pkgconfig" >> $GITHUB_ENV
fi
popd
- name: Build example
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY != 'ON' }}
run: |
mkdir example/build && pushd example/build
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
make --jobs=${JOBS}
popd
- name: Run all tests
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY != 'ON' }}
run: |
make -C test/data benchmark
# macOS SIP strips the linker path. Reset this inside the running shell
export LD_LIBRARY_PATH=${{ env.LD_LIBRARY_PATH }}
./example/build/osrm-example test/data/mld/monaco.osrm
# All tests assume to be run from the build directory
pushd ${OSRM_BUILD_DIR}
./unit_tests/library-tests
./unit_tests/extractor-tests
./unit_tests/contractor-tests
./unit_tests/engine-tests
./unit_tests/util-tests
./unit_tests/server-tests
./unit_tests/partitioner-tests
./unit_tests/customizer-tests
if [ -z "${ENABLE_SANITIZER}" ] && [ "$TARGET_ARCH" != "i686" ]; then
npm run nodejs-tests
fi
popd
npm test
- name: Run Node package tests only
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY == 'ON' }}
run: |
npm run nodejs-tests
- name: Generate code coverage
if: ${{ matrix.ENABLE_COVERAGE == 'ON' }}
run: |
lcov --directory . --capture --output-file coverage.info # capture coverage info
lcov --remove coverage.info '/usr/*' --output-file coverage.info # filter out system
lcov --list coverage.info #debug info
# Uploading report to CodeCov
- name: Upload code coverage
if: ${{ matrix.ENABLE_COVERAGE == 'ON' }}
uses: codecov/codecov-action@v1
with:
files: coverage.info
name: codecov-osrm-backend
fail_ci_if_error: true
verbose: true
- name: Build Node package
if: ${{ matrix.build_node_package && env.PUBLISH == 'On' }}
run: ./scripts/ci/node_package.sh
- name: Publish Node package
if: ${{ matrix.build_node_package && env.PUBLISH == 'On' }}
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifactErrorsFailBuild: true
artifacts: build/stage/**/*.tar.gz
omitBody: true
omitBodyDuringUpdate: true
omitName: true
omitNameDuringUpdate: true
replacesArtifacts: true
token: ${{ secrets.GITHUB_TOKEN }}
ci-complete:
runs-on: ubuntu-18.04
needs: build-test-publish
steps:
- run: echo "CI complete"
-585
View File
@@ -1,585 +0,0 @@
language: cpp
git:
depth: 10
# sudo:required is needed for trusty images
sudo: required
dist: trusty
notifications:
email: false
branches:
only:
- master
# enable building tags
- /^v\d+\.\d+(\.\d+)?(-\S*)?$/
cache:
npm: true
ccache: true
apt: true
directories:
- test/cache
env:
global:
- CCACHE_TEMPDIR=/tmp/.ccache-temp
- CCACHE_COMPRESS=1
- CASHER_TIME_OUT=599 # one second less than 10m to avoid 10m timeout error: https://github.com/Project-OSRM/osrm-backend/issues/2742
- CCACHE_VERSION=3.3.1
- CMAKE_VERSION=3.7.2
- MASON="$(pwd)/scripts/mason.sh"
- ENABLE_NODE_BINDINGS=On
- NODE="10"
stages:
- core
- optional
matrix:
fast_finish: true
# We override the compiler names here to yield better ccache behavior, which uses this as key
include:
# Debug Builds
- stage: core
os: linux
compiler: "format-taginfo-docs"
env: NODE=10
sudo: false
before_install:
install:
- curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
- source $NVM_DIR/nvm.sh
- nvm install $NODE
- nvm use $NODE
- npm --version
- npm ci --ignore-scripts
script:
- ./scripts/check_taginfo.py taginfo.json profiles/car.lua
- ${MASON} install clang-format 10.0.0
- PATH=$(${MASON} prefix clang-format 10.0.0)/bin:${PATH} ./scripts/format.sh && ./scripts/error_on_dirty.sh
- node ./scripts/validate_changelog.js
# See issue 4043
#- npm run docs && ./scripts/error_on_dirty.sh
after_success:
- os: linux
compiler: "gcc-7-debug-cov"
addons: &gcc7
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-7', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev', 'lcov']
env: CCOMPILER='gcc-7' CXXCOMPILER='g++-7' BUILD_TYPE='Debug' ENABLE_COVERAGE=ON CUCUMBER_TIMEOUT=20000
before_script:
- cd ${TRAVIS_BUILD_DIR}
- lcov --directory . --zerocounters # clean cached da files
after_success:
# Creating report
- cd ${TRAVIS_BUILD_DIR}
- lcov --directory . --capture --output-file coverage.info # capture coverage info
- lcov --remove coverage.info '/usr/*' --output-file coverage.info # filter out system
- lcov --list coverage.info #debug info
# Uploading report to CodeCov
- bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports"
- os: linux
compiler: "gcc-7-debug-asan"
addons: &gcc7
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-7', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev']
env: CCOMPILER='gcc-7' CXXCOMPILER='g++-7' BUILD_TYPE='Debug' TARGET_ARCH='x86_64-asan' ENABLE_SANITIZER=ON CUCUMBER_TIMEOUT=20000 LSAN_OPTIONS="suppressions=$TRAVIS_BUILD_DIR/scripts/travis/leaksanitizer.conf"
- os: linux
compiler: "clang-5.0-debug"
addons: &clang50
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-5-dev', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev']
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' CUCUMBER_TIMEOUT=60000
- os: linux
compiler: "mason-linux-debug-asan"
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-4.9-dev']
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_SANITIZER=ON LSAN_OPTIONS="suppressions=$TRAVIS_BUILD_DIR/scripts/travis/leaksanitizer.conf"
# Release Builds
- os: linux
compiler: "mason-linux-release"
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-4.9-dev']
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON RUN_CLANG_FORMAT=ON ENABLE_LTO=ON
- os: linux
compiler: "gcc-9-release"
addons: &gcc9
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-9', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev']
env: CCOMPILER='gcc-9' CXXCOMPILER='g++-9' BUILD_TYPE='Release' CXXFLAGS='-Wno-cast-function-type'
- os: linux
compiler: "gcc-8-release"
addons: &gcc8
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-8', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev']
env: CCOMPILER='gcc-8' CXXCOMPILER='g++-8' BUILD_TYPE='Release' CXXFLAGS='-Wno-cast-function-type'
- os: linux
compiler: "gcc-7-release"
addons: &gcc7
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-7', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev']
env: CCOMPILER='gcc-7' CXXCOMPILER='g++-7' BUILD_TYPE='Release'
- os: linux
compiler: "gcc-7-release-i686"
env: >
TARGET_ARCH='i686' CCOMPILER='gcc-7' CXXCOMPILER='g++-7' BUILD_TYPE='Release'
CFLAGS='-m32 -msse2 -mfpmath=sse' CXXFLAGS='-m32 -msse2 -mfpmath=sse'
- os: linux
compiler: "gcc-5-release"
addons: &gcc49
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-5', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev', 'ccache']
env: CCOMPILER='gcc-5' CXXCOMPILER='g++-5' BUILD_TYPE='Release'
- os: linux
compiler: "gcc-6-release"
addons: &gcc49
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-6', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev', 'ccache']
env: CCOMPILER='gcc-6' CXXCOMPILER='g++-6' BUILD_TYPE='Release'
- os: osx
osx_image: xcode9.2
compiler: "mason-osx-release-node-10"
# we use the xcode provides clang and don't install our own
env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="10"
after_success:
- ./scripts/travis/node_package.sh
- os: osx
osx_image: xcode9.2
compiler: "mason-osx-release-node-12"
# we use the xcode provides clang and don't install our own
env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="12"
after_success:
- ./scripts/travis/node_package.sh
- os: osx
osx_image: xcode9.2
compiler: "mason-osx-release-node-14"
# we use the xcode provides clang and don't install our own
env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="14"
after_success:
- ./scripts/travis/node_package.sh
# Shared Library
- os: linux
compiler: "gcc-7-release-shared"
addons: &gcc7
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-7', 'libbz2-dev', 'libxml2-dev', 'libzip-dev', 'liblua5.2-dev', 'libtbb-dev', 'libboost-all-dev']
env: CCOMPILER='gcc-7' CXXCOMPILER='g++-7' BUILD_TYPE='Release' BUILD_SHARED_LIBS=ON
# Node build jobs. These skip running the tests.
- os: linux
sudo: false
compiler: "node-14-mason-linux-release"
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-4.9-dev']
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="14"
install:
- pushd ${OSRM_BUILD_DIR}
- |
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DENABLE_MASON=${ENABLE_MASON:-OFF} \
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
-DENABLE_CCACHE=ON \
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \
-DENABLE_GLIBC_WORKAROUND=ON
- make --jobs=${JOBS}
- popd
script:
- npm run nodejs-tests
after_success:
- ./scripts/travis/node_package.sh
- os: linux
sudo: false
compiler: "node-14-mason-linux-debug"
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-4.9-dev']
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="14"
install:
- pushd ${OSRM_BUILD_DIR}
- |
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DENABLE_MASON=${ENABLE_MASON:-OFF} \
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
-DENABLE_CCACHE=ON \
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \
-DENABLE_GLIBC_WORKAROUND=ON
- make --jobs=${JOBS}
- popd
script:
- npm run nodejs-tests
after_success:
- ./scripts/travis/node_package.sh
- os: linux
sudo: false
compiler: "node-12-mason-linux-release"
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-4.9-dev']
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="12"
install:
- pushd ${OSRM_BUILD_DIR}
- |
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DENABLE_MASON=${ENABLE_MASON:-OFF} \
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
-DENABLE_CCACHE=ON \
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \
-DENABLE_GLIBC_WORKAROUND=ON
- make --jobs=${JOBS}
- popd
script:
- npm run nodejs-tests
after_success:
- ./scripts/travis/node_package.sh
- os: linux
sudo: false
compiler: "node-12-mason-linux-debug"
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-4.9-dev']
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="12"
install:
- pushd ${OSRM_BUILD_DIR}
- |
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DENABLE_MASON=${ENABLE_MASON:-OFF} \
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
-DENABLE_CCACHE=ON \
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \
-DENABLE_GLIBC_WORKAROUND=ON
- make --jobs=${JOBS}
- popd
script:
- npm run nodejs-tests
after_success:
- ./scripts/travis/node_package.sh
- os: linux
sudo: false
compiler: "node-10-mason-linux-release"
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-4.9-dev']
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="10"
install:
- pushd ${OSRM_BUILD_DIR}
- |
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DENABLE_MASON=${ENABLE_MASON:-OFF} \
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
-DENABLE_CCACHE=ON \
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \
-DENABLE_GLIBC_WORKAROUND=ON
- make --jobs=${JOBS}
- popd
script:
- npm run nodejs-tests
after_success:
- ./scripts/travis/node_package.sh
- os: linux
sudo: false
compiler: "node-10-mason-linux-debug"
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-4.9-dev']
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="10"
install:
- pushd ${OSRM_BUILD_DIR}
- |
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DENABLE_MASON=${ENABLE_MASON:-OFF} \
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
-DENABLE_CCACHE=ON \
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \
-DENABLE_GLIBC_WORKAROUND=ON
- make --jobs=${JOBS}
- popd
script:
- npm run nodejs-tests
after_success:
- ./scripts/travis/node_package.sh
- os: osx
stage: optional
osx_image: xcode9.2
compiler: "mason-osx-release-node-latest"
# we use the xcode provides clang and don't install our own
env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="node"
after_success:
- ./scripts/travis/node_package.sh
- os: linux
sudo: false
compiler: "node-latest-mason-linux-release"
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-4.9-dev']
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="node"
install:
- pushd ${OSRM_BUILD_DIR}
- |
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DENABLE_MASON=${ENABLE_MASON:-OFF} \
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
-DENABLE_CCACHE=ON \
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \
-DENABLE_GLIBC_WORKAROUND=ON
- make --jobs=${JOBS}
- popd
script:
- npm run nodejs-tests
after_success:
- ./scripts/travis/node_package.sh
- os: linux
sudo: false
compiler: "node-latest-mason-linux-debug"
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-4.9-dev']
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="node"
install:
- pushd ${OSRM_BUILD_DIR}
- |
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DENABLE_MASON=${ENABLE_MASON:-OFF} \
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
-DENABLE_CCACHE=ON \
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \
-DENABLE_GLIBC_WORKAROUND=ON
- make --jobs=${JOBS}
- popd
script:
- npm run nodejs-tests
after_success:
- ./scripts/travis/node_package.sh
- os: osx
osx_image: xcode9.2
compiler: "mason-osx-release-node-lts"
# we use the xcode provides clang and don't install our own
env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="--lts"
after_success:
- ./scripts/travis/node_package.sh
- os: linux
sudo: false
compiler: "node-lts-mason-linux-release"
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-4.9-dev']
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="--lts"
install:
- pushd ${OSRM_BUILD_DIR}
- |
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DENABLE_MASON=${ENABLE_MASON:-OFF} \
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
-DENABLE_CCACHE=ON \
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \
-DENABLE_GLIBC_WORKAROUND=ON
- make --jobs=${JOBS}
- popd
script:
- npm run nodejs-tests
after_success:
- ./scripts/travis/node_package.sh
- os: linux
sudo: false
compiler: "node-lts-mason-linux-debug"
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['libstdc++-4.9-dev']
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="--lts"
install:
- pushd ${OSRM_BUILD_DIR}
- |
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DENABLE_MASON=${ENABLE_MASON:-OFF} \
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
-DENABLE_CCACHE=ON \
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \
-DENABLE_GLIBC_WORKAROUND=ON
- make --jobs=${JOBS}
- popd
script:
- npm run nodejs-tests
after_success:
- ./scripts/travis/node_package.sh
allow_failures:
- compiler: "mason-osx-release-node-latest"
env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="node"
- compiler: "node-latest-mason-linux-release"
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="node"
- compiler: "node-latest-mason-linux-debug"
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="node"
- compiler: "mason-osx-release-node-lts"
env: ENABLE_MASON=ON BUILD_TYPE='Release' CUCUMBER_TIMEOUT=60000 CCOMPILER='clang' CXXCOMPILER='clang++' ENABLE_ASSERTIONS=ON ENABLE_LTO=ON NODE="--lts"
- compiler: "node-lts-mason-linux-release"
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Release' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="--lts"
- compiler: "node-lts-mason-linux-debug"
env: CLANG_VERSION='5.0.0' BUILD_TYPE='Debug' ENABLE_MASON=ON ENABLE_LTO=ON JOBS=3 NODE="--lts"
before_install:
- curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
- source $NVM_DIR/nvm.sh
- nvm install $NODE
- nvm use $NODE
- node --version
- if [[ ! -z $TARGET_ARCH ]] ; then source ./scripts/travis/before_install.$TARGET_ARCH.sh ; fi
- |
if [[ -z $JOBS ]]; then
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
export JOBS=$((`nproc` + 1))
elif [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
export JOBS=$((`sysctl -n hw.ncpu` + 1))
fi
fi
- |
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
sudo mdutil -i off /
fi
- export PACKAGE_JSON_VERSION=$(node -e "console.log(require('./package.json').version)")
- export PUBLISH=$([[ "${TRAVIS_TAG:-}" == "v${PACKAGE_JSON_VERSION}" ]] && echo "On" || echo "Off")
- echo "Using ${JOBS} jobs"
- npm ci --ignore-scripts
# Bootstrap cmake to be able to run mason
- CMAKE_URL="https://mason-binaries.s3.amazonaws.com/${TRAVIS_OS_NAME}-x86_64/cmake/${CMAKE_VERSION}.tar.gz"
- CMAKE_DIR="mason_packages/${TRAVIS_OS_NAME}-x86_64/cmake/${CMAKE_VERSION}"
- mkdir -p ${CMAKE_DIR}
- travis_retry wget --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C ${CMAKE_DIR} || travis_terminate 1
- export PATH=${CMAKE_DIR}/bin:${PATH}
- ${MASON} install tbb 2017_U7 && export LD_LIBRARY_PATH=$(${MASON} prefix tbb 2017_U7)/lib/:${LD_LIBRARY_PATH}
- ${MASON} install ccache ${CCACHE_VERSION} && export PATH=$(${MASON} prefix ccache ${CCACHE_VERSION})/bin:${PATH}
- |
if [[ ! -z ${CLANG_VERSION} ]]; then
export CCOMPILER='clang'
export CXXCOMPILER='clang++'
${MASON} install clang++ ${CLANG_VERSION} && export PATH=$(${MASON} prefix clang++ ${CLANG_VERSION})/bin:${PATH} || travis_terminate 1
# we only enable lto for release builds
# and therefore don't need to us ld.gold or llvm tools for linking
# for debug builds
if [[ ${BUILD_TYPE} == 'Release' ]]; then
${MASON} install binutils 2.27 && export PATH=$(${MASON} prefix binutils 2.27)/bin:${PATH} || travis_terminate 1
fi
fi
- ccache --max-size=256M # limiting the cache's size to roughly the previous job's object sizes
- export OSRM_INSTALL_DIR="$(pwd)/install-osrm"
- export OSRM_BUILD_DIR="$(pwd)/build-osrm"
- export CC=${CCOMPILER} CXX=${CXXCOMPILER}
- mkdir ${OSRM_BUILD_DIR}
install:
- pushd ${OSRM_BUILD_DIR}
- |
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DENABLE_MASON=${ENABLE_MASON:-OFF} \
-DENABLE_ASSERTIONS=${ENABLE_ASSERTIONS:-OFF} \
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS:-OFF} \
-DENABLE_COVERAGE=${ENABLE_COVERAGE:-OFF} \
-DENABLE_NODE_BINDINGS=${ENABLE_NODE_BINDINGS:-OFF} \
-DENABLE_SANITIZER=${ENABLE_SANITIZER:-OFF} \
-DBUILD_TOOLS=ON \
-DENABLE_CCACHE=ON \
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} \
-DENABLE_GLIBC_WORKAROUND=${ENABLE_GLIBC_WORKAROUND:-OFF}
- echo "travis_fold:start:MAKE"
- make --jobs=${JOBS}
- make tests --jobs=${JOBS}
- make benchmarks --jobs=${JOBS}
- echo "travis_fold:end:MAKE"
- ccache -s
- sudo make install
- |
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${OSRM_INSTALL_DIR}/lib
fi
- popd
- mkdir example/build && pushd example/build
- export PKG_CONFIG_PATH=${OSRM_INSTALL_DIR}/lib/pkgconfig
- cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
- make --jobs=${JOBS}
- popd
script:
- if [[ $TARGET_ARCH == armhf ]] ; then echo "Skip tests for $TARGET_ARCH" && exit 0 ; fi
- make -C test/data benchmark
- ./example/build/osrm-example test/data/mld/monaco.osrm
# All tests assume to be run from the build directory
- pushd ${OSRM_BUILD_DIR}
- ./unit_tests/library-tests
- ./unit_tests/extractor-tests
- ./unit_tests/contractor-tests
- ./unit_tests/engine-tests
- ./unit_tests/util-tests
- ./unit_tests/server-tests
- ./unit_tests/partitioner-tests
- ./unit_tests/customizer-tests
- |
if [ -z "${ENABLE_SANITIZER}" ] && [ "$TARGET_ARCH" != "i686" ]; then
npm run nodejs-tests
fi
- |
- popd
- npm test
deploy:
provider: releases
api_key:
secure: "Ej7tPd+XhAlBvA0SnYghYakO6QUwUI+oOtjlkPmy0UfKtIQ4bIzoIm1BDbPwrmNiCSKB7lLZYZpKz68PBRtblfqvTjhzXSzlvFk36pyywgkuNY13N3VQZo2c5CShLCy41nx4+uLkjhLfKYOALSE3OivdJJHLZEsSwx60Csx7owU="
skip_cleanup: true
file_glob: true
file: build/stage/**/*.tar.gz
on:
tags: true
condition: "$PUBLISH = 'On'"
+15 -1
View File
@@ -1,3 +1,17 @@
# 5.26.0-rc.2
- Changes from 5.25.0
- API:
- FIXED: Allow for special characters in the profile/method as part of the HTTP URL. [#6090](https://github.com/Project-OSRM/osrm-backend/pull/6090)
- FIXED: Set osrm-routed to immediately close bad connections [#6112](https://github.com/Project-OSRM/osrm-backend/pull/6112)
- Build:
- CHANGED: Replace Travis with Github Actions for CI builds [#6071](https://github.com/Project-OSRM/osrm-backend/pull/6071)
- FIXED: Fixed Boost link flags in pkg-config file. [#6083](https://github.com/Project-OSRM/osrm-backend/pull/6083)
- FIXED: Fixed test cache to consider MLD executable changes. [#6129](https://github.com/Project-OSRM/osrm-backend/pull/6129)
- Routing:
- FIXED: Fix generation of inefficient MLD partitions [#6084](https://github.com/Project-OSRM/osrm-backend/pull/6084)
- FIXED: Fix MLD level mask generation to support 64-bit masks. [#6123](https://github.com/Project-OSRM/osrm-backend/pull/6123)
- FIXED: Fix metric offset overflow for large MLD partitions. This breaks the **data format** [#6124](https://github.com/Project-OSRM/osrm-backend/pull/6124)
# 5.25.0
- Changes from 5.24.0
- Build:
@@ -115,7 +129,7 @@
](https://github.com/Project-OSRM/osrm-backend/pull/5076/)
- CHANGED: Foot profile now blacklists barriers instead of whitelisting them [#5077
](https://github.com/Project-OSRM/osrm-backend/pull/5077/)
- CHANGED: Support maxlength and maxweight in car profile [#5101](https://github.com/Project-OSRM/osrm-backend/pull/5101]
- CHANGED: Support maxlength and maxweight in car profile [#5101](https://github.com/Project-OSRM/osrm-backend/pull/5101)
- Bugfixes:
- FIXED: collapsing of ExitRoundabout instructions [#5114](https://github.com/Project-OSRM/osrm-backend/issues/5114)
- Misc:
+21 -5
View File
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.2)
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR AND NOT MSVC_IDE)
message(FATAL_ERROR "In-source builds are not allowed.
@@ -514,7 +514,7 @@ if(ENABLE_MASON)
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${LINKER_FLAGS}")
# current mason packages target -D_GLIBCXX_USE_CXX11_ABI=0
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
add_dependency_defines(-D_GLIBCXX_USE_CXX11_ABI=0)
# note: we avoid calling find_package(Osmium ...) here to ensure that the
# expat and bzip2 are used from mason rather than the system
@@ -802,9 +802,25 @@ set(PKGCONFIG_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include")
list(APPEND DEPENDENCIES_INCLUDE_DIRS "${PKGCONFIG_INCLUDE_DIR}")
list(APPEND DEPENDENCIES_INCLUDE_DIRS "${PKGCONFIG_INCLUDE_DIR}/osrm")
JOIN("-I${DEPENDENCIES_INCLUDE_DIRS}" " -I" PKGCONFIG_OSRM_INCLUDE_FLAGS)
JOIN("${ENGINE_LIBRARIES}" " " PKGCONFIG_OSRM_DEPENDENT_LIBRARIES)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/pkgconfig.in libosrm.pc @ONLY)
# Boost uses imported targets, we need to use a generator expression to extract
# the link libraries to be written to the pkg-config file.
foreach(engine_lib ${ENGINE_LIBRARIES})
if("${engine_lib}" MATCHES "^Boost.*")
list(APPEND PKGCONFIG_DEPENDENT_LIBRARIES "$<TARGET_LINKER_FILE:${engine_lib}>")
else()
list(APPEND PKGCONFIG_DEPENDENT_LIBRARIES "${engine_lib}")
endif()
endforeach(engine_lib)
JOIN("${PKGCONFIG_DEPENDENT_LIBRARIES}" " " PKGCONFIG_OSRM_DEPENDENT_LIBRARIES)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/pkgconfig.in pkgconfig.configured @ONLY)
file(GENERATE
OUTPUT
${PROJECT_BINARY_DIR}/libosrm.pc
INPUT
${PROJECT_BINARY_DIR}/pkgconfig.configured)
install(FILES ${PROJECT_BINARY_DIR}/libosrm.pc DESTINATION ${PKGCONFIG_LIBRARY_DIR}/pkgconfig)
# uninstall target
@@ -862,4 +878,4 @@ if (ENABLE_NODE_BINDINGS)
endforeach()
add_library(check-headers STATIC EXCLUDE_FROM_ALL ${sources})
set_target_properties(check-headers PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${check_headers_dir})
endif()
endif()
+1 -1
View File
@@ -44,7 +44,7 @@ unset(_lua_append_versions)
# this is a function only to have all the variables inside go away automatically
function(_lua_set_version_vars)
set(LUA_VERSIONS5 5.3 5.2 5.1 5.0)
set(LUA_VERSIONS5 5.4 5.3 5.2 5.1 5.0)
if (Lua_FIND_VERSION_EXACT)
if (Lua_FIND_VERSION_COUNT GREATER 1)
+9 -2
View File
@@ -244,9 +244,16 @@ osrm.match(options, function(err, response) {
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** containing `tracepoints` and `matchings`.
**`tracepoints`** Array of [`Ẁaypoint`](#waypoint) objects representing all points of the trace in order.
If the trace point was ommited by map matching because it is an outlier, the entry will be null.
Each `Waypoint` object includes two additional properties, 1) `matchings_index`: Index to the
[`Route`](#route) object in matchings the sub-trace was matched to, 2) `waypoint_index`: Index of
Each `Waypoint` object has the following additional properties,
1) `matchings_index`: Index to the
[`Route`](#route) object in matchings the sub-trace was matched to,
2) `waypoint_index`: Index of
the waypoint inside the matched route.
3) `alternatives_count`: Number of probable alternative matchings for this trace point. A value of zero indicate that this point was matched unambiguously. Split the trace at these points for incremental map matching.
**`matchings`** is an array of [`Route`](#route) objects that assemble the trace. Each `Route` object has an additional `confidence` property,
which is the confidence of the matching. float value between `0` and `1`. `1` is very confident that the matching is correct.
+5 -2
View File
@@ -114,9 +114,12 @@ module.exports = function() {
let dependencies = [
this.OSRM_EXTRACT_PATH,
this.OSRM_CONTRACT_PATH,
this.OSRM_CUSTOMIZE_PATH,
this.OSRM_PARTITION_PATH,
this.LIB_OSRM_EXTRACT_PATH,
this.LIB_OSRM_GUIDANCE_PATH,
this.LIB_OSRM_CONTRACT_PATH
this.LIB_OSRM_CONTRACT_PATH,
this.LIB_OSRM_CUSTOMIZE_PATH,
this.LIB_OSRM_PARTITION_PATH
];
var addLuaFiles = (directory, callback) => {
+5 -2
View File
@@ -67,10 +67,13 @@ module.exports = function () {
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_CUSTOMIZE_PATH = path.resolve(util.format('%s/%s%s', this.BIN_PATH, 'osrm-customize', this.EXE));
this.OSRM_PARTITION_PATH = path.resolve(util.format('%s/%s%s', this.BIN_PATH, 'osrm-partition', 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/' + this.LIB, this.BIN_PATH, 'osrm_extract'),
this.LIB_OSRM_GUIDANCE_PATH = util.format('%s/' + this.LIB, this.BIN_PATH, 'osrm_guidance'),
this.LIB_OSRM_CONTRACT_PATH = util.format('%s/' + this.LIB, this.BIN_PATH, 'osrm_contract'),
this.LIB_OSRM_CUSTOMIZE_PATH = util.format('%s/' + this.LIB, this.BIN_PATH, 'osrm_customize'),
this.LIB_OSRM_PARTITION_PATH = util.format('%s/' + this.LIB, this.BIN_PATH, 'osrm_partition'),
this.LIB_OSRM_PATH = util.format('%s/' + this.LIB, this.BIN_PATH, 'osrm');
// eslint-disable-next-line no-console
@@ -111,7 +114,7 @@ module.exports = function () {
};
var q = d3.queue();
[this.OSRM_EXTRACT_PATH, this.OSRM_CONTRACT_PATH, this.OSRM_ROUTED_PATH].forEach(bin => { q.defer(verify, bin); });
[this.OSRM_EXTRACT_PATH, this.OSRM_CONTRACT_PATH, this.OSRM_CUSTOMIZE_PATH, this.OSRM_PARTITION_PATH, this.OSRM_ROUTED_PATH].forEach(bin => { q.defer(verify, bin); });
q.awaitAll(callback);
};
+2 -4
View File
@@ -52,11 +52,9 @@ namespace detail
template <storage::Ownership Ownership> class CellStorageImpl
{
public:
using ValueOffset = std::uint32_t;
using BoundaryOffset = std::uint32_t;
using ValueOffset = std::uint64_t;
using BoundaryOffset = std::uint64_t;
using BoundarySize = std::uint32_t;
using SourceIndex = std::uint32_t;
using DestinationIndex = std::uint32_t;
static constexpr auto INVALID_VALUE_OFFSET = std::numeric_limits<ValueOffset>::max();
static constexpr auto INVALID_BOUNDARY_OFFSET = std::numeric_limits<BoundaryOffset>::max();
+10 -5
View File
@@ -186,11 +186,12 @@ template <storage::Ownership Ownership> class MultiLevelPartitionImpl final
auto bits = static_cast<std::uint64_t>(std::ceil(std::log2(num_cells + 1)));
offsets[lidx++] = sum_bits;
sum_bits += bits;
if (sum_bits > 64)
if (sum_bits > NUM_PARTITION_BITS)
{
throw util::exception(
"Can't pack the partition information at level " + std::to_string(lidx) +
" into a 64bit integer. Would require " + std::to_string(sum_bits) + " bits.");
" into a " + std::to_string(NUM_PARTITION_BITS) +
"bit integer. Would require " + std::to_string(sum_bits) + " bits.");
}
}
// sentinel
@@ -211,11 +212,15 @@ template <storage::Ownership Ownership> class MultiLevelPartitionImpl final
[&](const auto offset, const auto next_offset) {
// create mask that has `bits` ones at its LSBs.
// 000011
BOOST_ASSERT(offset < NUM_PARTITION_BITS);
BOOST_ASSERT(offset <= NUM_PARTITION_BITS);
PartitionID mask = (1ULL << offset) - 1ULL;
// 001111
BOOST_ASSERT(next_offset < NUM_PARTITION_BITS);
PartitionID next_mask = (1ULL << next_offset) - 1ULL;
BOOST_ASSERT(next_offset <= NUM_PARTITION_BITS);
// Check offset for shift overflow. Offsets are strictly increasing,
// so we only need the check on the last mask.
PartitionID next_mask = next_offset == NUM_PARTITION_BITS
? -1ULL
: (1ULL << next_offset) - 1ULL;
// 001100
masks[lidx++] = next_mask ^ mask;
});
+4
View File
@@ -101,6 +101,10 @@ class Server
new_connection->socket(),
boost::bind(&Server::HandleAccept, this, boost::asio::placeholders::error));
}
else
{
util::Log(logERROR) << "HandleAccept error: " << e.message();
}
}
unsigned thread_pool_size;
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "osrm",
"version": "5.25.0",
"version": "5.26.0-unreleased",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "osrm",
"version": "5.25.0",
"version": "5.26.0-rc.2",
"private": false,
"description": "The Open Source Routing Machine is a high performance routing engine written in C++14 designed to run on OpenStreetMap data.",
"dependencies": {
+1 -1
View File
@@ -432,8 +432,8 @@ function process_way(profile, way, result, relations)
-- compute speed taking into account way type, maxspeed tags, etc.
WayHandlers.speed,
WayHandlers.surface,
WayHandlers.maxspeed,
WayHandlers.surface,
WayHandlers.penalties,
-- compute class labels
@@ -412,6 +412,13 @@ EdgeBasedGraphFactory::GenerateEdgeExpandedNodes(const WayRestrictionMap &way_re
m_edge_based_node_distances.push_back(
m_edge_based_node_distances[nbe_to_ebn_mapping[eid]]);
// Include duplicate nodes in cnbg to ebg mapping. This means a
// compressed node pair (u,v) can appear multiple times in this list.
// This is needed by the MLD partition step to ensure duplicate nodes
// are also assigned to partitions (the MLD partitioner is currently
// the only consumer of this mapping).
mapping.push_back(NBGToEBG{node_u, node_v, edge_based_node_id, SPECIAL_NODEID});
edge_based_node_id++;
progress.PrintStatus(progress_counter++);
}
@@ -1,14 +1,8 @@
#include "extractor/maneuver_override_relation_parser.hpp"
#include "extractor/maneuver_override.hpp"
#include "util/log.hpp"
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/algorithm/string/regex.hpp>
#include <boost/optional/optional.hpp>
#include <boost/ref.hpp>
#include <boost/regex.hpp>
#include <osmium/osm.hpp>
#include <osmium/tags/filter.hpp>
+8 -9
View File
@@ -5,10 +5,8 @@
#include "util/log.hpp"
#include <boost/algorithm/string/predicate.hpp>
#include <boost/algorithm/string/regex.hpp>
#include <boost/optional/optional.hpp>
#include <boost/ref.hpp>
#include <boost/regex.hpp>
#include <osmium/osm.hpp>
#include <osmium/tags/regex_filter.hpp>
@@ -244,14 +242,15 @@ bool RestrictionParser::ShouldIgnoreRestriction(const std::string &except_tag_st
// Be warned, this is quadratic work here, but we assume that
// only a few exceptions are actually defined.
std::vector<std::string> exceptions;
boost::algorithm::split_regex(exceptions, except_tag_string, boost::regex("[;][ ]*"));
const std::regex delimiter_re("[;][ ]*");
std::sregex_token_iterator except_tags_begin(
except_tag_string.begin(), except_tag_string.end(), delimiter_re, -1);
std::sregex_token_iterator except_tags_end;
return std::any_of(
std::begin(exceptions), std::end(exceptions), [&](const std::string &current_string) {
return std::end(restrictions) !=
std::find(std::begin(restrictions), std::end(restrictions), current_string);
});
return std::any_of(except_tags_begin, except_tags_end, [&](const std::string &current_string) {
return std::end(restrictions) !=
std::find(std::begin(restrictions), std::end(restrictions), current_string);
});
}
} // namespace extractor
} // namespace osrm
+4
View File
@@ -118,6 +118,10 @@ int Partitioner::Run(const PartitionerConfig &config)
edge_based_partition_ids[backward_node] = node_based_partition_ids[v];
}
BOOST_ASSERT(std::none_of(edge_based_partition_ids.begin(),
edge_based_partition_ids.end(),
[](auto x) { return x == SPECIAL_NODEID; }));
std::vector<Partition> partitions;
std::vector<std::uint32_t> level_to_num_cells;
std::tie(partitions, level_to_num_cells) =
+6 -6
View File
@@ -26,15 +26,15 @@ struct URLParser final : qi::grammar<Iterator, Into>
{
using boost::spirit::repository::qi::iter_pos;
alpha_numeral = qi::char_("a-zA-Z0-9");
identifier = qi::char_("a-zA-Z0-9_.~:-");
percent_encoding =
qi::char_('%') > qi::uint_parser<unsigned char, 16, 2, 2>()[qi::_val = qi::_1];
polyline_chars = qi::char_("a-zA-Z0-9_.--[]{}@?|\\~`^") | percent_encoding;
all_chars = polyline_chars | qi::char_("=,;:&().");
polyline_chars = qi::char_("a-zA-Z0-9_[]{}@?|\\~`^") | percent_encoding;
all_chars = polyline_chars | qi::char_("=,;:&().-");
service = +alpha_numeral;
service = +identifier;
version = qi::uint_;
profile = +alpha_numeral;
profile = +identifier;
query = +all_chars;
// Example input: /route/v1/driving/7.416351,43.731205;7.420363,43.736189
@@ -54,7 +54,7 @@ struct URLParser final : qi::grammar<Iterator, Into>
qi::rule<Iterator, std::string()> profile;
qi::rule<Iterator, std::string()> query;
qi::rule<Iterator, char()> alpha_numeral;
qi::rule<Iterator, char()> identifier;
qi::rule<Iterator, char()> all_chars;
qi::rule<Iterator, char()> polyline_chars;
qi::rule<Iterator, char()> percent_encoding;
+13 -3
View File
@@ -3,13 +3,10 @@
#include "server/request_parser.hpp"
#include <boost/algorithm/string/predicate.hpp>
#include <boost/assert.hpp>
#include <boost/bind.hpp>
#include <boost/iostreams/filter/gzip.hpp>
#include <boost/iostreams/filtering_stream.hpp>
#include <iterator>
#include <string>
#include <vector>
namespace osrm
@@ -48,6 +45,12 @@ void Connection::handle_read(const boost::system::error_code &error, std::size_t
{
if (error)
{
if (error != boost::asio::error::operation_aborted)
{
// Error not triggered by timer expiry, commence connection shutdown.
util::Log(logDEBUG) << "Connection read error: " << error.message();
handle_shutdown();
}
return;
}
@@ -73,6 +76,7 @@ void Connection::handle_read(const boost::system::error_code &error, std::size_t
current_request.endpoint = TCP_socket.remote_endpoint(ec).address();
if (ec)
{
util::Log(logDEBUG) << "Socket remote endpoint error: " << ec.message();
handle_shutdown();
return;
}
@@ -165,6 +169,10 @@ void Connection::handle_write(const boost::system::error_code &error)
handle_shutdown();
}
}
else
{
util::Log(logDEBUG) << "Connection write error: " << error.message();
}
}
/// Handle completion of a timeout timer..
@@ -183,6 +191,8 @@ void Connection::handle_timeout(boost::system::error_code ec)
void Connection::handle_shutdown()
{
// Cancel timer to ensure all resources are released immediately on shutdown.
timer.cancel();
// Initiate graceful connection closure.
boost::system::error_code ignore_error;
TCP_socket.shutdown(boost::asio::ip::tcp::socket::shutdown_both, ignore_error);
+2 -3
View File
@@ -6,7 +6,6 @@
#include "engine/api/json_factory.hpp"
#include "osrm/coordinate.hpp"
#include <iterator>
#include <vector>
using namespace osrm;
@@ -27,7 +26,7 @@ BOOST_AUTO_TEST_CASE(test_json_linestring)
const auto coords = geom.values["coordinates"].get<util::json::Array>().values;
BOOST_CHECK_EQUAL(coords.size(), 3); // array of three location arrays
for (const auto each : coords)
for (const auto &each : coords)
{
const auto loc = each.get<util::json::Array>().values;
BOOST_CHECK_EQUAL(loc.size(), 2);
@@ -53,7 +52,7 @@ BOOST_AUTO_TEST_CASE(test_json_single_point)
const auto coords = geom.values["coordinates"].get<util::json::Array>().values;
BOOST_CHECK_EQUAL(coords.size(), 2); // array of two location arrays
for (const auto each : coords)
for (const auto &each : coords)
{
const auto loc = each.get<util::json::Array>().values;
BOOST_CHECK_EQUAL(loc.size(), 2);
+1 -1
View File
@@ -184,7 +184,7 @@ BOOST_AUTO_TEST_CASE(test_match_fb_serialization)
const auto matchings = fb->routes();
const auto &number_of_matchings = matchings->size();
for (const auto &waypoint : *waypoints)
for (const auto waypoint : *waypoints)
{
BOOST_CHECK(waypoint_check(waypoint));
const auto matchings_index = waypoint->matchings_index();
+1 -1
View File
@@ -202,7 +202,7 @@ BOOST_AUTO_TEST_CASE(test_nearest_fb_serialization)
auto waypoints = fb->waypoints();
BOOST_CHECK(waypoints->size() > 0); // the dataset has at least one nearest coordinate
for (const auto &waypoint : *waypoints)
for (const auto waypoint : *waypoints)
{
BOOST_CHECK(waypoint->distance() >= 0);
BOOST_CHECK(waypoint->nodes()->first() != 0);
+5 -5
View File
@@ -263,7 +263,7 @@ void test_route_same_coordinates(bool use_json_only_api)
const auto &entries = intersection_object.at("entry").get<json::Array>().values;
BOOST_CHECK(bearings.size() == entries.size());
for (const auto bearing : bearings)
for (const auto &bearing : bearings)
BOOST_CHECK(0. <= bearing.get<json::Number>().value &&
bearing.get<json::Number>().value <= 360.);
@@ -619,7 +619,7 @@ BOOST_AUTO_TEST_CASE(test_route_serialize_fb)
const auto waypoints = fb->waypoints();
BOOST_CHECK(waypoints->size() == params.coordinates.size());
for (const auto &waypoint : *waypoints)
for (const auto waypoint : *waypoints)
{
const auto longitude = waypoint->location()->longitude();
const auto latitude = waypoint->location()->latitude();
@@ -633,7 +633,7 @@ BOOST_AUTO_TEST_CASE(test_route_serialize_fb)
const auto routes = fb->routes();
BOOST_REQUIRE_GT(routes->size(), 0);
for (const auto &route : *routes)
for (const auto route : *routes)
{
BOOST_CHECK_EQUAL(route->distance(), 0);
BOOST_CHECK_EQUAL(route->duration(), 0);
@@ -641,7 +641,7 @@ BOOST_AUTO_TEST_CASE(test_route_serialize_fb)
const auto &legs = route->legs();
BOOST_CHECK(legs->size() > 0);
for (const auto &leg : *legs)
for (const auto leg : *legs)
{
BOOST_CHECK_EQUAL(leg->distance(), 0);
@@ -720,7 +720,7 @@ BOOST_AUTO_TEST_CASE(test_route_serialize_fb_skip_waypoints)
const auto routes = fb->routes();
BOOST_REQUIRE_GT(routes->size(), 0);
for (const auto &route : *routes)
for (const auto route : *routes)
{
BOOST_CHECK_EQUAL(route->distance(), 0);
BOOST_CHECK_EQUAL(route->duration(), 0);
+2 -2
View File
@@ -332,14 +332,14 @@ BOOST_AUTO_TEST_CASE(test_table_serialiaze_fb)
// check destinations array of waypoint objects
const auto &destinations_array = fb->table()->destinations();
BOOST_CHECK_EQUAL(destinations_array->size(), params.destinations.size());
for (const auto &destination : *destinations_array)
for (const auto destination : *destinations_array)
{
BOOST_CHECK(waypoint_check(destination));
}
// check sources array of waypoint objects
const auto &sources_array = fb->waypoints();
BOOST_CHECK_EQUAL(sources_array->size(), params.sources.size());
for (const auto &source : *sources_array)
for (const auto source : *sources_array)
{
BOOST_CHECK(waypoint_check(source));
}
+1 -1
View File
@@ -525,7 +525,7 @@ BOOST_AUTO_TEST_CASE(test_roundtrip_response_fb_serialization)
const auto trips = fb->routes();
BOOST_CHECK_EQUAL(trips->size(), 1);
for (const auto &waypoint : *waypoints)
for (const auto waypoint : *waypoints)
{
const auto longitude = waypoint->location()->longitude();
const auto latitude = waypoint->location()->latitude();
@@ -1,6 +1,8 @@
#include <boost/numeric/conversion/cast.hpp>
#include <boost/test/unit_test.hpp>
#include "util/exception.hpp"
#include "util/for_each_indexed.hpp"
#include <util/integer_range.hpp>
#include <util/msb.hpp>
@@ -230,4 +232,59 @@ BOOST_AUTO_TEST_CASE(large_cell_number)
}
}
BOOST_AUTO_TEST_CASE(cell_64_bits)
{
// bits = ceil(log2(2458529 + 1)) + ceil(log2(258451 + 1)) + ceil(log2(16310 + 1)) +
// ceil(log2(534 + 1))
// = 22 + 18 + 14 + 10
// = 64
const size_t NUM_PARTITIONS = 2458529;
const std::vector<size_t> level_cells = {NUM_PARTITIONS, 258451, 16310, 534};
std::vector<std::vector<CellID>> levels(level_cells.size(),
std::vector<CellID>(level_cells[0]));
std::vector<uint32_t> levels_to_num_cells(level_cells.size());
const auto set_level_cells = [&](size_t level, auto const num_cells) {
for (auto val : util::irange<size_t>(0ULL, NUM_PARTITIONS))
{
levels[level][val] = std::min(val, num_cells - 1);
}
levels_to_num_cells[level] = num_cells;
};
util::for_each_indexed(level_cells.cbegin(), level_cells.cend(), set_level_cells);
MultiLevelPartition mlp{levels, levels_to_num_cells};
BOOST_REQUIRE_EQUAL(mlp.GetNumberOfCells(1), level_cells[0]);
BOOST_REQUIRE_EQUAL(mlp.GetNumberOfCells(2), level_cells[1]);
BOOST_REQUIRE_EQUAL(mlp.GetNumberOfCells(3), level_cells[2]);
BOOST_REQUIRE_EQUAL(mlp.GetNumberOfCells(4), level_cells[3]);
}
BOOST_AUTO_TEST_CASE(cell_overflow_bits)
{
// bits = ceil(log2(4194304 + 1)) + ceil(log2(262144 + 1)) + ceil(log2(16384 + 1)) +
// ceil(log2(1024 + 1))
// = 23 + 19 + 15 + 11
// = 68
const size_t NUM_PARTITIONS = 4194304;
const std::vector<size_t> level_cells = {NUM_PARTITIONS, 262144, 16384, 1024};
std::vector<std::vector<CellID>> levels(level_cells.size(),
std::vector<CellID>(level_cells[0]));
std::vector<uint32_t> levels_to_num_cells(level_cells.size());
const auto set_level_cells = [&](size_t level, auto const num_cells) {
for (auto val : util::irange<size_t>(0ULL, NUM_PARTITIONS))
{
levels[level][val] = std::min(val, num_cells - 1);
}
levels_to_num_cells[level] = num_cells;
};
util::for_each_indexed(level_cells.cbegin(), level_cells.cend(), set_level_cells);
BOOST_REQUIRE_EXCEPTION(MultiLevelPartition(levels, levels_to_num_cells),
util::exception,
[](auto) { return true; });
}
BOOST_AUTO_TEST_SUITE_END()
+13 -1
View File
@@ -44,7 +44,7 @@ BOOST_AUTO_TEST_CASE(invalid_urls)
BOOST_CHECK_EQUAL(testInvalidURL("/route/"), 7UL);
BOOST_CHECK_EQUAL(testInvalidURL("/route/bla"), 7UL);
BOOST_CHECK_EQUAL(testInvalidURL("/route/1/1,2;3;4"), 7UL);
BOOST_CHECK_EQUAL(testInvalidURL("/route/v1/pro_file/1,2;3,4"), 13UL);
BOOST_CHECK_EQUAL(testInvalidURL("/route/v1/pro[]file/1,2;3,4"), 13UL);
BOOST_CHECK_EQUAL(testInvalidURL("/route/v1/profile"), 17UL);
BOOST_CHECK_EQUAL(testInvalidURL("/route/v1/profile/"), 18UL);
}
@@ -124,6 +124,18 @@ BOOST_AUTO_TEST_CASE(valid_urls)
BOOST_CHECK_EQUAL(reference_8.profile, result_8->profile);
CHECK_EQUAL_RANGE(reference_8.query, result_8->query);
BOOST_CHECK_EQUAL(reference_8.prefix_length, result_8->prefix_length);
// profile with special characters
api::ParsedURL reference_9{
"route", 1, "foo-bar_baz.profile", "0,1;2,3;4,5?options=value&foo=bar", 30UL};
auto result_9 =
api::parseURL("/route/v1/foo-bar_baz.profile/0,1;2,3;4,5?options=value&foo=bar");
BOOST_CHECK(result_9);
BOOST_CHECK_EQUAL(reference_9.service, result_9->service);
BOOST_CHECK_EQUAL(reference_9.version, result_9->version);
BOOST_CHECK_EQUAL(reference_9.profile, result_9->profile);
CHECK_EQUAL_RANGE(reference_9.query, result_9->query);
BOOST_CHECK_EQUAL(reference_9.prefix_length, result_9->prefix_length);
}
BOOST_AUTO_TEST_SUITE_END()