Skip to content

Commit 58e5c5e

Browse files
committed
[TEST]: Run unit tests thorugh valgrind
Signed-off-by: Matthias J. Kannwischer <matthias@kannwischer.eu>
1 parent b5e19be commit 58e5c5e

File tree

3 files changed

+50
-2
lines changed

3 files changed

+50
-2
lines changed

.github/actions/functest/action.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ inputs:
5454
stack:
5555
description: Determine whether to run stack analysis or not
5656
default: "false"
57+
unit:
58+
description: Determine whether to run unit tests or not
59+
default: "true"
5760
extra_args:
5861
description: Additional arguments to pass to the tests script
5962
default: ""
@@ -70,6 +73,7 @@ runs:
7073
echo ACVP="${{ inputs.acvp == 'true' && 'acvp' || 'no-acvp' }}" >> $GITHUB_ENV
7174
echo EXAMPLES="${{ inputs.examples == 'true' && 'examples' || 'no-examples' }}" >> $GITHUB_ENV
7275
echo STACK="${{ inputs.stack == 'true' && 'stack' || 'no-stack' }}" >> $GITHUB_ENV
76+
echo UNIT="${{ inputs.unit == 'true' && 'unit' || 'no-unit' }}" >> $GITHUB_ENV
7377
- name: Setup nix
7478
uses: ./.github/actions/setup-shell
7579
with:
@@ -104,7 +108,7 @@ runs:
104108
shell: ${{ env.SHELL }}
105109
run: |
106110
make clean
107-
./scripts/tests all ${{ inputs.check_namespace == 'true' && '--check-namespace' || ''}} --exec-wrapper="${{ inputs.exec_wrapper }}" --cross-prefix="${{ inputs.cross_prefix }}" --cflags="${{ inputs.cflags }}" --ldflags="${{ inputs.ldflags }}" --opt=${{ inputs.opt }} --${{ env.FUNC }} --${{ env.KAT }} --${{ env.ACVP }} --${{ env.EXAMPLES }} --${{ env.STACK }} -v ${{ inputs.extra_args }}
111+
./scripts/tests all ${{ inputs.check_namespace == 'true' && '--check-namespace' || ''}} --exec-wrapper="${{ inputs.exec_wrapper }}" --cross-prefix="${{ inputs.cross_prefix }}" --cflags="${{ inputs.cflags }}" --ldflags="${{ inputs.ldflags }}" --opt=${{ inputs.opt }} --${{ env.FUNC }} --${{ env.KAT }} --${{ env.ACVP }} --${{ env.EXAMPLES }} --${{ env.STACK }} --${{ env.UNIT }} -v ${{ inputs.extra_args }}
108112
- name: Post ${{ env.MODE }} Tests
109113
shell: ${{ env.SHELL }}
110114
if: success() || failure()

