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
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: C++

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
unit-tests:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake g++

- name: Configure
run: |
cmake -S . -B build \
-DNSQUEUE_BUILD_TESTS=ON \
-DNSQUEUE_BUILD_BENCHMARKS=OFF \
-DCMAKE_BUILD_TYPE=Release

- name: Build
run: |
cmake --build build --config Release

- name: Run unit tests
run: |
ctest --test-dir build -L unit --output-on-failure
28 changes: 22 additions & 6 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,31 @@ FetchContent_Declare(

FetchContent_MakeAvailable(Catch2)

add_executable(spsc_test
add_executable(spsc_unit_tests
spsc_test.cc
)

target_link_libraries(spsc_test
PRIVATE
nsqueue
Catch2::Catch2WithMain
target_link_libraries(spsc_unit_tests
PRIVATE nsqueue Catch2::Catch2WithMain
)

include(Catch)
catch_discover_tests(spsc_test)
catch_discover_tests(
spsc_unit_tests
TEST_SPEC "[unit]"
PROPERTIES LABELS unit
)

add_executable(spsc_stress_tests
spsc_test.cc
)

target_link_libraries(spsc_stress_tests
PRIVATE nsqueue Catch2::Catch2WithMain
)

catch_discover_tests(
spsc_stress_tests
TEST_SPEC "[stress]"
PROPERTIES LABELS stress
)
2 changes: 1 addition & 1 deletion tests/spsc_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ TEST_CASE("wrap around", "[unit]"){
REQUIRE(q.empty());
};

TEST_CASE("stress", "[unit]"){
TEST_CASE("stress", "[stress]"){
constexpr int N = 200'000;
nsqueue::spsc_queue<int,1024> q;

Expand Down