Skip to content

Commit 770e6ab

Browse files
committed
Add pre-processing script
1 parent f9a3a57 commit 770e6ab

28 files changed

Lines changed: 1179 additions & 449 deletions
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: Build and Test Refactor
2+
3+
on:
4+
push:
5+
branches: [ 'master', 'main', 'release/**' ]
6+
pull_request:
7+
branches: [ '*' ]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
# List host CPU info
21+
- name: Host CPU info
22+
run: cat /proc/cpuinfo
23+
24+
# List compiler version
25+
- name: List compiler version
26+
run: gcc --version
27+
28+
# pull and build wolfssl
29+
- name: Checkout wolfssl
30+
uses: actions/checkout@v4
31+
with:
32+
repository: wolfssl/wolfssl
33+
path: wolfssl
34+
35+
# Build and test standard build
36+
- name: Build and test refactor
37+
run: cd test-refactor/posix && make clean && make -j WOLFSSL_DIR=../../wolfssl && make run
38+
39+
# Build and test standard build, with DMA and ASAN enabled
40+
- name: Build and test refactor DMA ASAN
41+
run: cd test-refactor/posix && make clean && make -j DMA=1 ASAN=1 WOLFSSL_DIR=../../wolfssl && make run
42+
43+
# Build and test ASAN build, with wolfCrypt tests enabled.
44+
- name: Build and test refactor ASAN TESTWOLFCRYPT
45+
run: cd test-refactor/posix && make clean && make -j ASAN=1 TESTWOLFCRYPT=1 WOLFSSL_DIR=../../wolfssl && make run
46+
47+
# Build and test ASAN build, with wolfCrypt tests enabled and using the DMA devId.
48+
- name: Build and test refactor ASAN TESTWOLFCRYPT TESTWOLFCRYPT_DMA
49+
run: cd test-refactor/posix && make clean && make -j ASAN=1 TESTWOLFCRYPT=1 TESTWOLFCRYPT_DMA=1 DMA=1 WOLFSSL_DIR=../../wolfssl && make run
50+
51+
# Build and test debug build with ASAN and NOCRYPTO
52+
- name: Build and test refactor ASAN DEBUG NOCRYPTO
53+
run: cd test-refactor/posix && make clean && make -j DEBUG=1 ASAN=1 NOCRYPTO=1 WOLFSSL_DIR=../../wolfssl && make run
54+
55+
# Build and test debug build with ASAN and DMA
56+
- name: Build and test refactor ASAN DEBUG DMA
57+
run: cd test-refactor/posix && make clean && make -j DEBUG=1 ASAN=1 DMA=1 WOLFSSL_DIR=../../wolfssl && make run
58+
59+
# Build and test with SHE and ASAN
60+
- name: Build and test refactor ASAN SHE
61+
run: cd test-refactor/posix && make clean && make -j SHE=1 ASAN=1 WOLFSSL_DIR=../../wolfssl && make run
62+
63+
# Build and test with DEBUG=1
64+
- name: Build and test refactor with DEBUG
65+
run: cd test-refactor/posix && make clean && make -j DEBUG=1 WOLFSSL_DIR=../../wolfssl && make run
66+
67+
# Build and test with DEBUG_VERBOSE=1 (includes DEBUG)
68+
- name: Build and test refactor with DEBUG_VERBOSE
69+
run: cd test-refactor/posix && make clean && make -j DEBUG_VERBOSE=1 WOLFSSL_DIR=../../wolfssl && make run
70+
71+
# Build and test in multithreaded mode with everything enabled
72+
- name: Build and test refactor with THREADSAFE and everything
73+
run: cd test-refactor/posix && make clean && make -j THREADSAFE=1 DMA=1 SHE=1 ASAN=1 WOLFSSL_DIR=../../wolfssl && make run
74+
75+
# Build and test in multithreaded mode with everything enabled and wolfCrypt tests
76+
- name: Build and test refactor with THREADSAFE and TESTWOLFCRYPT and everything
77+
run: cd test-refactor/posix && make clean && make -j THREADSAFE=1 TESTWOLFCRYPT=1 DMA=1 SHE=1 ASAN=1 WOLFSSL_DIR=../../wolfssl && make run
78+
79+
# Build and test in multithreaded mode with everything enabled and wolfCrypt tests with dma
80+
- name: Build and test refactor with THREADSAFE and TESTWOLFCRYPT with DMA
81+
run: cd test-refactor/posix && make clean && make -j THREADSAFE=1 TESTWOLFCRYPT=1 TESTWOLFCRYPT_DMA=1 DMA=1 SHE=1 ASAN=1 WOLFSSL_DIR=../../wolfssl && make run
82+
83+
# Build and test with AUTH=1
84+
- name: Build and test refactor with AUTH
85+
run: cd test-refactor/posix && make clean && make -j AUTH=1 WOLFSSL_DIR=../../wolfssl && make run
86+
87+
# Build and test with AUTH=1 and ASAN
88+
- name: Build and test refactor with AUTH ASAN
89+
run: cd test-refactor/posix && make clean && make -j AUTH=1 ASAN=1 WOLFSSL_DIR=../../wolfssl && make run
90+
91+
# Build and test with AUTH=1 and THREADSAFE
92+
- name: Build and test refactor with AUTH THREADSAFE ASAN
93+
run: cd test-refactor/posix && make clean && make -j AUTH=1 THREADSAFE=1 ASAN=1 WOLFSSL_DIR=../../wolfssl && make run
94+
95+
# Build and test with AUTH=1 and NOCRYPTO=1 (auth on, crypto off)
96+
- name: Build and test refactor with AUTH NOCRYPTO
97+
run: cd test-refactor/posix && make clean && make -j AUTH=1 NOCRYPTO=1 WOLFSSL_DIR=../../wolfssl && make run

