Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion .github/actions/benchmark_epilogue/action.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,33 @@
name: "Benchmark Epilogue"
description: "Processes coverage information with lcov and uploads it to coveralls/codecov"
inputs:
compiler:
required: True
description: 'Compiler used to build benchmark'
os:
required: True
description: 'OS used to build benchmark'
stdlib:
required: True
description: 'C++ standard library used to build benchmark'
build-output-dir:
required: true
description: 'Build output directory'
runs:
using: "composite"
steps:
- name: Archive benchmark results
uses: actions/upload-artifact@v4
with:
name: benchmark_${{ inputs.os }}_${{ inputs.compiler }}_${{ inputs.stdlib }}_json
path: ${{ inputs.build-output-dir }}/benchmark/benchmark_result.json

# Download previous benchmark result from cache (if exists)
- name: Download previous benchmark data
uses: actions/cache@v4
with:
path: ./cache
key: ${{ runner.os }}-benchmark
key: benchmark_${{ inputs.os }}_${{ inputs.compiler }}_${{ inputs.stdlib }}

- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
Expand Down
17 changes: 17 additions & 0 deletions .github/problem_matchers/clang_problem_matcher.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"problemMatcher": [
{
"owner": "clang",
"pattern": [
{
"regexp": "^(.*?):(\\d+):(\\d*):?\\s+(?:fatal\\s+)?(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
]
}
]
}
17 changes: 17 additions & 0 deletions .github/problem_matchers/gcc_problem_matcher.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"problemMatcher": [
{
"owner": "gcc",
"pattern": [
{
"regexp": "^(.*?):(\\d+):(\\d*):?\\s+(?:fatal\\s+)?(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
]
}
]
}
18 changes: 18 additions & 0 deletions .github/problem_matchers/msvc_problem_matcher.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"problemMatcher": [
{
"owner": "msvc",
"pattern": [
{
"regexp": "^(?:\\s+\\d+\\>)?([^\\s].*)\\((\\d+),?(\\d+)?(?:,\\d+,\\d+)?\\)\\s*:\\s+(error|warning|info)\\s+(\\w{1,2}\\d+)\\s*:\\s*(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"code": 5,
"message": 6
}
]
}
]
}
9 changes: 9 additions & 0 deletions .github/workflows/cmake-multi-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,16 @@ jobs:
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}

- name: Register Compiler Problem Matcher
run: echo "::add-matcher::.github/problem_matchers/${{ matrix.compiler}}_problem_matcher.json"

- name: Build
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --target ${{ matrix.target }} --config ${{ matrix.build_type }} --parallel

- name: Unregister Compiler Problem Matcher
run: echo "::remove-matcher owner=${{ matrix.compiler}}::"

- name: Test
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
Expand All @@ -123,4 +129,7 @@ jobs:
- uses: ./.github/actions/benchmark_epilogue
if: matrix.preset == 'benchmark'
with:
os: ${{ matrix.os }}
compiler: ${{ matrix.compiler }}
stdlib: ${{ matrix.stdlib }}
build-output-dir: ${{ steps.strings.outputs.build-output-dir }}
35 changes: 15 additions & 20 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@

include(FetchContent)

find_package(GTest)
if (NOT GTest OR "${GTest_DIR}" STREQUAL "GTest-NOTFOUND")
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG 6910c9d9165801d8827d628cb72eb7ea9dd538c5 # v1.16.x
)
# For Windows: Prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
include(GoogleTest)
if (NOT TARGET GTest::gtest)
find_package(GTest)
if (NOT GTest_DIR OR "${GTest_DIR}" STREQUAL "GTest_DIR-NOTFOUND")
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG 6910c9d9165801d8827d628cb72eb7ea9dd538c5 # v1.16.x
)
# For Windows: Prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
include(GoogleTest)
endif()
endif()

add_executable(bitlib-tests)
Expand All @@ -40,27 +42,20 @@ target_sources(bitlib-tests PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src/vector_test.cpp
${CMAKE_CURRENT_SOURCE_DIR}/inc/test_utils.hpp
)
target_include_directories(bitlib-tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/inc)

if (BITLIB_MDSPAN)
target_sources(bitlib-tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/test-mdspan.cpp)
endif()

# ASAN throws no matter what when using Google HWY, not sure why but need to fix
# if (NOT BITLIB_HWY)
# target_compile_options(bitlib-tests PUBLIC -fsanitize=address)
# target_link_options(bitlib-tests PUBLIC -fsanitize=address)
# endif()
target_include_directories(bitlib-tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/inc)


# specify test-specific libraries
target_link_libraries(bitlib-tests PRIVATE bitlib GTest::gtest GTest::gtest_main)
target_link_options(bitlib-tests PRIVATE -pthread -lgcov --coverage)

if (NOT BITLIB_GTEST_REPEAT)
set(BITLIB_GTEST_REPEAT 1)
endif()

enable_testing()
gtest_discover_tests(
bitlib-tests
EXTRA_ARGS --gtest_repeat=${BITLIB_GTEST_REPEAT})
Loading