Skip to content

Commit 65c79a0

Browse files
committed
test: Add --exclude-example flag and use to skip basic_determinitic with PCT
MLD_CONFIG_NO_RANDOMIZED_API and MLD_CONFIG_KEYGEN_PCT are incompatible and hence the config variation test that enables PCT currently errors in the basic_deterministic example (with the appopriate error message that the options are incompatible). This commit ports the --exclude-example option for the test script and uses it in CI for the PCT test. We also consolidate various small differences to the mlkem-native test script (whitespace changes, etc.). Signed-off-by: Matthias J. Kannwischer <matthias@kannwischer.eu>
1 parent 2a8d2ae commit 65c79a0

File tree

3 files changed

+42
-3
lines changed

3 files changed

+42
-3
lines changed

.github/actions/config-variations/action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ runs:
3030
acvp: true
3131
opt: ${{ inputs.opt }}
3232
examples: true
33+
extra_args: "--exclude-example basic_deterministic"
3334
- name: "PCT enabled + broken"
3435
if: ${{ inputs.tests == 'all' || contains(inputs.tests, 'pct-enabled-broken') }}
3536
shell: bash

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ inputs:
4848
stack:
4949
description: Determine whether to run stack analysis or not
5050
default: "false"
51+
extra_args:
52+
description: Additional arguments to pass to the tests script
53+
default: ""
5154
runs:
5255
using: composite
5356
steps:
@@ -68,6 +71,7 @@ runs:
6871
acvp: ${{ inputs.acvp }}
6972
examples: ${{ inputs.examples }}
7073
stack: ${{ inputs.stack }}
74+
extra_args: ${{ inputs.extra_args }}
7175
- name: Cross x86_64 Tests
7276
if: ${{ (inputs.compile_mode == 'all' || inputs.compile_mode == 'cross-x86_64') && (success() || failure()) }}
7377
uses: ./.github/actions/functest
@@ -87,6 +91,7 @@ runs:
8791
acvp: ${{ inputs.acvp }}
8892
examples: ${{ inputs.examples }}
8993
stack: ${{ inputs.stack }}
94+
extra_args: ${{ inputs.extra_args }}
9095
- name: Cross aarch64 Tests
9196
if: ${{ (inputs.compile_mode == 'all' || inputs.compile_mode == 'cross-aarch64') && (success() || failure()) }}
9297
uses: ./.github/actions/functest
@@ -106,6 +111,7 @@ runs:
106111
acvp: ${{ inputs.acvp }}
107112
examples: ${{ inputs.examples }}
108113
stack: ${{ inputs.stack }}
114+
extra_args: ${{ inputs.extra_args }}
109115
- name: Cross ppc64le Tests
110116
if: ${{ (inputs.compile_mode == 'all' || inputs.compile_mode == 'cross-ppc64le') && (success() || failure()) }}
111117
uses: ./.github/actions/functest
@@ -125,6 +131,7 @@ runs:
125131
acvp: ${{ inputs.acvp }}
126132
examples: ${{ inputs.examples }}
127133
stack: ${{ inputs.stack }}
134+
extra_args: ${{ inputs.extra_args }}
128135
- name: Cross aarch64_be Tests
129136
if: ${{ (inputs.compile_mode == 'all' || inputs.compile_mode == 'cross-aarch64_be') && (success() || failure()) }}
130137
uses: ./.github/actions/functest
@@ -144,6 +151,7 @@ runs:
144151
acvp: ${{ inputs.acvp }}
145152
examples: ${{ inputs.examples }}
146153
stack: ${{ inputs.stack }}
154+
extra_args: ${{ inputs.extra_args }}
147155
- name: Cross riscv64 Tests
148156
if: ${{ (inputs.compile_mode == 'all' || inputs.compile_mode == 'cross-riscv64') && (success() || failure()) }}
149157
uses: ./.github/actions/functest
@@ -163,3 +171,4 @@ runs:
163171
acvp: ${{ inputs.acvp }}
164172
examples: ${{ inputs.examples }}
165173
stack: ${{ inputs.stack }}
174+
extra_args: ${{ inputs.extra_args }}

scripts/tests

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ See the command line interface for more information."""
1111
import platform
1212
import argparse
1313
import os
14+
import re
1415
import sys
1516
import time
1617
import logging
1718
import subprocess
1819
import json
19-
import re
2020

2121
from enum import Enum
2222
from functools import reduce
@@ -582,6 +582,12 @@ class Tests:
582582
l = TEST_TYPES.examples()
583583
else:
584584
l = list(map(TEST_TYPES.from_string, self.args.l))
585+
586+
# Filter out excluded examples
587+
if hasattr(self.args, "exclude_example") and self.args.exclude_example:
588+
excluded = [TEST_TYPES.from_string(ex) for ex in self.args.exclude_example]
589+
l = [e for e in l if e not in excluded]
590+
585591
for e in l:
586592
self._compile_schemes(e, None)
587593
self._run_scheme(e, None, None)
@@ -648,6 +654,8 @@ class Tests:
648654
self.check_fail()
649655

650656
def stack(self):
657+
"""Stack usage analysis"""
658+
651659
def _stack(opt):
652660
self._compile_schemes(TEST_TYPES.STACK, opt)
653661
if self.args.run:
@@ -769,6 +777,7 @@ class Tests:
769777
)
770778
exit(1)
771779
continue
780+
772781
end = time.time()
773782
dur = int(end - start)
774783
if p.returncode != 0:
@@ -944,6 +953,25 @@ def cli():
944953
dest="examples",
945954
help="Do not run examples",
946955
)
956+
all_parser.add_argument(
957+
"--exclude-example",
958+
help="Exclude specific examples from running (can be used multiple times)",
959+
choices=[
960+
"bring_your_own_fips202",
961+
# "bring_your_own_fips202_static",
962+
# "custom_backend",
963+
"basic",
964+
"basic_deterministic",
965+
"monolithic_build",
966+
# "monolithic_build_native",
967+
"monolithic_build_multilevel",
968+
# "monolithic_build_multilevel_native",
969+
# "multilevel_build",
970+
# "multilevel_build_native",
971+
],
972+
action="append",
973+
default=[],
974+
)
947975

948976
stack_group = all_parser.add_mutually_exclusive_group()
949977
stack_group.add_argument(
@@ -964,7 +992,6 @@ def cli():
964992
acvp_parser = cmd_subparsers.add_parser(
965993
"acvp", help="Run ACVP client", parents=[common_parser]
966994
)
967-
968995
acvp_parser.add_argument(
969996
"--version",
970997
default="v1.1.0.40",
@@ -980,9 +1007,9 @@ def cli():
9801007
"-l",
9811008
help="Explicitly list the examples to run; can be called multiple times",
9821009
choices=[
1010+
"bring_your_own_fips202",
9831011
"basic",
9841012
"basic_deterministic",
985-
"bring_your_own_fips202",
9861013
"monolithic_build",
9871014
"monolithic_build_multilevel",
9881015
],
@@ -1124,6 +1151,8 @@ def cli():
11241151
if not hasattr(args, "l"):
11251152
args.l = None
11261153

1154+
os.chdir(os.path.join(os.path.dirname(__file__), ".."))
1155+
11271156
if args.cmd == "all":
11281157
Tests(args).all()
11291158
elif args.cmd == "examples":

0 commit comments

Comments
 (0)