.github/workflows/build-and-test.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ jobs:
3232
repository: wolfssl/wolfssl
3333
path: wolfssl
3434

35-
- name: Build and test refactor
36-
run: cd test-refactor/posix && make clean && make -j WOLFSSL_DIR=../../wolfssl && make run
37-
3835
# Build and test standard build
3936
- name: Build and test
4037
run: cd test && make clean && make -j WOLFSSL_DIR=../wolfssl && make run
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Code Coverage Refactor
2+
3+
on:
4+
push:
5+
branches: [ 'master', 'main', 'release/**' ]
6+
pull_request:
7+
branches: [ '*' ]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
coverage:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
include:
19+
- name: base
20+
flags: ""
21+
- name: dma
22+
flags: "DMA=1"
23+
- name: threadsafe
24+
flags: "THREADSAFE=1"
25+
- name: she
26+
flags: "SHE=1"
27+
- name: auth
28+
flags: "AUTH=1"
29+
- name: nocrypto
30+
flags: "NOCRYPTO=1"
31+
steps:
32+
- uses: actions/checkout@v4
33+
34+
- name: Install gcovr
35+
run: |
36+
sudo apt-get update
37+
sudo apt-get install -y gcovr
38+
39+
- name: Checkout wolfssl
40+
uses: actions/checkout@v4
41+
with:
42+
repository: wolfssl/wolfssl
43+
path: wolfssl
44+
45+
- name: Build, run, and emit tracefile (${{ matrix.name }})
46+
run: |
47+
cd test-refactor/posix && make coverage-json \
48+
OUT=$GITHUB_WORKSPACE/cov-json/refactor-${{ matrix.name }}.json \
49+
WOLFSSL_DIR=../../wolfssl ${{ matrix.flags }}
50+
51+
- name: Upload tracefile
52+
uses: actions/upload-artifact@v4
53+
with:
54+
name: refactor-tracefile-${{ matrix.name }}
55+
path: cov-json/refactor-${{ matrix.name }}.json
56+
retention-days: 7
57+
58+
merge:
59+
needs: coverage
60+
runs-on: ubuntu-latest
61+
steps:
62+
- uses: actions/checkout@v4
63+
64+
- name: Install gcovr
65+
run: |
66+
sudo apt-get update
67+
sudo apt-get install -y gcovr
68+
69+
- name: Download refactor tracefiles
70+
uses: actions/download-artifact@v4
71+
with:
72+
pattern: refactor-tracefile-*
73+
path: cov-json
74+
merge-multiple: true
75+
76+
- name: Merge tracefiles into HTML report
77+
run: |
78+
mkdir -p coverage-refactor-merged
79+
gcovr \
80+
$(for f in cov-json/refactor-*.json; do echo --add-tracefile $f; done) \
81+
--html-details coverage-refactor-merged/index.html \
82+
--print-summary
83+
84+
- name: Upload merged coverage report
85+
uses: actions/upload-artifact@v4
86+
with:
87+
name: coverage-refactor-report
88+
path: coverage-refactor-merged/
89+
retention-days: 30

.github/workflows/code-coverage.yml

