Skip to content

Commit

Permalink
fix: add git to aarch64 container in CI (ada-url#652)
Browse files Browse the repository at this point in the history
* fix: add git to aarch64 container in CI

* add permissions

* set ctest timeout

* fix: keep just sanitizers

* Update CMakeLists.txt

* Update aarch64.yml: simplify as much as possible.

* Update aarch64.yml: reenable sanitizer

* Update CMakeLists.txt

* fix: try without leak detection

* fix: use bound checker

---------

Co-authored-by: Yagiz Nizipli <yagiz@nizipli.com>
  • Loading branch information
lemire and anonrig authored May 14, 2024
1 parent 2cea09f commit 77dc0d0
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 12 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/aarch64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ on:
- '**.md'
- 'docs/**'

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Expand All @@ -22,7 +25,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
shared: [ON, OFF]
shared: [OFF]
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- uses: uraimo/run-on-arch-action@v2
Expand All @@ -33,11 +36,11 @@ jobs:
with:
arch: aarch64
githubToken: ${{ github.token }}
distro: ubuntu_latest
distro: ubuntu22.04
install: |
apt-get update -q -y
apt-get install -y cmake make g++ ninja-build
apt-get install -y cmake make g++ ninja-build git
run: |
cmake -DADA_SANITIZE=ON -DADA_DEVELOPMENT_CHECKS=ON -DBUILD_SHARED_LIBS=${{matrix.shared}} -G Ninja -B build
cmake --build build -j=2
cmake -DADA_SANITIZE_BOUNDS_STRICT=ON -DBUILD_SHARED_LIBS=${{matrix.shared}} -B build
cmake --build build
ctest --test-dir build
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ if(ADA_TESTING OR ADA_BENCHMARKS OR ADA_TOOLS)

if (ADA_TESTING AND NOT EMSCRIPTEN)
if(Git_FOUND)
set(CTEST_TEST_TIMEOUT 5)
message(STATUS "The tests are enabled.")
add_subdirectory(tests)
else()
Expand Down
5 changes: 4 additions & 1 deletion cmake/ada-flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ option(ADA_SANITIZE_UNDEFINED "Sanitize undefined behaviour" OFF)
if(ADA_SANITIZE)
message(STATUS "Address sanitizer enabled.")
endif()
if(ADA_SANITIZE_WITHOUT_LEAKS)
message(STATUS "Address sanitizer (but not leak) enabled.")
endif()
if(ADA_SANITIZE_UNDEFINED)
message(STATUS "Undefined sanitizer enabled.")
endif()
Expand Down Expand Up @@ -35,7 +38,7 @@ if (ADA_COVERAGE)
endif()

if (NOT CMAKE_BUILD_TYPE)
if(ADA_SANITIZE OR ADA_SANITIZE_BOUNDS_STRICT OR ADA_SANITIZE_UNDEFINED)
if(ADA_SANITIZE OR ADA_SANITIZE_WITHOUT_LEAKS OR ADA_SANITIZE_BOUNDS_STRICT OR ADA_SANITIZE_UNDEFINED)
message(STATUS "No build type selected, default to Debug because you have sanitizers.")
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE)
else()
Expand Down
3 changes: 3 additions & 0 deletions cmake/add-cpp-test.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ function(add_cpp_test TEST_NAME)
add_compile_options(-fsanitize=address -fno-omit-frame-pointer -fno-sanitize-recover=all)
add_compile_definitions(ASAN_OPTIONS=detect_leaks=1)
endif()
if(ADA_SANITIZE_WITHOUT_LEAKS)
add_compile_options(-fsanitize=address -fno-omit-frame-pointer -fno-sanitize-recover=all)
endif()
if(ADA_SANITIZE_BOUNDS_STRICT)
add_compile_options(-fsanitize=bounds-strict -fno-sanitize-recover=all)
add_link_options(-fsanitize=bounds-strict)
Expand Down
4 changes: 4 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ if(ADA_SANITIZE)
target_compile_definitions(ada INTERFACE ASAN_OPTIONS=detect_leaks=1)
target_link_libraries(ada INTERFACE -fsanitize=address -fno-omit-frame-pointer -fno-sanitize-recover=all)
endif()
if(ADA_SANITIZE_WITHOUT_LEAKS)
target_compile_options(ada INTERFACE -fsanitize=address -fno-omit-frame-pointer -fno-sanitize-recover=all)
target_link_libraries(ada INTERFACE -fsanitize=address -fno-omit-frame-pointer -fno-sanitize-recover=all)
endif()

if(ADA_LOGGING)
target_compile_definitions(ada PRIVATE ADA_LOGGING=1)
Expand Down
12 changes: 6 additions & 6 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ else()
target_link_libraries(ada_c PRIVATE simdjson GTest::gtest_main)
target_link_libraries(url_search_params PRIVATE simdjson GTest::gtest_main)

gtest_discover_tests(wpt_tests)
gtest_discover_tests(url_components)
gtest_discover_tests(basic_tests)
gtest_discover_tests(from_file_tests)
gtest_discover_tests(ada_c)
gtest_discover_tests(url_search_params)
gtest_discover_tests(wpt_tests PROPERTIES TEST_DISCOVERY_TIMEOUT 600)
gtest_discover_tests(url_components PROPERTIES TEST_DISCOVERY_TIMEOUT 600)
gtest_discover_tests(basic_tests PROPERTIES TEST_DISCOVERY_TIMEOUT 600)
gtest_discover_tests(from_file_tests PROPERTIES TEST_DISCOVERY_TIMEOUT 600)
gtest_discover_tests(ada_c PROPERTIES TEST_DISCOVERY_TIMEOUT 600)
gtest_discover_tests(url_search_params PROPERTIES TEST_DISCOVERY_TIMEOUT 600)

if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9)
Expand Down

0 comments on commit 77dc0d0

Please sign in to comment.