diff --git a/.github/workflows/osrm-backend.yml b/.github/workflows/osrm-backend.yml index 461034bba..421a33ddc 100644 --- a/.github/workflows/osrm-backend.yml +++ b/.github/workflows/osrm-backend.yml @@ -148,26 +148,26 @@ jobs: strategy: matrix: include: - - name: gcc-9-debug-cov + - name: gcc-13-debug-cov continue-on-error: false - node: 18 - runs-on: ubuntu-20.04 + node: 20 + runs-on: ubuntu-22.04 BUILD_TOOLS: ON BUILD_TYPE: Debug - CCOMPILER: gcc-9 + CCOMPILER: gcc-13 CUCUMBER_TIMEOUT: 20000 - CXXCOMPILER: g++-9 + CXXCOMPILER: g++-13 ENABLE_COVERAGE: ON - - name: gcc-9-debug-asan-ubsan + - name: clang-15-debug-asan-ubsan continue-on-error: false - node: 18 - runs-on: ubuntu-20.04 + node: 20 + runs-on: ubuntu-22.04 BUILD_TOOLS: ON BUILD_TYPE: Debug - CCOMPILER: gcc-9 + CCOMPILER: clang-15 CUCUMBER_TIMEOUT: 20000 - CXXCOMPILER: g++-9 + CXXCOMPILER: clang++-15 ENABLE_SANITIZER: ON TARGET_ARCH: x86_64-asan-ubsan OSRM_CONNECTION_RETRIES: 10 @@ -245,9 +245,20 @@ jobs: CXXCOMPILER: clang++-15 ENABLE_CONAN: ON + - name: gcc-13-release + continue-on-error: false + node: 20 + runs-on: ubuntu-22.04 + BUILD_TOOLS: ON + BUILD_TYPE: Release + CCOMPILER: gcc-13 + CXXCOMPILER: g++-13 + ENABLE_BENCHMARKS: ON + CXXFLAGS: '-Wno-array-bounds -Wno-uninitialized' + - name: gcc-12-release continue-on-error: false - node: 18 + node: 20 runs-on: ubuntu-22.04 BUILD_TOOLS: ON BUILD_TYPE: Release @@ -258,56 +269,14 @@ jobs: - name: gcc-11-release continue-on-error: false - node: 18 - runs-on: ubuntu-20.04 + node: 20 + runs-on: ubuntu-22.04 BUILD_TOOLS: ON BUILD_TYPE: Release CCOMPILER: gcc-11 CXXCOMPILER: g++-11 ENABLE_BENCHMARKS: ON - - name: gcc-10-release - continue-on-error: false - node: 18 - runs-on: ubuntu-20.04 - BUILD_TOOLS: ON - BUILD_TYPE: Release - CCOMPILER: gcc-10 - CXXCOMPILER: g++-10 - - - name: gcc-9-release - continue-on-error: false - node: 18 - runs-on: ubuntu-20.04 - BUILD_TOOLS: ON - BUILD_TYPE: Release - CCOMPILER: gcc-9 - CXXCOMPILER: g++-9 - CXXFLAGS: -Wno-cast-function-type - - - name: gcc-9-conan-release-i686 - continue-on-error: false - node: 18 - runs-on: ubuntu-20.04 - BUILD_TOOLS: ON - BUILD_TYPE: Release - CCOMPILER: gcc-9 - CFLAGS: "-m32 -msse2 -mfpmath=sse" - CXXCOMPILER: g++-9 - CXXFLAGS: "-m32 -msse2 -mfpmath=sse" - TARGET_ARCH: i686 - ENABLE_CONAN: ON - - - name: gcc-8-release - continue-on-error: false - node: 18 - runs-on: ubuntu-20.04 - BUILD_TOOLS: ON - BUILD_TYPE: Release - CCOMPILER: gcc-8 - CXXCOMPILER: g++-8 - CXXFLAGS: -Wno-cast-function-type - - name: conan-linux-release-node build_node_package: true continue-on-error: false @@ -422,6 +391,7 @@ jobs: # We can only set this after checkout once we know the workspace directory echo "LSAN_OPTIONS=print_suppressions=0:suppressions=${GITHUB_WORKSPACE}/scripts/ci/leaksanitizer.conf" >> $GITHUB_ENV echo "UBSAN_OPTIONS=symbolize=1:halt_on_error=1:print_stacktrace=1:suppressions=${GITHUB_WORKSPACE}/scripts/ci/undefinedsanitizer.conf" >> $GITHUB_ENV + echo "ASAN_OPTIONS=print_suppressions=0:suppressions=${GITHUB_WORKSPACE}/scripts/ci/addresssanitizer.conf" >> $GITHUB_ENV fi if [[ "${RUNNER_OS}" == "Linux" ]]; then @@ -448,7 +418,7 @@ jobs: fi # Linux dev packages - if [ "${TARGET_ARCH}" != "i686" ] && [ "${ENABLE_CONAN}" != "ON" ]; then + if [ "${ENABLE_CONAN}" != "ON" ]; then sudo apt-get update -y sudo apt-get install -y libbz2-dev libxml2-dev libzip-dev liblua5.2-dev libboost-all-dev if [[ "${CCOMPILER}" != clang-* ]]; then @@ -457,9 +427,6 @@ jobs: 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 - echo "PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig:${PKG_CONFIG_PATH}" >> $GITHUB_ENV fi # TBB @@ -539,7 +506,7 @@ jobs: # All tests assume to be run from the build directory pushd ${OSRM_BUILD_DIR} for i in ./unit_tests/*-tests ; do echo Running $i ; $i ; done - if [ -z "${ENABLE_SANITIZER}" ] && [ "$TARGET_ARCH" != "i686" ]; then + if [ -z "${ENABLE_SANITIZER}" ]; then npm run nodejs-tests fi popd @@ -594,12 +561,12 @@ jobs: name: logs path: test/logs/ - - 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 + # - 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 diff --git a/CMakeLists.txt b/CMakeLists.txt index 1a87e2833..23bd0bcad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -115,7 +115,7 @@ include(GNUInstallDirs) if(CMAKE_SIZEOF_VOID_P EQUAL 8) message(STATUS "Building on a 64 bit system") else() - message(STATUS "Building on a 32 bit system") + message(FATAL_ERROR "Building on a 32 bit system is not supported") endif() include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}/include/) @@ -223,7 +223,7 @@ endif() set(MAYBE_COVERAGE_LIBRARIES "") if (ENABLE_COVERAGE) if (NOT CMAKE_BUILD_TYPE MATCHES "Debug") - message(ERROR "ENABLE_COVERAGE=ON only make sense with a Debug build") + message(ERROR "ENABLE_COVERAGE=ON only makes sense with a Debug build") endif() message(STATUS "Enabling coverage") set(MAYBE_COVERAGE_LIBRARIES "-lgcov") diff --git a/include/guidance/turn_instruction.hpp b/include/guidance/turn_instruction.hpp index 45ab1f5df..ce7bb7bc0 100644 --- a/include/guidance/turn_instruction.hpp +++ b/include/guidance/turn_instruction.hpp @@ -1,13 +1,14 @@ #ifndef OSRM_GUIDANCE_TURN_INSTRUCTION_HPP_ #define OSRM_GUIDANCE_TURN_INSTRUCTION_HPP_ -#include -#include - #include "guidance/roundabout_type.hpp" #include "util/attributes.hpp" #include "util/typedefs.hpp" +#include +#include +#include + namespace osrm::guidance { @@ -154,24 +155,23 @@ inline bool operator==(const TurnInstruction lhs, const TurnInstruction rhs) inline bool hasRoundaboutType(const TurnInstruction instruction) { using namespace guidance::TurnType; - const constexpr TurnType::Enum valid_types[] = {TurnType::EnterRoundabout, - TurnType::EnterAndExitRoundabout, - TurnType::EnterRotary, - TurnType::EnterAndExitRotary, - TurnType::EnterRoundaboutIntersection, - TurnType::EnterAndExitRoundaboutIntersection, - TurnType::EnterRoundaboutAtExit, - TurnType::ExitRoundabout, - TurnType::EnterRotaryAtExit, - TurnType::ExitRotary, - TurnType::EnterRoundaboutIntersectionAtExit, - TurnType::ExitRoundaboutIntersection, - TurnType::StayOnRoundabout}; + const constexpr std::array valid_types = { + TurnType::EnterRoundabout, + TurnType::EnterAndExitRoundabout, + TurnType::EnterRotary, + TurnType::EnterAndExitRotary, + TurnType::EnterRoundaboutIntersection, + TurnType::EnterAndExitRoundaboutIntersection, + TurnType::EnterRoundaboutAtExit, + TurnType::ExitRoundabout, + TurnType::EnterRotaryAtExit, + TurnType::ExitRotary, + TurnType::EnterRoundaboutIntersectionAtExit, + TurnType::ExitRoundaboutIntersection, + TurnType::StayOnRoundabout}; - const auto *first = valid_types; - const auto *last = first + sizeof(valid_types) / sizeof(valid_types[0]); - - return std::find(first, last, instruction.type) != last; + return std::find(valid_types.cbegin(), valid_types.cend(), instruction.type) != + valid_types.cend(); } inline bool entersRoundabout(const guidance::TurnInstruction instruction) diff --git a/scripts/ci/addresssanitizer.conf b/scripts/ci/addresssanitizer.conf new file mode 100644 index 000000000..e69de29bb diff --git a/scripts/ci/before_install.i686.sh b/scripts/ci/before_install.i686.sh deleted file mode 100644 index a7b8c5f61..000000000 --- a/scripts/ci/before_install.i686.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -ex - -sudo dpkg --add-architecture i386 -sudo add-apt-repository --yes ppa:ubuntu-toolchain-r/test && ( sudo apt-get update -qq --yes || true ) - -sudo apt-get install -qq --yes --force-yes g++-9-multilib libxml2-dev:i386 libexpat1-dev:i386 libzip-dev:i386 libbz2-dev:i386 libtbb-dev:i386 lua5.2:i386 liblua5.2-dev:i386 libboost-date-time-dev:i386 libboost-filesystem-dev:i386 libboost-iostreams-dev:i386 libboost-program-options-dev:i386 libboost-regex-dev:i386 libboost-system-dev:i386 libboost-thread-dev:i386 libboost-test-dev:i386 diff --git a/scripts/ci/undefinedsanitizer.conf b/scripts/ci/undefinedsanitizer.conf index fc1fd8996..ada8e085b 100644 --- a/scripts/ci/undefinedsanitizer.conf +++ b/scripts/ci/undefinedsanitizer.conf @@ -1,3 +1,4 @@ +alignment:src/contractor/graph_contractor.cpp enum:include/tbb/pipeline.h vptr:src/util/log.cpp vptr:include/tbb/task.h @@ -13,4 +14,4 @@ signed-integer-overflow:include/engine/internal_route_result.hpp pointer-overflow:third_party/sol2/sol/stack_core.hpp pointer-overflow:third_party/rapidjson/include/rapidjson/internal/stack.h nonnull-attribute:third_party/microtar/src/microtar.c -integer-divide-by-zero:unit_tests/library/route.cpp \ No newline at end of file +integer-divide-by-zero:unit_tests/library/route.cpp diff --git a/src/extractor/scripting_environment_lua.cpp b/src/extractor/scripting_environment_lua.cpp index f73c16eed..200efa8b1 100644 --- a/src/extractor/scripting_environment_lua.cpp +++ b/src/extractor/scripting_environment_lua.cpp @@ -96,11 +96,18 @@ struct to_lua_object : public boost::static_visitor // caught but instead should terminate the process. The point of having this error handler rather // than just using unprotected Lua functions which terminate the process automatically is that this // function provides more useful error messages including Lua tracebacks and line numbers. -void handle_lua_error(sol::protected_function_result &luares) +void handle_lua_error(const sol::protected_function_result &luares) { sol::error luaerr = luares; - std::string msg = luaerr.what(); - std::cerr << msg << std::endl; + const auto msg = luaerr.what(); + if (msg != nullptr) + { + std::cerr << msg << "\n"; + } + else + { + std::cerr << "unknown error\n"; + } throw util::exception("Lua error (see stderr for traceback)"); } @@ -1080,7 +1087,7 @@ Sol2ScriptingEnvironment::GetStringListsFromTable(const std::string &table_name) for (const auto &pair : *table) { - sol::table inner_table = pair.second; + const sol::table &inner_table = pair.second; if (!inner_table.valid()) { throw util::exception("Expected a sub-table at " + table_name + "[" +