Compare commits

..

37 Commits

Author SHA1 Message Date
Siarhei Fedartsou 3d9f0c6549 Try to fix flaky tests 2024-11-03 18:51:42 +01:00
Siarhei Fedartsou 21c9f5d17d Merge branch 'master' into sf-try-to-fix-flaky-tests 2024-11-03 18:32:04 +01:00
Siarhei Fedartsou 6f73d2b4e0 Try to fix flaky tests 2024-11-03 18:31:01 +01:00
Siarhei Fedartsou 40446e416f Try to fix flaky tests 2024-11-03 18:30:45 +01:00
Siarhei Fedartsou 3614af7f64 Use std::string_view for key type in json::Object (#7062) 2024-11-03 18:23:23 +01:00
Siarhei Fedartsou 24e4068d07 Try to fix flaky tests 2024-11-03 18:22:56 +01:00
Siarhei Fedartsou c4edaad85d Try to fix flaky tests 2024-11-03 17:29:41 +01:00
Siarhei Fedartsou 13c92c72d5 Try to fix flaky tests 2024-11-03 17:25:02 +01:00
Siarhei Fedartsou baada3bd49 Try to fix flaky tests 2024-11-03 17:21:28 +01:00
Siarhei Fedartsou 1c2410b57d Try to fix flaky tests 2024-11-03 17:20:28 +01:00
Siarhei Fedartsou 74aab7b2ea Try to fix flaky tests 2024-11-03 17:12:50 +01:00
Siarhei Fedartsou 832b576549 wip 2024-11-03 15:26:31 +01:00
Siarhei Fedartsou b65d8f1e34 Try to fix flaky tests 2024-11-03 15:16:20 +01:00
Siarhei Fedartsou c01685f38d Try to fix flaky tests 2024-11-03 15:12:21 +01:00
Siarhei Fedartsou f0bb5faa6a wip 2024-11-03 14:59:10 +01:00
Siarhei Fedartsou 1b0a89fbd0 wip 2024-11-03 14:57:50 +01:00
Siarhei Fedartsou 69777e2784 wip 2024-11-03 14:56:31 +01:00
Siarhei Fedartsou cf4f04d08f wip 2024-11-03 13:56:55 +01:00
Siarhei Fedartsou 9c6a78e865 wip 2024-11-03 13:36:17 +01:00
Siarhei Fedartsou c46f92b6c3 wip 2024-11-03 13:28:56 +01:00
Siarhei Fedartsou b9d095e644 wip 2024-11-03 13:24:12 +01:00
Siarhei Fedartsou 1bf831a318 wip 2024-11-03 13:15:59 +01:00
Siarhei Fedartsou d5ab66496c wip 2024-11-03 13:07:28 +01:00
Siarhei Fedartsou 5b69c0a7f2 wip 2024-11-03 13:01:33 +01:00
Siarhei Fedartsou 7f70f9068a wip 2024-11-03 12:52:53 +01:00
Siarhei Fedartsou 761883e8d6 wip 2024-11-03 12:47:34 +01:00
Siarhei Fedartsou 09020115d2 wip 2024-11-03 12:41:33 +01:00
Siarhei Fedartsou c3e9e12fc3 wip 2024-11-03 12:21:12 +01:00
Siarhei Fedartsou 5581ac16bd wip 2024-11-03 12:19:36 +01:00
Siarhei Fedartsou bd3d409f03 wip 2024-11-03 12:18:57 +01:00
Siarhei Fedartsou 668dafc242 wip 2024-11-03 12:06:03 +01:00
Siarhei Fedartsou ea1f2be3d4 wip 2024-11-03 11:58:34 +01:00
Siarhei Fedartsou 1ae0a6e275 wip 2024-11-02 14:38:34 +01:00
Siarhei Fedartsou 085f852315 wip 2024-11-02 14:20:01 +01:00
Siarhei Fedartsou 918c33cb2d wip 2024-11-02 11:36:10 +01:00
Siarhei Fedartsou a94368cc87 Use std::string_view for key type in json::Object 2024-11-02 11:24:19 +01:00
Siarhei Fedartsou 97872e34d8 Use std::string_view for key type in json::Object 2024-11-02 11:23:06 +01:00
14 changed files with 1710 additions and 653 deletions
+437 -429
View File
@@ -23,222 +23,218 @@ concurrency:
cancel-in-progress: true cancel-in-progress: true
jobs: jobs:
windows-release-node: # windows-release-node:
needs: format-taginfo-docs # needs: format-taginfo-docs
runs-on: windows-2022 # runs-on: windows-2022
continue-on-error: false # continue-on-error: false
env: # env:
BUILD_TYPE: Release # BUILD_TYPE: Release
steps: # steps:
- uses: actions/checkout@v4 # - uses: actions/checkout@v4
- run: cmake --version # - run: pip install "conan<2.0.0"
- uses: actions/setup-node@v4 # - run: conan --version
with: # - run: cmake --version
node-version: 18 # - uses: actions/setup-node@v4
- run: node --version # with:
- run: npm --version # node-version: 18
- name: Prepare environment # - run: node --version
shell: bash # - run: npm --version
run: | # - name: Prepare environment
PACKAGE_JSON_VERSION=$(node -e "console.log(require('./package.json').version)") # shell: bash
echo PUBLISH=$([[ "${GITHUB_REF:-}" == "refs/tags/v${PACKAGE_JSON_VERSION}" ]] && echo "On" || echo "Off") >> $GITHUB_ENV # run: |
- run: npm install --ignore-scripts # PACKAGE_JSON_VERSION=$(node -e "console.log(require('./package.json').version)")
- run: npm link --ignore-scripts # echo PUBLISH=$([[ "${GITHUB_REF:-}" == "refs/tags/v${PACKAGE_JSON_VERSION}" ]] && echo "On" || echo "Off") >> $GITHUB_ENV
- name: Build # - run: npm install --ignore-scripts
shell: bash # - run: npm link --ignore-scripts
run: | # - name: Build
mkdir build # shell: bash
cd build # run: |
# mkdir build
# cd build
# cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_CONAN=ON -DENABLE_NODE_BINDINGS=ON ..
# cmake --build . --config Release
python3 -m venv .venv # # TODO: MSVC goes out of memory when building our tests
source .venv/Scripts/Activate # # - name: Run tests
python3 -m pip install conan==2.7.1 # # shell: bash
conan profile detect --force # # run: |
# # cd build
# # cmake --build . --config Release --target tests
# # # TODO: run tests
# # - name: Run node tests
# # shell: bash
# # run: |
# # ./lib/binding/osrm-extract.exe -p profiles/car.lua test/data/monaco.osm.pbf
cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_CONAN=ON -DENABLE_NODE_BINDINGS=ON .. # # mkdir -p test/data/ch
cmake --build . --config Release # # cp test/data/monaco.osrm* test/data/ch/
# # ./lib/binding/osrm-contract.exe test/data/ch/monaco.osrm
# TODO: MSVC goes out of memory when building our tests # # ./lib/binding/osrm-datastore.exe test/data/ch/monaco.osrm
# - name: Run tests # # node test/nodejs/index.js
# shell: bash # - name: Build Node package
# run: | # shell: bash
# cd build # run: ./scripts/ci/node_package.sh
# cmake --build . --config Release --target tests # - name: Publish Node package
# # TODO: run tests # if: ${{ env.PUBLISH == 'On' }}
# - name: Run node tests # uses: ncipollo/release-action@v1
# shell: bash # with:
# run: | # allowUpdates: true
# ./lib/binding/osrm-extract.exe -p profiles/car.lua test/data/monaco.osm.pbf # artifactErrorsFailBuild: true
# artifacts: build/stage/**/*.tar.gz
# omitBody: true
# omitBodyDuringUpdate: true
# omitName: true
# omitNameDuringUpdate: true
# replacesArtifacts: true
# token: ${{ secrets.GITHUB_TOKEN }}
# mkdir -p test/data/ch # format-taginfo-docs:
# cp test/data/monaco.osrm* test/data/ch/ # runs-on: ubuntu-22.04
# ./lib/binding/osrm-contract.exe test/data/ch/monaco.osrm # steps:
# - uses: actions/checkout@v4
# - name: Use Node.js
# uses: actions/setup-node@v4
# with:
# node-version: 18
# - name: Enable Node.js cache
# uses: actions/cache@v4
# with:
# path: ~/.npm
# key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
# restore-keys: |
# ${{ runner.os }}-node-
# - name: Prepare environment
# run: |
# npm ci --ignore-scripts
# clang-format-15 --version
# - 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
# npm run docs && ./scripts/error_on_dirty.sh
# npm audit --production
# ./lib/binding/osrm-datastore.exe test/data/ch/monaco.osrm # docker-image-matrix:
# node test/nodejs/index.js # strategy:
- name: Build Node package # matrix:
shell: bash # docker-base-image: ["debian", "alpine"]
run: ./scripts/ci/node_package.sh # needs: format-taginfo-docs
- name: Publish Node package # runs-on: ubuntu-22.04
if: ${{ env.PUBLISH == 'On' }} # continue-on-error: false
uses: ncipollo/release-action@v1 # steps:
with: # - name: Check out the repo
allowUpdates: true # uses: actions/checkout@v4
artifactErrorsFailBuild: true # - name: Enable osm.pbf cache
artifacts: build/stage/**/*.tar.gz # uses: actions/cache@v4
omitBody: true # with:
omitBodyDuringUpdate: true # path: berlin-latest.osm.pbf
omitName: true # key: v1-berlin-osm-pbf
omitNameDuringUpdate: true # restore-keys: |
replacesArtifacts: true # v1-berlin-osm-pbf
token: ${{ secrets.GITHUB_TOKEN }} # - name: Docker build
# run: |
# docker build -t osrm-backend-local -f docker/Dockerfile-${{ matrix.docker-base-image }} .
# - name: Test Docker image
# run: |
# if [ ! -f "${PWD}/berlin-latest.osm.pbf" ]; then
# wget http://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf
# fi
# TAG=osrm-backend-local
# # when `--memory-swap` value equals `--memory` it means container won't use swap
# # see https://docs.docker.com/config/containers/resource_constraints/#--memory-swap-details
# MEMORY_ARGS="--memory=1g --memory-swap=1g"
# docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-extract --dump-nbg-graph -p /opt/car.lua /data/berlin-latest.osm.pbf
# docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-components /data/berlin-latest.osrm.nbg /data/berlin-latest.geojson
# if [ ! -s "${PWD}/berlin-latest.geojson" ]
# then
# >&2 echo "No berlin-latest.geojson found"
# exit 1
# fi
# # removing `.osrm.nbg` to check that whole pipeline works without it
# rm -rf "${PWD}/berlin-latest.osrm.nbg"
format-taginfo-docs: # docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-partition /data/berlin-latest.osrm
runs-on: ubuntu-22.04 # docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-customize /data/berlin-latest.osrm
steps: # docker run $MEMORY_ARGS --name=osrm-container -t -p 5000:5000 -v "${PWD}:/data" "${TAG}" osrm-routed --algorithm mld /data/berlin-latest.osrm &
- uses: actions/checkout@v4 # curl --retry-delay 3 --retry 10 --retry-all-errors "http://127.0.0.1:5000/route/v1/driving/13.388860,52.517037;13.385983,52.496891?steps=true"
- name: Use Node.js # docker stop osrm-container
uses: actions/setup-node@v4
with:
node-version: 18
- name: Enable Node.js cache
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Prepare environment
run: |
npm ci --ignore-scripts
clang-format-15 --version
- 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
npm run docs && ./scripts/error_on_dirty.sh
npm audit --production
docker-image-matrix:
strategy:
matrix:
docker-base-image: ["debian", "alpine"]
needs: format-taginfo-docs
runs-on: ubuntu-22.04
continue-on-error: false
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Enable osm.pbf cache
uses: actions/cache@v4
with:
path: berlin-latest.osm.pbf
key: v1-berlin-osm-pbf
restore-keys: |
v1-berlin-osm-pbf
- name: Docker build
run: |
docker build -t osrm-backend-local -f docker/Dockerfile-${{ matrix.docker-base-image }} .
- name: Test Docker image
run: |
if [ ! -f "${PWD}/berlin-latest.osm.pbf" ]; then
wget http://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf
fi
TAG=osrm-backend-local
# when `--memory-swap` value equals `--memory` it means container won't use swap
# see https://docs.docker.com/config/containers/resource_constraints/#--memory-swap-details
MEMORY_ARGS="--memory=1g --memory-swap=1g"
docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-extract --dump-nbg-graph -p /opt/car.lua /data/berlin-latest.osm.pbf
docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-components /data/berlin-latest.osrm.nbg /data/berlin-latest.geojson
if [ ! -s "${PWD}/berlin-latest.geojson" ]
then
>&2 echo "No berlin-latest.geojson found"
exit 1
fi
# removing `.osrm.nbg` to check that whole pipeline works without it
rm -rf "${PWD}/berlin-latest.osrm.nbg"
docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-partition /data/berlin-latest.osrm
docker run $MEMORY_ARGS -t -v "${PWD}:/data" "${TAG}" osrm-customize /data/berlin-latest.osrm
docker run $MEMORY_ARGS --name=osrm-container -t -p 5000:5000 -v "${PWD}:/data" "${TAG}" osrm-routed --algorithm mld /data/berlin-latest.osrm &
curl --retry-delay 3 --retry 10 --retry-all-errors "http://127.0.0.1:5000/route/v1/driving/13.388860,52.517037;13.385983,52.496891?steps=true"
docker stop osrm-container
build-test-publish: build-test-publish:
needs: format-taginfo-docs #needs: format-taginfo-docs
strategy: strategy:
matrix: matrix:
include: include:
- name: gcc-13-debug-cov # - name: gcc-13-debug-cov
continue-on-error: false # continue-on-error: false
node: 20 # node: 20
runs-on: ubuntu-24.04 # runs-on: ubuntu-24.04
BUILD_TOOLS: ON # BUILD_TOOLS: ON
BUILD_TYPE: Debug # BUILD_TYPE: Debug
CCOMPILER: gcc-13 # CCOMPILER: gcc-13
CUCUMBER_TIMEOUT: 20000 # CUCUMBER_TIMEOUT: 20000
CXXCOMPILER: g++-13 # CXXCOMPILER: g++-13
ENABLE_COVERAGE: ON # ENABLE_COVERAGE: ON
- name: clang-18-debug-asan-ubsan # - name: clang-18-debug-asan-ubsan
continue-on-error: false # continue-on-error: false
node: 20 # node: 20
runs-on: ubuntu-24.04 # runs-on: ubuntu-24.04
BUILD_TOOLS: ON # BUILD_TOOLS: ON
BUILD_TYPE: Debug # BUILD_TYPE: Debug
CCOMPILER: clang-18 # CCOMPILER: clang-18
CUCUMBER_TIMEOUT: 20000 # CUCUMBER_TIMEOUT: 20000
CXXCOMPILER: clang++-18 # CXXCOMPILER: clang++-18
ENABLE_SANITIZER: ON # ENABLE_SANITIZER: ON
TARGET_ARCH: x86_64-asan-ubsan # TARGET_ARCH: x86_64-asan-ubsan
OSRM_CONNECTION_RETRIES: 10 # OSRM_CONNECTION_RETRIES: 10
OSRM_CONNECTION_EXP_BACKOFF_COEF: 1.5 # OSRM_CONNECTION_EXP_BACKOFF_COEF: 1.5
- name: clang-18-release # - name: clang-18-release
continue-on-error: false # continue-on-error: false
node: 18 # node: 18
runs-on: ubuntu-24.04 # runs-on: ubuntu-24.04
BUILD_TOOLS: ON # BUILD_TOOLS: ON
BUILD_TYPE: Release # BUILD_TYPE: Release
CCOMPILER: clang-18 # CCOMPILER: clang-18
CXXCOMPILER: clang++-18 # CXXCOMPILER: clang++-18
CUCUMBER_TIMEOUT: 60000 # CUCUMBER_TIMEOUT: 60000
ENABLE_LTO: OFF # ENABLE_LTO: OFF
- name: clang-18-debug # - name: clang-18-debug
continue-on-error: false # continue-on-error: false
node: 18 # node: 18
runs-on: ubuntu-24.04 # runs-on: ubuntu-24.04
BUILD_TOOLS: ON # BUILD_TOOLS: ON
BUILD_TYPE: Debug # BUILD_TYPE: Debug
CCOMPILER: clang-18 # CCOMPILER: clang-18
CXXCOMPILER: clang++-18 # CXXCOMPILER: clang++-18
CUCUMBER_TIMEOUT: 60000 # CUCUMBER_TIMEOUT: 60000
ENABLE_LTO: OFF # ENABLE_LTO: OFF
- name: clang-18-debug-clang-tidy # - name: clang-18-debug-clang-tidy
continue-on-error: false # continue-on-error: false
node: 18 # node: 18
runs-on: ubuntu-24.04 # runs-on: ubuntu-24.04
BUILD_TOOLS: ON # BUILD_TOOLS: ON
BUILD_TYPE: Debug # BUILD_TYPE: Debug
CCOMPILER: clang-18 # CCOMPILER: clang-18
CXXCOMPILER: clang++-18 # CXXCOMPILER: clang++-18
CUCUMBER_TIMEOUT: 60000 # CUCUMBER_TIMEOUT: 60000
ENABLE_CLANG_TIDY: ON # ENABLE_CLANG_TIDY: ON
- name: clang-17-release # - name: clang-17-release
continue-on-error: false # continue-on-error: false
node: 18 # node: 18
runs-on: ubuntu-24.04 # runs-on: ubuntu-24.04
BUILD_TOOLS: ON # BUILD_TOOLS: ON
BUILD_TYPE: Release # BUILD_TYPE: Release
CCOMPILER: clang-17 # CCOMPILER: clang-17
CXXCOMPILER: clang++-17 # CXXCOMPILER: clang++-17
CUCUMBER_TIMEOUT: 60000 # CUCUMBER_TIMEOUT: 60000
ENABLE_LTO: OFF # ENABLE_LTO: OFF
- name: clang-16-release - name: clang-16-release
continue-on-error: false continue-on-error: false
@@ -251,104 +247,104 @@ jobs:
CUCUMBER_TIMEOUT: 60000 CUCUMBER_TIMEOUT: 60000
ENABLE_LTO: OFF ENABLE_LTO: OFF
- name: conan-linux-debug-asan-ubsan # - name: conan-linux-debug-asan-ubsan
continue-on-error: false # continue-on-error: false
node: 18 # node: 18
runs-on: ubuntu-24.04 # runs-on: ubuntu-24.04
BUILD_TOOLS: ON # BUILD_TOOLS: ON
BUILD_TYPE: Release # BUILD_TYPE: Release
CCOMPILER: clang-18 # CCOMPILER: clang-18
CXXCOMPILER: clang++-18 # CXXCOMPILER: clang++-18
ENABLE_CONAN: ON # ENABLE_CONAN: ON
ENABLE_SANITIZER: ON # ENABLE_SANITIZER: ON
ENABLE_LTO: OFF # ENABLE_LTO: OFF
- name: conan-linux-release # - name: conan-linux-release
continue-on-error: false # continue-on-error: false
node: 18 # node: 18
runs-on: ubuntu-24.04 # runs-on: ubuntu-24.04
BUILD_TOOLS: ON # BUILD_TOOLS: ON
BUILD_TYPE: Release # BUILD_TYPE: Release
CCOMPILER: clang-18 # CCOMPILER: clang-18
CXXCOMPILER: clang++-18 # CXXCOMPILER: clang++-18
ENABLE_CONAN: ON # ENABLE_CONAN: ON
ENABLE_LTO: OFF # ENABLE_LTO: OFF
- name: gcc-14-release # - name: gcc-14-release
continue-on-error: false # continue-on-error: false
node: 20 # node: 20
runs-on: ubuntu-24.04 # runs-on: ubuntu-24.04
BUILD_TOOLS: ON # BUILD_TOOLS: ON
BUILD_TYPE: Release # BUILD_TYPE: Release
CCOMPILER: gcc-14 # CCOMPILER: gcc-14
CXXCOMPILER: g++-14 # CXXCOMPILER: g++-14
CXXFLAGS: '-Wno-array-bounds -Wno-uninitialized' # CXXFLAGS: '-Wno-array-bounds -Wno-uninitialized'
- name: gcc-13-release # - name: gcc-13-release
continue-on-error: false # continue-on-error: false
node: 20 # node: 20
runs-on: ubuntu-24.04 # runs-on: ubuntu-24.04
BUILD_TOOLS: ON # BUILD_TOOLS: ON
BUILD_TYPE: Release # BUILD_TYPE: Release
CCOMPILER: gcc-13 # CCOMPILER: gcc-13
CXXCOMPILER: g++-13 # CXXCOMPILER: g++-13
CXXFLAGS: '-Wno-array-bounds -Wno-uninitialized' # CXXFLAGS: '-Wno-array-bounds -Wno-uninitialized'
- name: gcc-12-release # - name: gcc-12-release
continue-on-error: false # continue-on-error: false
node: 20 # node: 20
runs-on: ubuntu-22.04 # runs-on: ubuntu-22.04
BUILD_TOOLS: ON # BUILD_TOOLS: ON
BUILD_TYPE: Release # BUILD_TYPE: Release
CCOMPILER: gcc-12 # CCOMPILER: gcc-12
CXXCOMPILER: g++-12 # CXXCOMPILER: g++-12
CXXFLAGS: '-Wno-array-bounds -Wno-uninitialized' # CXXFLAGS: '-Wno-array-bounds -Wno-uninitialized'
- name: conan-linux-release-node # - name: conan-linux-release-node
build_node_package: true # build_node_package: true
continue-on-error: false # continue-on-error: false
node: 20 # node: 20
runs-on: ubuntu-24.04 # runs-on: ubuntu-24.04
BUILD_TYPE: Release # BUILD_TYPE: Release
CCOMPILER: clang-16 # CCOMPILER: clang-16
CXXCOMPILER: clang++-16 # CXXCOMPILER: clang++-16
ENABLE_CONAN: ON # ENABLE_CONAN: ON
NODE_PACKAGE_TESTS_ONLY: ON # NODE_PACKAGE_TESTS_ONLY: ON
- name: conan-linux-debug-node # - name: conan-linux-debug-node
build_node_package: true # build_node_package: true
continue-on-error: false # continue-on-error: false
node: 20 # node: 20
runs-on: ubuntu-24.04 # runs-on: ubuntu-24.04
BUILD_TYPE: Debug # BUILD_TYPE: Debug
CCOMPILER: clang-16 # CCOMPILER: clang-16
CXXCOMPILER: clang++-16 # CXXCOMPILER: clang++-16
ENABLE_CONAN: ON # ENABLE_CONAN: ON
NODE_PACKAGE_TESTS_ONLY: ON # NODE_PACKAGE_TESTS_ONLY: ON
- name: conan-macos-x64-release-node # - name: conan-macos-x64-release-node
build_node_package: true # build_node_package: true
continue-on-error: true # continue-on-error: true
node: 20 # node: 20
runs-on: macos-13 # x86_64 # runs-on: macos-13 # x86_64
BUILD_TYPE: Release # BUILD_TYPE: Release
CCOMPILER: clang # CCOMPILER: clang
CXXCOMPILER: clang++ # CXXCOMPILER: clang++
CUCUMBER_TIMEOUT: 60000 # CUCUMBER_TIMEOUT: 60000
ENABLE_ASSERTIONS: ON # ENABLE_ASSERTIONS: ON
ENABLE_CONAN: ON # ENABLE_CONAN: ON
- name: conan-macos-arm64-release-node # - name: conan-macos-arm64-release-node
build_node_package: true # build_node_package: true
continue-on-error: true # continue-on-error: true
node: 20 # node: 20
runs-on: macos-14 # arm64 # runs-on: macos-14 # arm64
BUILD_TYPE: Release # BUILD_TYPE: Release
CCOMPILER: clang # CCOMPILER: clang
CXXCOMPILER: clang++ # CXXCOMPILER: clang++
CUCUMBER_TIMEOUT: 60000 # CUCUMBER_TIMEOUT: 60000
ENABLE_ASSERTIONS: ON # ENABLE_ASSERTIONS: ON
ENABLE_CONAN: ON # ENABLE_CONAN: ON
name: ${{ matrix.name}} name: ${{ matrix.name}}
continue-on-error: ${{ matrix.continue-on-error }} continue-on-error: ${{ matrix.continue-on-error }}
@@ -397,10 +393,10 @@ jobs:
- name: Enable Conan cache - name: Enable Conan cache
uses: actions/cache@v4 uses: actions/cache@v4
with: with:
path: ~/.conan2 path: ~/.conan
key: v10-conan-${{ matrix.name }}-${{ github.sha }} key: v9-conan-${{ matrix.name }}-${{ github.sha }}
restore-keys: | restore-keys: |
v10-conan-${{ matrix.name }}- v9-conan-${{ matrix.name }}-
- name: Enable test cache - name: Enable test cache
uses: actions/cache@v4 uses: actions/cache@v4
with: with:
@@ -461,6 +457,8 @@ jobs:
- name: Install dev dependencies - name: Install dev dependencies
run: | run: |
python3 -m pip install "conan<2.0.0" || python3 -m pip install "conan<2.0.0" --break-system-packages
# workaround for issue that GitHub Actions seems to not adding it to PATH after https://github.com/actions/runner-images/pull/6499 # workaround for issue that GitHub Actions seems to not adding it to PATH after https://github.com/actions/runner-images/pull/6499
# and that's why CI cannot find conan executable installed above # and that's why CI cannot find conan executable installed above
if [[ "${RUNNER_OS}" == "macOS" ]]; then if [[ "${RUNNER_OS}" == "macOS" ]]; then
@@ -497,6 +495,20 @@ jobs:
tar zxvf onetbb.tgz tar zxvf onetbb.tgz
sudo cp -a oneapi-tbb-${TBB_VERSION}/lib/. /usr/local/lib/ sudo cp -a oneapi-tbb-${TBB_VERSION}/lib/. /usr/local/lib/
sudo cp -a oneapi-tbb-${TBB_VERSION}/include/. /usr/local/include/ sudo cp -a oneapi-tbb-${TBB_VERSION}/include/. /usr/local/include/
- name: Add Clang 18 to list of Conan compilers # workaround for the issue that Conan 1.x doesn't know about Clang 18
if: ${{ matrix.ENABLE_CONAN == 'ON' && matrix.CCOMPILER == 'clang-18' }}
run: |
sudo wget https://github.com/mikefarah/yq/releases/download/v4.9.6/yq_linux_amd64 -O /usr/bin/yq && sudo chmod +x /usr/bin/yq
conan config init
yq eval '.compiler.clang.version += ["18"]' -i "$HOME/.conan/settings.yml"
- name: Add Apple-clang 16 to list of Conan compilers # workaround for the issue that Conan 1.x doesn't know about Apple-clang 16
if: ${{ matrix.ENABLE_CONAN == 'ON' && matrix.runs-on == 'macos-14' }}
run: |
sudo wget https://github.com/mikefarah/yq/releases/download/v4.9.6/yq_darwin_arm64 -O /usr/local/bin/yq && sudo chmod +x /usr/local/bin/yq
conan config init
yq eval '.compiler.apple-clang.version += ["16.0"]' -i "$HOME/.conan/settings.yml"
- name: Prepare build - name: Prepare build
run: | run: |
mkdir ${OSRM_BUILD_DIR} mkdir ${OSRM_BUILD_DIR}
@@ -519,13 +531,6 @@ jobs:
echo "Using ${JOBS} jobs" echo "Using ${JOBS} jobs"
pushd ${OSRM_BUILD_DIR} pushd ${OSRM_BUILD_DIR}
if [[ "${ENABLE_CONAN}" == "ON" ]]; then
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install conan==2.7.1
conan profile detect --force
fi
ccache --zero-stats ccache --zero-stats
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DENABLE_CONAN=${ENABLE_CONAN:-OFF} \ -DENABLE_CONAN=${ENABLE_CONAN:-OFF} \
@@ -539,7 +544,6 @@ jobs:
-DENABLE_CCACHE=ON \ -DENABLE_CCACHE=ON \
-DENABLE_LTO=${ENABLE_LTO:-ON} \ -DENABLE_LTO=${ENABLE_LTO:-ON} \
-DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR} -DCMAKE_INSTALL_PREFIX=${OSRM_INSTALL_DIR}
make --jobs=${JOBS} make --jobs=${JOBS}
if [[ "${NODE_PACKAGE_TESTS_ONLY}" != "ON" ]]; then if [[ "${NODE_PACKAGE_TESTS_ONLY}" != "ON" ]]; then
@@ -554,7 +558,7 @@ jobs:
fi fi
popd popd
- name: Build example - name: Build example
if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY != 'ON' && matrix.ENABLE_CONAN != 'ON' }} if: ${{ matrix.NODE_PACKAGE_TESTS_ONLY != 'ON' }}
run: | run: |
mkdir example/build && pushd example/build mkdir example/build && pushd example/build
cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
@@ -566,14 +570,18 @@ jobs:
make -C test/data benchmark make -C test/data benchmark
# macOS SIP strips the linker path. Reset this inside the running shell # macOS SIP strips the linker path. Reset this inside the running shell
if [[ "${ENABLE_CONAN}" == "OFF" ]]; then export LD_LIBRARY_PATH=${{ env.LD_LIBRARY_PATH }}
export LD_LIBRARY_PATH=${{ env.LD_LIBRARY_PATH }} ./example/build/osrm-example test/data/mld/monaco.osrm
./example/build/osrm-example test/data/mld/monaco.osrm
fi
# All tests assume to be run from the build directory # All tests assume to be run from the build directory
pushd ${OSRM_BUILD_DIR} pushd ${OSRM_BUILD_DIR}
for i in ./unit_tests/*-tests ; do echo Running $i ; $i ; done for i in $(seq 1 100); do
echo "Iteration $i"
for test in ./unit_tests/*-tests; do
echo "Running $test"
$test
done
done
if [ -z "${ENABLE_SANITIZER}" ]; then if [ -z "${ENABLE_SANITIZER}" ]; then
npm run nodejs-tests npm run nodejs-tests
fi fi
@@ -655,130 +663,130 @@ jobs:
ccache -p ccache -p
ccache -s ccache -s
benchmarks: # benchmarks:
if: github.event_name == 'pull_request' # if: github.event_name == 'pull_request'
needs: [format-taginfo-docs] # needs: [format-taginfo-docs]
runs-on: self-hosted # runs-on: self-hosted
env: # env:
CCOMPILER: clang-16 # CCOMPILER: clang-16
CXXCOMPILER: clang++-16 # CXXCOMPILER: clang++-16
CC: clang-16 # CC: clang-16
CXX: clang++-16 # CXX: clang++-16
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }} # PR_NUMBER: ${{ github.event.pull_request.number }}
GITHUB_REPOSITORY: ${{ github.repository }} # GITHUB_REPOSITORY: ${{ github.repository }}
RUN_BIG_BENCHMARK: ${{ contains(github.event.pull_request.labels.*.name, 'Performance') }} # RUN_BIG_BENCHMARK: ${{ contains(github.event.pull_request.labels.*.name, 'Performance') }}
steps: # steps:
- name: Checkout PR Branch # - name: Checkout PR Branch
uses: actions/checkout@v4 # uses: actions/checkout@v4
with: # with:
ref: ${{ github.head_ref }} # ref: ${{ github.head_ref }}
path: pr # path: pr
- name: Activate virtualenv # - name: Activate virtualenv
run: | # run: |
python3 -m venv .venv # python3 -m venv .venv
source .venv/bin/activate # source .venv/bin/activate
echo PATH=$PATH >> $GITHUB_ENV # echo PATH=$PATH >> $GITHUB_ENV
pip install "conan==2.7.1" "requests==2.31.0" "numpy==1.26.4" # pip install "conan<2.0.0" "requests==2.31.0" "numpy==1.26.4"
- name: Prepare data # - name: Prepare data
run: | # run: |
if [ "$RUN_BIG_BENCHMARK" = "true" ]; then # if [ "$RUN_BIG_BENCHMARK" = "true" ]; then
rm -rf ~/data.osm.pbf # rm -rf ~/data.osm.pbf
wget http://download.geofabrik.de/europe/poland-latest.osm.pbf -O ~/data.osm.pbf --quiet # wget http://download.geofabrik.de/europe/poland-latest.osm.pbf -O ~/data.osm.pbf --quiet
gunzip -c ./pr/test/data/poland_gps_traces.csv.gz > ~/gps_traces.csv # gunzip -c ./pr/test/data/poland_gps_traces.csv.gz > ~/gps_traces.csv
else # else
if [ ! -f "~/data.osm.pbf" ]; then # if [ ! -f "~/data.osm.pbf" ]; then
wget http://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf -O ~/data.osm.pbf # wget http://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf -O ~/data.osm.pbf
else # else
echo "Using cached data.osm.pbf" # echo "Using cached data.osm.pbf"
fi # fi
gunzip -c ./pr/test/data/berlin_gps_traces.csv.gz > ~/gps_traces.csv # gunzip -c ./pr/test/data/berlin_gps_traces.csv.gz > ~/gps_traces.csv
fi # fi
- name: Prepare environment # - name: Prepare environment
run: | # run: |
echo "CCACHE_DIR=$HOME/.ccache" >> $GITHUB_ENV # echo "CCACHE_DIR=$HOME/.ccache" >> $GITHUB_ENV
mkdir -p $HOME/.ccache # mkdir -p $HOME/.ccache
ccache --zero-stats # ccache --zero-stats
ccache --max-size=256M # ccache --max-size=256M
- name: Checkout Base Branch # - name: Checkout Base Branch
uses: actions/checkout@v4 # uses: actions/checkout@v4
with: # with:
ref: ${{ github.event.pull_request.base.ref }} # ref: ${{ github.event.pull_request.base.ref }}
path: base # path: base
- name: Build Base Branch # - name: Build Base Branch
run: | # run: |
cd base # cd base
npm ci --ignore-scripts # npm ci --ignore-scripts
cd .. # cd ..
mkdir base/build # mkdir base/build
cd base/build # cd base/build
cmake -DENABLE_CONAN=ON -DCMAKE_BUILD_TYPE=Release -DENABLE_NODE_BINDINGS=ON .. # cmake -DENABLE_CONAN=ON -DCMAKE_BUILD_TYPE=Release -DENABLE_NODE_BINDINGS=ON ..
make -j$(nproc) # make -j$(nproc)
make -j$(nproc) benchmarks # make -j$(nproc) benchmarks
cd .. # cd ..
make -C test/data # make -C test/data
- name: Build PR Branch # - name: Build PR Branch
run: | # run: |
cd pr # cd pr
npm ci --ignore-scripts # npm ci --ignore-scripts
cd .. # cd ..
mkdir -p pr/build # mkdir -p pr/build
cd pr/build # cd pr/build
cmake -DENABLE_CONAN=ON -DCMAKE_BUILD_TYPE=Release -DENABLE_NODE_BINDINGS=ON .. # cmake -DENABLE_CONAN=ON -DCMAKE_BUILD_TYPE=Release -DENABLE_NODE_BINDINGS=ON ..
make -j$(nproc) # make -j$(nproc)
make -j$(nproc) benchmarks # make -j$(nproc) benchmarks
cd .. # cd ..
make -C test/data # make -C test/data
# we run benchmarks in tmpfs to avoid impact of disk IO # # we run benchmarks in tmpfs to avoid impact of disk IO
- name: Create folder for tmpfs # - name: Create folder for tmpfs
run: | # run: |
# if by any chance it was mounted before(e.g. due to previous job failed), unmount it # # if by any chance it was mounted before(e.g. due to previous job failed), unmount it
sudo umount ~/benchmarks | true # sudo umount ~/benchmarks | true
rm -rf ~/benchmarks # rm -rf ~/benchmarks
mkdir -p ~/benchmarks # mkdir -p ~/benchmarks
# see https://llvm.org/docs/Benchmarking.html # # see https://llvm.org/docs/Benchmarking.html
- name: Run PR Benchmarks # - name: Run PR Benchmarks
run: | # run: |
sudo cset shield -c 2-3 -k on # sudo cset shield -c 2-3 -k on
sudo mount -t tmpfs -o size=4g none ~/benchmarks # sudo mount -t tmpfs -o size=4g none ~/benchmarks
cp -rf pr/build ~/benchmarks/build # cp -rf pr/build ~/benchmarks/build
cp -rf pr/lib ~/benchmarks/lib # cp -rf pr/lib ~/benchmarks/lib
mkdir -p ~/benchmarks/test # mkdir -p ~/benchmarks/test
cp -rf pr/test/data ~/benchmarks/test/data # cp -rf pr/test/data ~/benchmarks/test/data
cp -rf pr/profiles ~/benchmarks/profiles # cp -rf pr/profiles ~/benchmarks/profiles
sudo cset shield --exec -- ./pr/scripts/ci/run_benchmarks.sh -f ~/benchmarks -r $(pwd)/pr_results -s $(pwd)/pr -b ~/benchmarks/build -o ~/data.osm.pbf -g ~/gps_traces.csv # sudo cset shield --exec -- ./pr/scripts/ci/run_benchmarks.sh -f ~/benchmarks -r $(pwd)/pr_results -s $(pwd)/pr -b ~/benchmarks/build -o ~/data.osm.pbf -g ~/gps_traces.csv
sudo umount ~/benchmarks # sudo umount ~/benchmarks
sudo cset shield --reset # sudo cset shield --reset
- name: Run Base Benchmarks # - name: Run Base Benchmarks
run: | # run: |
sudo cset shield -c 2-3 -k on # sudo cset shield -c 2-3 -k on
sudo mount -t tmpfs -o size=4g none ~/benchmarks # sudo mount -t tmpfs -o size=4g none ~/benchmarks
cp -rf base/build ~/benchmarks/build # cp -rf base/build ~/benchmarks/build
cp -rf base/lib ~/benchmarks/lib # cp -rf base/lib ~/benchmarks/lib
mkdir -p ~/benchmarks/test # mkdir -p ~/benchmarks/test
cp -rf base/test/data ~/benchmarks/test/data # cp -rf base/test/data ~/benchmarks/test/data
cp -rf base/profiles ~/benchmarks/profiles # cp -rf base/profiles ~/benchmarks/profiles
# TODO: remove it when base branch will have this file at needed location # # TODO: remove it when base branch will have this file at needed location
if [ ! -f ~/benchmarks/test/data/portugal_to_korea.json ]; then # if [ ! -f ~/benchmarks/test/data/portugal_to_korea.json ]; then
cp base/src/benchmarks/portugal_to_korea.json ~/benchmarks/test/data/portugal_to_korea.json # cp base/src/benchmarks/portugal_to_korea.json ~/benchmarks/test/data/portugal_to_korea.json
fi # fi
# we intentionally use scripts from PR branch to be able to update them and see results in the same PR # # we intentionally use scripts from PR branch to be able to update them and see results in the same PR
sudo cset shield --exec -- cset shield --exec -- ./pr/scripts/ci/run_benchmarks.sh -f ~/benchmarks -r $(pwd)/base_results -s $(pwd)/pr -b ~/benchmarks/build -o ~/data.osm.pbf -g ~/gps_traces.csv # sudo cset shield --exec -- cset shield --exec -- ./pr/scripts/ci/run_benchmarks.sh -f ~/benchmarks -r $(pwd)/base_results -s $(pwd)/pr -b ~/benchmarks/build -o ~/data.osm.pbf -g ~/gps_traces.csv
sudo umount ~/benchmarks # sudo umount ~/benchmarks
sudo cset shield --reset # sudo cset shield --reset
- name: Post Benchmark Results # - name: Post Benchmark Results
run: | # run: |
python3 pr/scripts/ci/post_benchmark_results.py base_results pr_results # python3 pr/scripts/ci/post_benchmark_results.py base_results pr_results
- name: Show CCache statistics # - name: Show CCache statistics
run: | # run: |
ccache -p # ccache -p
ccache -s # ccache -s
ci-complete: # ci-complete:
runs-on: ubuntu-22.04 # runs-on: ubuntu-22.04
needs: [build-test-publish, docker-image-matrix, windows-release-node, benchmarks] # needs: [build-test-publish, docker-image-matrix, windows-release-node, benchmarks]
steps: # steps:
- run: echo "CI complete" # - run: echo "CI complete"
+1 -1
View File
@@ -25,7 +25,7 @@
- NodeJS: - NodeJS:
- CHANGED: Use node-api instead of NAN. [#6452](https://github.com/Project-OSRM/osrm-backend/pull/6452) - CHANGED: Use node-api instead of NAN. [#6452](https://github.com/Project-OSRM/osrm-backend/pull/6452)
- Misc: - Misc:
- CHANGED: Migrate to Conan 2.x. [#7042](https://github.com/Project-OSRM/osrm-backend/pull/7042) - CHANGED: Use std::string_view for key type in json::Object. [#7062](https://github.com/Project-OSRM/osrm-backend/pull/7062)
- CHANGED: Use thread_local instead of boost::thread_specific_ptr. [#6991](https://github.com/Project-OSRM/osrm-backend/pull/6991) - CHANGED: Use thread_local instead of boost::thread_specific_ptr. [#6991](https://github.com/Project-OSRM/osrm-backend/pull/6991)
- CHANGED: Bump flatbuffers to v24.3.25 version. [#6988](https://github.com/Project-OSRM/osrm-backend/pull/6988) - CHANGED: Bump flatbuffers to v24.3.25 version. [#6988](https://github.com/Project-OSRM/osrm-backend/pull/6988)
- CHANGED: Add .reserve(...) to assembleGeometry function. [#6983](https://github.com/Project-OSRM/osrm-backend/pull/6983) - CHANGED: Add .reserve(...) to assembleGeometry function. [#6983](https://github.com/Project-OSRM/osrm-backend/pull/6983)
+107 -84
View File
@@ -37,29 +37,6 @@ option(ENABLE_NODE_BINDINGS "Build NodeJs bindings" OFF)
option(ENABLE_CLANG_TIDY "Enables clang-tidy checks" OFF) option(ENABLE_CLANG_TIDY "Enables clang-tidy checks" OFF)
if (ENABLE_CONAN)
message(STATUS "Installing Conan packages. It may take a while...")
find_program(CONAN_EXECUTABLE NAMES conan)
if (NOT CONAN_EXECUTABLE)
message(FATAL_ERROR "Conan not found! Please install Conan 2.x and try again.")
else()
set(CMAKE_TOOLCHAIN_FILE "./conan_toolchain.cmake")
execute_process(
COMMAND ${CONAN_EXECUTABLE} install .. --output-folder=. --build=missing --settings compiler.cppstd=20 --settings build_type=${CMAKE_BUILD_TYPE}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
OUTPUT_VARIABLE conan_stdout
ERROR_VARIABLE conan_stderr
RESULT_VARIABLE conan_install_result
)
if (NOT conan_install_result EQUAL 0)
message(FATAL_ERROR "Conan install failed: ${conan_install_result}. Stderr: ${conan_stderr}. Stdout: ${conan_stdout}")
endif()
endif()
endif()
if (ENABLE_CLANG_TIDY) if (ENABLE_CLANG_TIDY)
find_program(CLANG_TIDY_COMMAND NAMES clang-tidy) find_program(CLANG_TIDY_COMMAND NAMES clang-tidy)
if(NOT CLANG_TIDY_COMMAND) if(NOT CLANG_TIDY_COMMAND)
@@ -344,75 +321,116 @@ if (MSVC)
add_definitions(-DBOOST_ALL_NO_LIB) add_definitions(-DBOOST_ALL_NO_LIB)
endif() endif()
if(ENABLE_CONAN)
message(STATUS "Installing dependencies via Conan")
if (ENABLE_CONAN) # Conan will generate Find*.cmake files to build directory, so we use them with the highest priority
set(Boost_USE_STATIC_LIBS ON) list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_BINARY_DIR})
find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS}) list(INSERT CMAKE_PREFIX_PATH 0 ${CMAKE_BINARY_DIR})
find_package(TBB REQUIRED)
find_package(EXPAT REQUIRED)
find_package(BZip2 REQUIRED)
find_package(Lua 5.2 REQUIRED)
add_dependency_includes(${Boost_INCLUDE_DIRS}) include(${CMAKE_CURRENT_LIST_DIR}/cmake/conan.cmake)
set(BOOST_BASE_LIBRARIES ${Boost_LIBRARIES}) conan_check(REQUIRED)
set(BOOST_ENGINE_LIBRARIES ${Boost_LIBRARIES})
add_dependency_includes(${TBB_INCLUDE_DIR}) set(CONAN_BOOST_VERSION "1.85.0@#14265ec82b25d91305bbb3b30d3357f8")
set(TBB_LIBRARIES ${TBB_LIBRARIES}) set(CONAN_BZIP2_VERSION "1.0.8@#d1b2d5816f25865acf978501dff1f897")
set(CONAN_EXPAT_VERSION "2.6.2@#2d385d0d50eb5561006a7ff9e356656b")
set(CONAN_LUA_VERSION "5.4.6@#658d6089093cf01992c2737ab2e96763")
set(CONAN_TBB_VERSION "2021.12.0@#e56e5b44be8d690530585dd3634c0106")
add_dependency_includes(${expat_INCLUDE_DIRS}) set(CONAN_SYSTEM_INCLUDES ON)
set(EXPAT_LIBRARIES ${expat_LIBRARIES})
set(EXPAT_INCLUDE_DIRS ${expat_INCLUDE_DIRS})
add_dependency_includes(${BZIP2_INCLUDE_DIR})
set(LUA_LIBRARIES lua::lua) set(CONAN_ARGS
if (LUA_FOUND) REQUIRES
message(STATUS "Using Lua ${LUA_VERSION_STRING}") "boost/${CONAN_BOOST_VERSION}"
"bzip2/${CONAN_BZIP2_VERSION}"
"expat/${CONAN_EXPAT_VERSION}"
"lua/${CONAN_LUA_VERSION}"
"onetbb/${CONAN_TBB_VERSION}"
BASIC_SETUP
GENERATORS cmake_find_package json # json generator generates a conanbuildinfo.json in the build folder so (non-CMake) projects can easily parse OSRM's dependencies
KEEP_RPATHS
NO_OUTPUT_DIRS
OPTIONS boost:without_stacktrace=True # Apple Silicon cross-compilation fails without it
BUILD missing
)
# Enable revisions in the conan config
execute_process(COMMAND ${CONAN_CMD} config set general.revisions_enabled=1 RESULT_VARIABLE RET_CODE)
if(NOT "${RET_CODE}" STREQUAL "0")
message(FATAL_ERROR "Error setting revisions for Conan: '${RET_CODE}'")
endif() endif()
add_dependency_includes(${lua_INCLUDE_DIRS}) # explicitly say Conan to use x86 dependencies if build for x86 platforms (https://github.com/conan-io/cmake-conan/issues/141)
if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
conan_cmake_run("${CONAN_ARGS};ARCH;x86")
# cross-compilation for Apple Silicon
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64" AND CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64")
conan_cmake_run("${CONAN_ARGS};ARCH;armv8")
else()
conan_cmake_run("${CONAN_ARGS}")
endif()
add_dependency_includes(${CONAN_INCLUDE_DIRS_BOOST})
add_dependency_includes(${CONAN_INCLUDE_DIRS_BZIP2})
add_dependency_includes(${CONAN_INCLUDE_DIRS_EXPAT})
add_dependency_includes(${CONAN_INCLUDE_DIRS_LUA})
add_dependency_includes(${CONAN_INCLUDE_DIRS_TBB})
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS})
set(Boost_DATE_TIME_LIBRARY "${Boost_date_time_LIB_TARGETS}")
set(Boost_PROGRAM_OPTIONS_LIBRARY "${Boost_program_options_LIB_TARGETS}")
set(Boost_IOSTREAMS_LIBRARY "${Boost_iostreams_LIB_TARGETS}")
set(Boost_THREAD_LIBRARY "${Boost_thread_LIB_TARGETS}")
set(Boost_ZLIB_LIBRARY "${Boost_zlib_LIB_TARGETS}")
set(Boost_UNIT_TEST_FRAMEWORK_LIBRARY "${Boost_unit_test_framework_LIB_TARGETS}")
find_package(BZip2 REQUIRED)
find_package(EXPAT REQUIRED)
find_package(lua REQUIRED)
set(LUA_LIBRARIES ${lua_LIBRARIES})
find_package(TBB REQUIRED)
# note: we avoid calling find_package(Osmium ...) here to ensure that the # note: we avoid calling find_package(Osmium ...) here to ensure that the
# expat and bzip2 are used from conan rather than the system # expat and bzip2 are used from conan rather than the system
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/third_party/libosmium/include) include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/third_party/libosmium/include)
else() else()
find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS}) find_package(Boost 1.70 REQUIRED COMPONENTS ${BOOST_COMPONENTS})
find_package(TBB REQUIRED)
find_package(EXPAT REQUIRED)
find_package(BZip2 REQUIRED)
find_package(Lua 5.2 REQUIRED)
add_dependency_includes(${Boost_INCLUDE_DIRS}) add_dependency_includes(${Boost_INCLUDE_DIRS})
add_dependency_includes(${TBB_INCLUDE_DIR})
add_dependency_includes(${EXPAT_INCLUDE_DIRS})
add_dependency_includes(${BZIP2_INCLUDE_DIR})
add_dependency_includes(${LUA_INCLUDE_DIR})
find_package(TBB REQUIRED)
add_dependency_includes(${TBB_INCLUDE_DIR})
set(TBB_LIBRARIES TBB::tbb) set(TBB_LIBRARIES TBB::tbb)
set(BOOST_BASE_LIBRARIES find_package(EXPAT REQUIRED)
${Boost_DATE_TIME_LIBRARY} add_dependency_includes(${EXPAT_INCLUDE_DIRS})
${Boost_IOSTREAMS_LIBRARY}
${Boost_THREAD_LIBRARY})
set(BOOST_ENGINE_LIBRARIES find_package(BZip2 REQUIRED)
${Boost_ZLIB_LIBRARY} add_dependency_includes(${BZIP2_INCLUDE_DIR})
${Boost_REGEX_LIBRARY}
${BOOST_BASE_LIBRARIES}) find_package(Lua 5.2 REQUIRED)
if (LUA_FOUND)
message(STATUS "Using Lua ${LUA_VERSION_STRING}")
endif()
add_dependency_includes(${LUA_INCLUDE_DIR})
# add a target to generate API documentation with Doxygen # add a target to generate API documentation with Doxygen
find_package(Doxygen) find_package(Doxygen)
if(DOXYGEN_FOUND) if(DOXYGEN_FOUND)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
add_custom_target(doc add_custom_target(doc
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen" VERBATIM COMMENT "Generating API documentation with Doxygen" VERBATIM
) )
endif() endif()
# note libosmium depends on expat and bzip2 # note libosmium depends on expat and bzip2
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/third_party/libosmium/cmake") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/third_party/libosmium/cmake")
if(NOT OSMIUM_INCLUDE_DIR) if(NOT OSMIUM_INCLUDE_DIR)
@@ -422,8 +440,6 @@ else()
include_directories(SYSTEM ${OSMIUM_INCLUDE_DIR}) include_directories(SYSTEM ${OSMIUM_INCLUDE_DIR})
endif() endif()
# prefix compilation with ccache by default if available and on clang or gcc # prefix compilation with ccache by default if available and on clang or gcc
if(ENABLE_CCACHE AND (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")) if(ENABLE_CCACHE AND (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU"))
find_program(CCACHE_FOUND ccache) find_program(CCACHE_FOUND ccache)
@@ -438,7 +454,6 @@ endif()
# to ensure that osrm binaries play well with other binaries like nodejs # to ensure that osrm binaries play well with other binaries like nodejs
find_package(ZLIB REQUIRED) find_package(ZLIB REQUIRED)
add_dependency_includes(${ZLIB_INCLUDE_DIRS}) add_dependency_includes(${ZLIB_INCLUDE_DIRS})
set(ZLIB_LIBRARY ${ZLIB_LIBRARIES})
add_dependency_defines(-DBOOST_SPIRIT_USE_PHOENIX_V3) add_dependency_defines(-DBOOST_SPIRIT_USE_PHOENIX_V3)
add_dependency_defines(-DBOOST_RESULT_OF_USE_DECLTYPE) add_dependency_defines(-DBOOST_RESULT_OF_USE_DECLTYPE)
@@ -449,6 +464,15 @@ add_dependency_defines(-DBOOST_PHOENIX_STL_TUPLE_H_)
add_definitions(${OSRM_DEFINES}) add_definitions(${OSRM_DEFINES})
include_directories(SYSTEM ${DEPENDENCIES_INCLUDE_DIRS}) include_directories(SYSTEM ${DEPENDENCIES_INCLUDE_DIRS})
set(BOOST_BASE_LIBRARIES
${Boost_DATE_TIME_LIBRARY}
${Boost_IOSTREAMS_LIBRARY}
${Boost_THREAD_LIBRARY})
set(BOOST_ENGINE_LIBRARIES
${Boost_ZLIB_LIBRARY}
${Boost_REGEX_LIBRARY}
${BOOST_BASE_LIBRARIES})
# Binaries # Binaries
target_link_libraries(osrm-datastore osrm_store ${Boost_PROGRAM_OPTIONS_LIBRARY}) target_link_libraries(osrm-datastore osrm_store ${Boost_PROGRAM_OPTIONS_LIBRARY})
@@ -481,10 +505,10 @@ set(PARTITIONER_LIBRARIES
${CMAKE_THREAD_LIBS_INIT} ${CMAKE_THREAD_LIBS_INIT}
${TBB_LIBRARIES} ${TBB_LIBRARIES}
${MAYBE_RT_LIBRARY} ${MAYBE_RT_LIBRARY}
${MAYBE_COVERAGE_LIBRARIES}) ${MAYBE_COVERAGE_LIBRARIES}
${ZLIB_LIBRARY})
set(CUSTOMIZER_LIBRARIES set(CUSTOMIZER_LIBRARIES
${BOOST_ENGINE_LIBRARIES} ${BOOST_ENGINE_LIBRARIES}
${ZLIB_LIBRARY}
${CMAKE_THREAD_LIBS_INIT} ${CMAKE_THREAD_LIBS_INIT}
${TBB_LIBRARIES} ${TBB_LIBRARIES}
${MAYBE_RT_LIBRARY} ${MAYBE_RT_LIBRARY}
@@ -652,17 +676,16 @@ list(APPEND DEPENDENCIES_INCLUDE_DIRS "${PKGCONFIG_INCLUDE_DIR}")
list(APPEND DEPENDENCIES_INCLUDE_DIRS "${PKGCONFIG_INCLUDE_DIR}/osrm") list(APPEND DEPENDENCIES_INCLUDE_DIRS "${PKGCONFIG_INCLUDE_DIR}/osrm")
JOIN("-I${DEPENDENCIES_INCLUDE_DIRS}" " -I" PKGCONFIG_OSRM_INCLUDE_FLAGS) JOIN("-I${DEPENDENCIES_INCLUDE_DIRS}" " -I" PKGCONFIG_OSRM_INCLUDE_FLAGS)
# Boost uses imported targets, we need to use a generator expression to extract
if (NOT ENABLE_CONAN) # the link libraries to be written to the pkg-config file.
foreach(engine_lib ${ENGINE_LIBRARIES}) # Conan & TBB define dependencies as CMake targets too, that's why we do the same for them.
if("${engine_lib}" MATCHES "^boost.*" OR "${engine_lib}" MATCHES "^TBB.*") foreach(engine_lib ${ENGINE_LIBRARIES})
list(APPEND PKGCONFIG_DEPENDENT_LIBRARIES "$<TARGET_LINKER_FILE:${engine_lib}>") if("${engine_lib}" MATCHES "^Boost.*" OR "${engine_lib}" MATCHES "^CONAN_LIB.*" OR "${engine_lib}" MATCHES "^TBB.*")
else() list(APPEND PKGCONFIG_DEPENDENT_LIBRARIES "$<TARGET_LINKER_FILE:${engine_lib}>")
list(APPEND PKGCONFIG_DEPENDENT_LIBRARIES "${engine_lib}") else()
endif() list(APPEND PKGCONFIG_DEPENDENT_LIBRARIES "${engine_lib}")
endforeach(engine_lib) endif()
endif() endforeach(engine_lib)
JOIN("${PKGCONFIG_DEPENDENT_LIBRARIES}" " " PKGCONFIG_OSRM_DEPENDENT_LIBRARIES) JOIN("${PKGCONFIG_DEPENDENT_LIBRARIES}" " " PKGCONFIG_OSRM_DEPENDENT_LIBRARIES)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/pkgconfig.in pkgconfig.configured @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/pkgconfig.in pkgconfig.configured @ONLY)
+1026
View File
File diff suppressed because it is too large Load Diff
-31
View File
@@ -1,31 +0,0 @@
from conan import ConanFile
from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps
class OsrmConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "CMakeDeps"
def requirements(self):
self.requires("boost/1.85.0")
self.requires("bzip2/1.0.8")
self.requires("expat/2.6.2")
self.requires("lua/5.4.6")
self.requires("onetbb/2021.12.0")
if self.settings.os == "Windows":
self.requires("zlib/1.3.1")
def configure(self):
self.options["boost"].without_python = True
self.options["boost"].without_coroutine = True
self.options["boost"].without_stacktrace = True
self.options["boost"].without_cobalt = True
def generate(self):
tc = CMakeToolchain(self)
tc.variables["CMAKE_CXX_STANDARD"] = "20"
tc.generate()
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
+1 -1
View File
@@ -12,7 +12,7 @@ endif()
project(osrm-example C CXX) project(osrm-example C CXX)
set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_EXTENSIONS OFF)
+1 -1
View File
@@ -30,7 +30,7 @@ struct V8Renderer
{ {
Napi::Value child; Napi::Value child;
std::visit(V8Renderer(env, child), keyValue.second); std::visit(V8Renderer(env, child), keyValue.second);
obj.Set(keyValue.first, child); obj.Set(keyValue.first.data(), child);
} }
out = obj; out = obj;
} }
+1 -1
View File
@@ -104,7 +104,7 @@ using Value = std::variant<String, Number, Object, Array, True, False, Null>;
*/ */
struct Object struct Object
{ {
std::unordered_map<std::string, Value> values; std::unordered_map<std::string_view, Value> values;
}; };
/** /**
+9 -8
View File
@@ -44,13 +44,13 @@ struct Comparator
bool operator()(const Object &lhs, const Object &rhs) const bool operator()(const Object &lhs, const Object &rhs) const
{ {
std::set<std::string> lhs_keys; std::set<std::string_view> lhs_keys;
for (const auto &key_value : lhs.values) for (const auto &key_value : lhs.values)
{ {
lhs_keys.insert(key_value.first); lhs_keys.insert(key_value.first);
} }
std::set<std::string> rhs_keys; std::set<std::string_view> rhs_keys;
for (const auto &key_value : rhs.values) for (const auto &key_value : rhs.values)
{ {
rhs_keys.insert(key_value.first); rhs_keys.insert(key_value.first);
@@ -60,7 +60,7 @@ struct Comparator
{ {
if (rhs_keys.find(key) == rhs_keys.end()) if (rhs_keys.find(key) == rhs_keys.end())
{ {
reason = rhs_path + " doesn't have key \"" + key + "\""; reason = rhs_path + " doesn't have key \"" + std::string(key) + "\"";
return false; return false;
} }
} }
@@ -69,7 +69,7 @@ struct Comparator
{ {
if (lhs_keys.find(key) == lhs_keys.end()) if (lhs_keys.find(key) == lhs_keys.end())
{ {
reason = lhs_path + " doesn't have key \"" + key + "\""; reason = lhs_path + " doesn't have key \"" + std::string(key) + "\"";
return false; return false;
} }
} }
@@ -81,10 +81,11 @@ struct Comparator
const auto &rhs_child = rhs.values.find(key)->second; const auto &rhs_child = rhs.values.find(key)->second;
const auto &lhs_child = lhs.values.find(key)->second; const auto &lhs_child = lhs.values.find(key)->second;
auto is_same = auto is_same = std::visit(Comparator(reason,
std::visit(Comparator(reason, lhs_path + "." + key, rhs_path + "." + key), lhs_path + "." + std::string(key),
lhs_child, rhs_path + "." + std::string(key)),
rhs_child); lhs_child,
rhs_child);
if (!is_same) if (!is_same)
{ {
return false; return false;
+4 -4
View File
@@ -97,7 +97,7 @@ template <typename Out> struct Renderer
void operator()(const Null &) { write<>("null"); } void operator()(const Null &) { write<>("null"); }
private: private:
void write(const std::string &str); void write(std::string_view str);
void write(const char *str, size_t size); void write(const char *str, size_t size);
void write(char ch); void write(char ch);
@@ -110,7 +110,7 @@ template <typename Out> struct Renderer
Out &out; Out &out;
}; };
template <> void Renderer<std::vector<char>>::write(const std::string &str) template <> void Renderer<std::vector<char>>::write(std::string_view str)
{ {
out.insert(out.end(), str.begin(), str.end()); out.insert(out.end(), str.begin(), str.end());
} }
@@ -122,7 +122,7 @@ template <> void Renderer<std::vector<char>>::write(const char *str, size_t size
template <> void Renderer<std::vector<char>>::write(char ch) { out.push_back(ch); } template <> void Renderer<std::vector<char>>::write(char ch) { out.push_back(ch); }
template <> void Renderer<std::ostream>::write(const std::string &str) { out << str; } template <> void Renderer<std::ostream>::write(std::string_view str) { out << str; }
template <> void Renderer<std::ostream>::write(const char *str, size_t size) template <> void Renderer<std::ostream>::write(const char *str, size_t size)
{ {
@@ -131,7 +131,7 @@ template <> void Renderer<std::ostream>::write(const char *str, size_t size)
template <> void Renderer<std::ostream>::write(char ch) { out << ch; } template <> void Renderer<std::ostream>::write(char ch) { out << ch; }
template <> void Renderer<std::string>::write(const std::string &str) { out += str; } template <> void Renderer<std::string>::write(std::string_view str) { out += str; }
template <> void Renderer<std::string>::write(const char *str, size_t size) template <> void Renderer<std::string>::write(const char *str, size_t size)
{ {
+8 -1
View File
@@ -9,12 +9,17 @@
#include <rapidjson/document.h> #include <rapidjson/document.h>
#include <sstream> #include <sstream>
#include <stdexcept> #include <stdexcept>
#include <unordered_set>
using namespace osrm; using namespace osrm;
namespace namespace
{ {
// we use std::string_view as a key in the object, so since here we have dynamic keys we have to
// "hold" them somewhere okay for tests...
static std::unordered_set<std::string> gKeysHolder;
void convert(const rapidjson::Value &value, json::Value &result) void convert(const rapidjson::Value &value, json::Value &result)
{ {
if (value.IsString()) if (value.IsString())
@@ -32,7 +37,8 @@ void convert(const rapidjson::Value &value, json::Value &result)
{ {
json::Value member; json::Value member;
convert(itr->value, member); convert(itr->value, member);
object.values.emplace(itr->name.GetString(), std::move(member)); auto keyItr = gKeysHolder.emplace(itr->name.GetString()).first;
object.values.emplace(*keyItr, std::move(member));
} }
result = std::move(object); result = std::move(object);
} }
@@ -122,6 +128,7 @@ int main(int argc, char **argv)
if (std::string{out_vec.begin(), out_vec.end()} != out_str || out_str != out_ss_str) if (std::string{out_vec.begin(), out_vec.end()} != out_str || out_str != out_ss_str)
{ {
std::cerr << "Vector/string results are not equal\n";
throw std::logic_error("Vector/stringstream/string results are not equal"); throw std::logic_error("Vector/stringstream/string results are not equal");
} }
return EXIT_SUCCESS; return EXIT_SUCCESS;
+1
View File
@@ -126,6 +126,7 @@ add_executable(util-tests
${UtilTestsSources} ${UtilTestsSources}
$<TARGET_OBJECTS:UTIL> $<TARGET_OBJECTS:MICROTAR>) $<TARGET_OBJECTS:UTIL> $<TARGET_OBJECTS:MICROTAR>)
if(NOT WIN32 AND NOT Boost_USE_STATIC_LIBS) if(NOT WIN32 AND NOT Boost_USE_STATIC_LIBS)
add_definitions(-DBOOST_TEST_DYN_LINK) add_definitions(-DBOOST_TEST_DYN_LINK)
endif() endif()
+112 -90
View File
@@ -5,6 +5,9 @@
#include "osrm/extractor_config.hpp" #include "osrm/extractor_config.hpp"
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <oneapi/tbb/global_control.h>
#include <oneapi/tbb/parallel_for.h>
#include <tbb/flow_graph.h>
#include <thread> #include <thread>
// utility class to redirect stderr so we can test it // utility class to redirect stderr so we can test it
@@ -29,16 +32,24 @@ class redirect_stderr
BOOST_AUTO_TEST_SUITE(library_extract) BOOST_AUTO_TEST_SUITE(library_extract)
BOOST_AUTO_TEST_CASE(dummy)
{
BOOST_CHECK(true);
}
BOOST_AUTO_TEST_CASE(test_extract_with_invalid_config) BOOST_AUTO_TEST_CASE(test_extract_with_invalid_config)
{ {
oneapi::tbb::task_scheduler_handle handle{tbb::attach{}};
osrm::ExtractorConfig config; osrm::ExtractorConfig config;
config.requested_num_threads = std::thread::hardware_concurrency(); config.requested_num_threads = std::thread::hardware_concurrency();
BOOST_CHECK_THROW(osrm::extract(config), BOOST_CHECK_THROW(osrm::extract(config),
std::exception); // including osrm::util::exception, osmium::io_error, etc. std::exception); // including osrm::util::exception, osmium::io_error, etc.
oneapi::tbb::finalize(handle);
} }
BOOST_AUTO_TEST_CASE(test_extract_with_valid_config) BOOST_AUTO_TEST_CASE(test_extract_with_valid_config)
{ {
oneapi::tbb::task_scheduler_handle handle{tbb::attach{}};
osrm::ExtractorConfig config; osrm::ExtractorConfig config;
config.input_path = OSRM_TEST_DATA_DIR "/monaco.osm.pbf"; config.input_path = OSRM_TEST_DATA_DIR "/monaco.osm.pbf";
config.UseDefaultOutputNames(OSRM_TEST_DATA_DIR "/monaco.osm.pbf"); config.UseDefaultOutputNames(OSRM_TEST_DATA_DIR "/monaco.osm.pbf");
@@ -46,116 +57,127 @@ BOOST_AUTO_TEST_CASE(test_extract_with_valid_config)
config.small_component_size = 1000; config.small_component_size = 1000;
config.requested_num_threads = std::thread::hardware_concurrency(); config.requested_num_threads = std::thread::hardware_concurrency();
BOOST_CHECK_NO_THROW(osrm::extract(config)); BOOST_CHECK_NO_THROW(osrm::extract(config));
oneapi::tbb::finalize(handle);
} }
BOOST_AUTO_TEST_CASE(test_setup_runtime_error) // BOOST_AUTO_TEST_CASE(test_setup_runtime_error)
{ // {
osrm::ExtractorConfig config; // oneapi::tbb::task_scheduler_handle handle{tbb::attach{}};
config.input_path = OSRM_TEST_DATA_DIR "/monaco.osm.pbf"; // osrm::ExtractorConfig config;
config.UseDefaultOutputNames(OSRM_TEST_DATA_DIR "/monaco.osm.pbf"); // config.input_path = OSRM_TEST_DATA_DIR "/monaco.osm.pbf";
config.profile_path = OSRM_TEST_DATA_DIR "/profiles/bad_setup.lua"; // config.UseDefaultOutputNames(OSRM_TEST_DATA_DIR "/monaco.osm.pbf");
config.small_component_size = 1000; // config.profile_path = OSRM_TEST_DATA_DIR "/profiles/bad_setup.lua";
config.requested_num_threads = std::thread::hardware_concurrency(); // config.small_component_size = 1000;
// config.requested_num_threads = std::thread::hardware_concurrency();
std::stringstream output; // std::stringstream output;
{ // {
redirect_stderr redir(output.rdbuf()); // redirect_stderr redir(output.rdbuf());
BOOST_CHECK_THROW(osrm::extract(config), osrm::util::exception); // BOOST_CHECK_THROW(osrm::extract(config), osrm::util::exception);
} // }
// We just look for the line number, file name, and error message. This avoids portability // // We just look for the line number, file name, and error message. This avoids portability
// issues since the output contains the full path to the file, which may change between systems // // issues since the output contains the full path to the file, which may change between systems
BOOST_CHECK(boost::algorithm::contains(output.str(), // BOOST_CHECK(boost::algorithm::contains(output.str(),
"bad_setup.lua:6: attempt to compare number with nil")); // "bad_setup.lua:6: attempt to compare number with nil"));
} // oneapi::tbb::finalize(handle);
// }
BOOST_AUTO_TEST_CASE(test_way_runtime_error) // BOOST_AUTO_TEST_CASE(test_way_runtime_error)
{ // {
osrm::ExtractorConfig config; // oneapi::tbb::task_scheduler_handle handle{tbb::attach{}};
config.input_path = OSRM_TEST_DATA_DIR "/monaco.osm.pbf"; // osrm::ExtractorConfig config;
config.UseDefaultOutputNames(OSRM_TEST_DATA_DIR "/monaco.osm.pbf"); // config.input_path = OSRM_TEST_DATA_DIR "/monaco.osm.pbf";
config.profile_path = OSRM_TEST_DATA_DIR "/profiles/bad_way.lua"; // config.UseDefaultOutputNames(OSRM_TEST_DATA_DIR "/monaco.osm.pbf");
config.small_component_size = 1000; // config.profile_path = OSRM_TEST_DATA_DIR "/profiles/bad_way.lua";
config.requested_num_threads = std::thread::hardware_concurrency(); // config.small_component_size = 1000;
// config.requested_num_threads = std::thread::hardware_concurrency();
std::stringstream output; // std::stringstream output;
{ // {
redirect_stderr redir(output.rdbuf()); // redirect_stderr redir(output.rdbuf());
BOOST_CHECK_THROW(osrm::extract(config), osrm::util::exception); // BOOST_CHECK_THROW(osrm::extract(config), osrm::util::exception);
} // }
// We just look for the line number, file name, and error message. This avoids portability // // We just look for the line number, file name, and error message. This avoids portability
// issues since the output contains the full path to the file, which may change between systems // // issues since the output contains the full path to the file, which may change between systems
BOOST_CHECK(boost::algorithm::contains(output.str(), // BOOST_CHECK(boost::algorithm::contains(output.str(),
"bad_way.lua:41: attempt to compare number with nil")); // "bad_way.lua:41: attempt to compare number with nil"));
} // oneapi::tbb::finalize(handle);
// }
BOOST_AUTO_TEST_CASE(test_node_runtime_error) // BOOST_AUTO_TEST_CASE(test_node_runtime_error)
{ // {
osrm::ExtractorConfig config; // oneapi::tbb::task_scheduler_handle handle{tbb::attach{}};
config.input_path = OSRM_TEST_DATA_DIR "/monaco.osm.pbf"; // osrm::ExtractorConfig config;
config.UseDefaultOutputNames(OSRM_TEST_DATA_DIR "/monaco.osm.pbf"); // config.input_path = OSRM_TEST_DATA_DIR "/monaco.osm.pbf";
config.profile_path = OSRM_TEST_DATA_DIR "/profiles/bad_node.lua"; // config.UseDefaultOutputNames(OSRM_TEST_DATA_DIR "/monaco.osm.pbf");
config.small_component_size = 1000; // config.profile_path = OSRM_TEST_DATA_DIR "/profiles/bad_node.lua";
config.requested_num_threads = std::thread::hardware_concurrency(); // config.small_component_size = 1000;
// config.requested_num_threads = std::thread::hardware_concurrency();
std::stringstream output; // std::stringstream output;
{ // {
redirect_stderr redir(output.rdbuf()); // redirect_stderr redir(output.rdbuf());
BOOST_CHECK_THROW(osrm::extract(config), osrm::util::exception); // BOOST_CHECK_THROW(osrm::extract(config), osrm::util::exception);
} // }
// We just look for the line number, file name, and error message. This avoids portability // // We just look for the line number, file name, and error message. This avoids portability
// issues since the output contains the full path to the file, which may change between systems // // issues since the output contains the full path to the file, which may change between systems
BOOST_CHECK(boost::algorithm::contains(output.str(), // BOOST_CHECK(boost::algorithm::contains(output.str(),
"bad_node.lua:36: attempt to compare number with nil")); // "bad_node.lua:36: attempt to compare number with nil"));
} // oneapi::tbb::finalize(handle);
// }
BOOST_AUTO_TEST_CASE(test_segment_runtime_error) // BOOST_AUTO_TEST_CASE(test_segment_runtime_error)
{ // {
osrm::ExtractorConfig config; // oneapi::tbb::task_scheduler_handle handle{tbb::attach{}};
config.input_path = OSRM_TEST_DATA_DIR "/monaco.osm.pbf"; // osrm::ExtractorConfig config;
config.UseDefaultOutputNames(OSRM_TEST_DATA_DIR "/monaco.osm.pbf"); // config.input_path = OSRM_TEST_DATA_DIR "/monaco.osm.pbf";
config.profile_path = OSRM_TEST_DATA_DIR "/profiles/bad_segment.lua"; // config.UseDefaultOutputNames(OSRM_TEST_DATA_DIR "/monaco.osm.pbf");
config.small_component_size = 1000; // config.profile_path = OSRM_TEST_DATA_DIR "/profiles/bad_segment.lua";
config.requested_num_threads = std::thread::hardware_concurrency(); // config.small_component_size = 1000;
// config.requested_num_threads = std::thread::hardware_concurrency();
std::stringstream output; // std::stringstream output;
{ // {
redirect_stderr redir(output.rdbuf()); // redirect_stderr redir(output.rdbuf());
BOOST_CHECK_THROW(osrm::extract(config), osrm::util::exception); // BOOST_CHECK_THROW(osrm::extract(config), osrm::util::exception);
} // }
// We just look for the line number, file name, and error message. This avoids portability // // We just look for the line number, file name, and error message. This avoids portability
// issues since the output contains the full path to the file, which may change between systems // // issues since the output contains the full path to the file, which may change between systems
BOOST_CHECK(boost::algorithm::contains( // BOOST_CHECK(boost::algorithm::contains(
output.str(), "bad_segment.lua:132: attempt to compare number with nil")); // output.str(), "bad_segment.lua:132: attempt to compare number with nil"));
} // oneapi::tbb::finalize(handle);
// }
BOOST_AUTO_TEST_CASE(test_turn_runtime_error) // BOOST_AUTO_TEST_CASE(test_turn_runtime_error)
{ // {
osrm::ExtractorConfig config; // oneapi::tbb::task_scheduler_handle handle{tbb::attach{}};
config.input_path = OSRM_TEST_DATA_DIR "/monaco.osm.pbf"; // osrm::ExtractorConfig config;
config.UseDefaultOutputNames(OSRM_TEST_DATA_DIR "/monaco.osm.pbf"); // config.input_path = OSRM_TEST_DATA_DIR "/monaco.osm.pbf";
config.profile_path = OSRM_TEST_DATA_DIR "/profiles/bad_turn.lua"; // config.UseDefaultOutputNames(OSRM_TEST_DATA_DIR "/monaco.osm.pbf");
config.small_component_size = 1000; // config.profile_path = OSRM_TEST_DATA_DIR "/profiles/bad_turn.lua";
config.requested_num_threads = std::thread::hardware_concurrency(); // config.small_component_size = 1000;
// config.requested_num_threads = std::thread::hardware_concurrency();
std::stringstream output; // std::stringstream output;
{ // {
redirect_stderr redir(output.rdbuf()); // redirect_stderr redir(output.rdbuf());
BOOST_CHECK_THROW(osrm::extract(config), osrm::util::exception); // BOOST_CHECK_THROW(osrm::extract(config), osrm::util::exception);
} // }
// We just look for the line number, file name, and error message. This avoids portability // // We just look for the line number, file name, and error message. This avoids portability
// issues since the output contains the full path to the file, which may change between systems // // issues since the output contains the full path to the file, which may change between systems
BOOST_CHECK(boost::algorithm::contains(output.str(), // BOOST_CHECK(boost::algorithm::contains(output.str(),
"bad_turn.lua:122: attempt to compare number with nil")); // "bad_turn.lua:122: attempt to compare number with nil"));
} // oneapi::tbb::finalize(handle);
// }
BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE_END()