.github/actions/multi-functest/action.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ inputs:
5151
stack:
5252
description: Determine whether to run stack analysis or not
5353
default: "false"
54+
unit:
55+
description: Determine whether to run unit tests or not
56+
default: "true"
5457
extra_args:
5558
description: Additional arguments to pass to the tests script
5659
default: ""
@@ -75,6 +78,7 @@ runs:
7578
examples: ${{ inputs.examples }}
7679
check_namespace: ${{ inputs.check_namespace }}
7780
stack: ${{ inputs.stack }}
81+
unit: ${{ inputs.unit }}
7882
extra_args: ${{ inputs.extra_args }}
7983
- name: Cross x86_64 Tests
8084
if: ${{ (inputs.compile_mode == 'all' || inputs.compile_mode == 'cross-x86_64') && (success() || failure()) }}
@@ -96,6 +100,7 @@ runs:
96100
examples: ${{ inputs.examples }}
97101
check_namespace: ${{ inputs.check_namespace }}
98102
stack: ${{ inputs.stack }}
103+
unit: ${{ inputs.unit }}
99104
extra_args: ${{ inputs.extra_args }}
100105
- name: Cross aarch64 Tests
101106
if: ${{ (inputs.compile_mode == 'all' || inputs.compile_mode == 'cross-aarch64') && (success() || failure()) }}
@@ -117,6 +122,7 @@ runs:
117122
examples: ${{ inputs.examples }}
118123
check_namespace: ${{ inputs.check_namespace }}
119124
stack: ${{ inputs.stack }}
125+
unit: ${{ inputs.unit }}
120126
extra_args: ${{ inputs.extra_args }}
121127
- name: Cross ppc64le Tests
122128
if: ${{ (inputs.compile_mode == 'all' || inputs.compile_mode == 'cross-ppc64le') && (success() || failure()) }}
@@ -138,6 +144,7 @@ runs:
138144
examples: ${{ inputs.examples }}
139145
check_namespace: ${{ inputs.check_namespace }}
140146
stack: ${{ inputs.stack }}
147+
unit: ${{ inputs.unit }}
141148
extra_args: ${{ inputs.extra_args }}
142149
- name: Cross aarch64_be Tests
143150
if: ${{ (inputs.compile_mode == 'all' || inputs.compile_mode == 'cross-aarch64_be') && (success() || failure()) }}
@@ -159,6 +166,7 @@ runs:
159166
examples: ${{ inputs.examples }}
160167
check_namespace: ${{ inputs.check_namespace }}
161168
stack: ${{ inputs.stack }}
169+
unit: ${{ inputs.unit }}
162170
extra_args: ${{ inputs.extra_args }}
163171
- name: Cross riscv64 Tests (RVV, VLEN=128)
164172
if: ${{ (inputs.compile_mode == 'all' || inputs.compile_mode == 'cross-riscv64') && (success() || failure()) }}
@@ -180,6 +188,7 @@ runs:
180188
examples: ${{ inputs.examples }}
181189
check_namespace: ${{ inputs.check_namespace }}
182190
stack: ${{ inputs.stack }}
191+
unit: ${{ inputs.unit }}
183192
extra_args: ${{ inputs.extra_args }}
184193
- name: Cross riscv64 Tests (RVV, VLEN=256)
185194
if: ${{ (inputs.compile_mode == 'all' || inputs.compile_mode == 'cross-riscv64') && (success() || failure()) }}
@@ -200,6 +209,7 @@ runs:
200209
examples: ${{ inputs.examples }}
201210
check_namespace: ${{ inputs.check_namespace }}
202211
stack: ${{ inputs.stack }}
212+
unit: ${{ inputs.unit }}
203213
extra_args: ${{ inputs.extra_args }}
204214
- name: Cross riscv64 Tests (RVV, VLEN=512)
205215
if: ${{ (inputs.compile_mode == 'all' || inputs.compile_mode == 'cross-riscv64') && (success() || failure()) }}
@@ -220,6 +230,7 @@ runs:
220230
examples: ${{ inputs.examples }}
221231
check_namespace: ${{ inputs.check_namespace }}
222232
stack: ${{ inputs.stack }}
233+
unit: ${{ inputs.unit }}
223234
extra_args: ${{ inputs.extra_args }}
224235
- name: Cross riscv64 Tests (RVV, VLEN=1024)
225236
if: ${{ (inputs.compile_mode == 'all' || inputs.compile_mode == 'cross-riscv64') && (success() || failure()) }}
@@ -240,6 +251,7 @@ runs:
240251
examples: ${{ inputs.examples }}
241252
check_namespace: ${{ inputs.check_namespace }}
242253
stack: ${{ inputs.stack }}
254+
unit: ${{ inputs.unit }}
243255
extra_args: ${{ inputs.extra_args }}
244256
- name: Cross riscv32 Tests
245257
if: ${{ (inputs.compile_mode == 'all' || inputs.compile_mode == 'cross-riscv32') && (success() || failure()) }}
@@ -261,5 +273,5 @@ runs:
261273
examples: ${{ inputs.examples }}
262274
check_namespace: ${{ inputs.check_namespace }}
263275
stack: ${{ inputs.stack }}
276+
unit: ${{ inputs.unit }}
264277
extra_args: ${{ inputs.extra_args }}
265-

.github/workflows/ci.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,38 @@ jobs:
438438
examples: false
439439
stack: true
440440
check_namespace: false
441+
valgrind_unit:
442+
name: Valgrind unit tests (${{ matrix.target.name }})
443+
strategy:
444+
fail-fast: false
445+
matrix:
446+
external:
447+
- ${{ github.repository_owner != 'pq-code-package' }}
448+
target:
449+
- runner: ubuntu-latest
450+
name: x86_64
451+
- runner: ubuntu-24.04-arm
452+
name: aarch64
453+
runs-on: ${{ matrix.target.runner }}
454+
steps:
455+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
456+
- name: Valgrind unit tests
457+
uses: ./.github/actions/multi-functest
458+
with:
459+
gh_token: ${{ secrets.GITHUB_TOKEN }}
460+
compile_mode: native
461+
nix-shell: ci_valgrind-varlat_gcc15
462+
nix-cache: false
463+
opt: all
464+
cflags: "-O3"
465+
func: false
466+
kat: false
467+
acvp: false
468+
examples: false
469+
stack: false
470+
unit: true
471+
check_namespace: false
472+
extra_args: "--exec-wrapper='valgrind --error-exitcode=1'"
441473
config_variations:
442474
name: Non-standard configurations
443475
strategy:

0 commit comments

Comments
 (0)