Lines changed: 72 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -12,46 +12,78 @@ permissions:
1212
jobs:
1313
coverage:
1414
runs-on: ubuntu-latest
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
include:
19+
- name: base
20+
flags: ""
21+
- name: dma
22+
flags: "DMA=1"
23+
- name: threadsafe
24+
flags: "THREADSAFE=1"
25+
- name: she
26+
flags: "SHE=1"
27+
- name: auth
28+
flags: "AUTH=1"
29+
- name: nocrypto
30+
flags: "NOCRYPTO=1"
31+
steps:
32+
- uses: actions/checkout@v4
33+
34+
- name: Install gcovr
35+
run: |
36+
sudo apt-get update
37+
sudo apt-get install -y gcovr
38+
39+
- name: Checkout wolfssl
40+
uses: actions/checkout@v4
41+
with:
42+
repository: wolfssl/wolfssl
43+
path: wolfssl
44+
45+
- name: Build, run, and emit tracefile (${{ matrix.name }})
46+
run: |
47+
cd test && make coverage-json \
48+
OUT=$GITHUB_WORKSPACE/cov-json/legacy-${{ matrix.name }}.json \
49+
WOLFSSL_DIR=../wolfssl ${{ matrix.flags }}
50+
51+
- name: Upload tracefile
52+
uses: actions/upload-artifact@v4
53+
with:
54+
name: legacy-tracefile-${{ matrix.name }}
55+
path: cov-json/legacy-${{ matrix.name }}.json
56+
retention-days: 7
1557

58+
merge:
59+
needs: coverage
60+
runs-on: ubuntu-latest
1661
steps:
17-
- uses: actions/checkout@v4
18-
19-
# List compiler version
20-
- name: List compiler and gcov version
21-
run: |
22-
gcc --version
23-
gcov --version
24-
25-
# Install gcovr for coverage report generation
26-
- name: Install gcovr
27-
run: |
28-
sudo apt-get update
29-
sudo apt-get install -y gcovr
30-
31-
# Checkout wolfssl
32-
- name: Checkout wolfssl
33-
uses: actions/checkout@v4
34-
with:
35-
repository: wolfssl/wolfssl
36-
path: wolfssl
37-
38-
# Run coverage
39-
- name: Build and run tests with coverage
40-
run: cd test && make coverage WOLFSSL_DIR=../wolfssl
41-
42-
# Display coverage summary in the action log
43-
# Using gcov-ignore-parse-errors to avoid (GCC bug #68080)
44-
- name: Display coverage summary
45-
run: |
46-
echo "=== Coverage Summary ==="
47-
cd test
48-
gcovr Build --root .. --gcov-ignore-parse-errors=negative_hits.warn_once_per_file --filter '\.\./src/.*' --filter '\.\./wolfhsm/.*' --print-summary
49-
50-
# Upload coverage report as artifact
51-
- name: Upload coverage report
52-
uses: actions/upload-artifact@v4
53-
with:
54-
name: coverage-report
55-
path: coverage/
56-
retention-days: 30
62+
- uses: actions/checkout@v4
63+
64+
- name: Install gcovr
65+
run: |
66+
sudo apt-get update
67+
sudo apt-get install -y gcovr
68+
69+
- name: Download legacy tracefiles
70+
uses: actions/download-artifact@v4
71+
with:
72+
pattern: legacy-tracefile-*
73+
path: cov-json
74+
merge-multiple: true
75+
76+
- name: Merge tracefiles into HTML report
77+
run: |
78+
mkdir -p coverage-merged
79+
gcovr \
80+
$(for f in cov-json/legacy-*.json; do echo --add-tracefile $f; done) \
81+
--html-details coverage-merged/index.html \
82+
--print-summary
5783
84+
- name: Upload merged coverage report
85+
uses: actions/upload-artifact@v4
86+
with:
87+
name: coverage-report
88+
path: coverage-merged/
89+
retention-days: 30

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,6 @@ tools/static-analysis/reports/
2020
*.gcda
2121
*.gcno
2222
coverage/
23+
24+
# Test driver log (automake-style; produced by `make run` in test-refactor)
25+
test-suite.log

test-refactor/Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
## Top-level forwarder for the test-refactor suite.
2+
## Delegates to the POSIX port Makefile so tests can be run with
3+
## `cd test-refactor && make check` instead of navigating into posix/.
4+
5+
.DEFAULT_GOAL := check
6+
7+
.PHONY: check run build_app clean
8+
9+
check run build_app clean:
10+
$(MAKE) -C posix $@

0 commit comments

Comments
 (0)