Skip to content

Commit 7dc9675

Browse files
committed
Upgrade wolfIP CI testing
1 parent b780a7d commit 7dc9675

5 files changed

Lines changed: 149 additions & 1 deletion

File tree

.github/workflows/codespell.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Codespell
2+
3+
on:
4+
push:
5+
branches: [ 'master', 'main', 'release/**' ]
6+
pull_request:
7+
branches: [ '*' ]
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
codespell:
15+
name: Check spelling
16+
runs-on: ubuntu-latest
17+
timeout-minutes: 5
18+
steps:
19+
- name: Checkout wolfIP
20+
uses: actions/checkout@v4
21+
22+
- name: Run codespell
23+
uses: codespell-project/actions-codespell@v2
24+
with:
25+
skip: .git,./IDE,*.der,*.pem
26+
ignore_words_list: inh,inout,keypair,nd,parm,rcv,ser,tha,HSI,TE,UE
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Multiple Compilers
2+
3+
on:
4+
push:
5+
branches: [ 'master', 'main', 'release/**' ]
6+
pull_request:
7+
branches: [ '*' ]
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
compiler_test:
15+
name: ${{ matrix.cc }}
16+
runs-on: ubuntu-latest
17+
timeout-minutes: 10
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
include:
22+
- cc: gcc-11
23+
- cc: gcc-12
24+
- cc: gcc-13
25+
- cc: clang-14
26+
- cc: clang-15
27+
- cc: clang-17
28+
29+
steps:
30+
- name: Install compiler
31+
run: |
32+
sudo apt-get update
33+
sudo apt-get install -y ${{ matrix.cc }}
34+
35+
- name: Checkout wolfIP
36+
uses: actions/checkout@v4
37+
with:
38+
submodules: true
39+
40+
- name: Install dependencies
41+
run: |
42+
sudo apt-get install -y libwolfssl-dev check
43+
sudo modprobe tun
44+
45+
- name: Build wolfIP with ${{ matrix.cc }}
46+
run: |
47+
mkdir -p build/port
48+
make CC=${{ matrix.cc }}
49+
50+
- name: Build unit tests
51+
run: make unit CC=${{ matrix.cc }}
52+
53+
- name: Run unit tests
54+
run: ./build/test/unit
55+
56+
- name: Run standalone TTL expired test
57+
run: ./build/test-ttl-expired

.github/workflows/sanitizers.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Sanitizer Tests
2+
3+
on:
4+
push:
5+
branches: [ 'master', 'main', 'release/**' ]
6+
pull_request:
7+
branches: [ '*' ]
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
sanitizer_test:
15+
name: ${{ matrix.name }}
16+
runs-on: ubuntu-latest
17+
timeout-minutes: 10
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
include:
22+
- name: "ASan"
23+
target: "asan"
24+
- name: "UBSan"
25+
target: "ubsan"
26+
- name: "LeakSan"
27+
target: "leaksan"
28+
29+
steps:
30+
- name: Workaround high-entropy ASLR
31+
run: sudo sysctl vm.mmap_rnd_bits=28
32+
33+
- name: Checkout wolfIP
34+
uses: actions/checkout@v4
35+
with:
36+
submodules: true
37+
38+
- name: Install dependencies
39+
run: |
40+
sudo apt-get update
41+
sudo apt-get install -y libwolfssl-dev check
42+
sudo modprobe tun
43+
44+
- name: Build wolfIP with ${{ matrix.name }}
45+
run: |
46+
mkdir -p build/port
47+
make ${{ matrix.target }}
48+
49+
- name: Build unit tests
50+
run: make unit
51+
52+
- name: Run unit tests
53+
run: ./build/test/unit
54+
55+
- name: Run standalone TTL expired test
56+
run: ./build/test-ttl-expired

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,14 @@ asan: $(EXE) $(LIB)
175175
asan:CFLAGS+=-fsanitize=address
176176
asan:LDFLAGS+=-static-libasan
177177

178+
ubsan: $(EXE) $(LIB)
179+
ubsan:CFLAGS+=-fsanitize=undefined -fno-sanitize-recover=all
180+
ubsan:LDFLAGS+=-fsanitize=undefined
181+
182+
leaksan: $(EXE) $(LIB)
183+
leaksan:CFLAGS+=-fsanitize=leak
184+
leaksan:LDFLAGS+=-fsanitize=leak
185+
178186

179187
# Test
180188

src/port/posix/bsd_socket.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1531,7 +1531,8 @@ void __attribute__((constructor)) init_wolfip_posix() {
15311531
if (!wolfip_mask_str || wolfip_mask_str[0] == '\0') {
15321532
wolfip_mask_str = "255.255.255.0";
15331533
}
1534-
fprintf(stderr, "wolfIP: Serving process PID=%hu, TID=%x\n", getpid(), (unsigned short)pthread_self());
1534+
fprintf(stderr, "wolfIP: Serving process PID=%d, TID=%x\n", getpid(),
1535+
(unsigned short)pthread_self());
15351536
inet_aton(host_stack_ip_str, &host_stack_ip);
15361537
swap_socketcall(socket, "socket");
15371538
swap_socketcall(bind, "bind");

0 commit comments

Comments
 (0)