Skip to content

Commit 1e2def4

Browse files
authored
Merge pull request #452 from carlosqwqqwq/riscv-concurrentqueue
Add native and RISC-V unit test coverage
2 parents d655418 + 8a99cf1 commit 1e2def4

2 files changed

Lines changed: 52 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
native-linux-unittests:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- name: Install native toolchain
14+
run: |
15+
sudo apt-get update
16+
sudo apt-get install -y g++
17+
18+
- name: Build unit tests
19+
working-directory: build
20+
run: |
21+
mkdir -p bin
22+
g++ -c -std=c++11 -Wall -pedantic-errors -Wpedantic -Wconversion -DMOODYCAMEL_STATIC -pthread -g -O0 -fno-elide-constructors -fno-exceptions ../c_api/blockingconcurrentqueue.cpp ../c_api/concurrentqueue.cpp
23+
g++ -std=c++11 -Wall -pedantic-errors -Wpedantic -Wconversion -DMOODYCAMEL_STATIC -pthread -g -O0 -fno-elide-constructors ../tests/common/simplethread.cpp ../tests/common/systemtime.cpp ../tests/unittests/unittests.cpp blockingconcurrentqueue.o concurrentqueue.o -o bin/unittests -lrt
24+
25+
- name: Run unit tests
26+
working-directory: build
27+
run: ./bin/unittests --disable-prompt --iterations 1
28+
29+
riscv64-linux-unittests:
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v4
33+
34+
- name: Install RISC-V toolchain and QEMU
35+
run: |
36+
sudo apt-get update
37+
sudo apt-get install -y g++-riscv64-linux-gnu qemu-user-static
38+
39+
- name: Build RISC-V unit tests
40+
working-directory: build
41+
run: |
42+
mkdir -p bin-riscv
43+
riscv64-linux-gnu-g++ -c -std=c++11 -Wall -pedantic-errors -Wpedantic -Wconversion -DMOODYCAMEL_STATIC -pthread -g -O0 -fno-elide-constructors -fno-exceptions ../c_api/blockingconcurrentqueue.cpp ../c_api/concurrentqueue.cpp
44+
riscv64-linux-gnu-g++ -std=c++11 -Wall -pedantic-errors -Wpedantic -Wconversion -DMOODYCAMEL_STATIC -pthread -g -O0 -fno-elide-constructors ../tests/common/simplethread.cpp ../tests/common/systemtime.cpp ../tests/unittests/unittests.cpp blockingconcurrentqueue.o concurrentqueue.o -o bin-riscv/unittests-riscv64 -lrt
45+
46+
- name: Run RISC-V unit tests under QEMU
47+
working-directory: build
48+
run: qemu-riscv64-static -L /usr/riscv64-linux-gnu ./bin-riscv/unittests-riscv64 --disable-prompt --iterations 1

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -454,9 +454,10 @@ I've written quite a few unit tests as well as a randomized long-running fuzz te
454454
core queue algorithm through the [CDSChecker][cdschecker] C++11 memory model model checker. Some of the
455455
inner algorithms were tested separately using the [Relacy][relacy] model checker, and full integration
456456
tests were also performed with Relacy.
457-
I've tested
458-
on Linux (Fedora 19) and Windows (7), but only on x86 processors so far (Intel and AMD). The code was
459-
written to be platform-independent, however, and should work across all processors and OSes.
457+
I've tested
458+
on Linux (Fedora 19) and Windows (7) on x86 processors (Intel and AMD), and the GitHub Actions CI now also
459+
cross-compiles and runs the unit tests for `riscv64` Linux under QEMU. The code was written to be
460+
platform-independent, and should work across all processors and OSes.
460461

461462
Due to the complexity of the implementation and the difficult-to-test nature of lock-free code in general,
462463
there may still be bugs. If anyone is seeing buggy behaviour, I'd like to hear about it! (Especially if

0 commit comments

Comments
 (0)