Skip to content

Commit

Permalink
Tests: Remove extra_make_args parameter
Browse files Browse the repository at this point in the history
Previously, `extra_make_args` was used to pass the CYCLES=...
makefile variable. With this commit, the need for CYCLES=...
is inferred from the context, by looking at the test type
and the command line parameters.

Signed-off-by: Hanno Becker <[email protected]>
  • Loading branch information
hanno-becker committed Jan 1, 2025
1 parent db4da08 commit ee52fd5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 22 deletions.
32 changes: 10 additions & 22 deletions scripts/lib/mlkem_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,8 @@ def __init__(self, test_type: TEST_TYPES, args, opt):
self.opt = opt
self.opt_label = "opt" if self.opt else "no_opt"

def compile_schemes(
self,
extra_make_args=None,
):
def compile_schemes(self):
"""compile or cross compile with some extra environment variables and makefile arguments"""
if extra_make_args is None:
extra_make_args = []

if gh_env is not None:
print(
Expand All @@ -79,16 +74,13 @@ def compile_schemes(

log = logger(self.test_type, "Compile", self.args.cross_prefix, self.opt)

extra_make_args = extra_make_args + list(
set([f"OPT={int(self.opt)}", f"AUTO={int(self.args.auto)}"])
- set(extra_make_args)
)
extra_make_args = [f"OPT={int(self.opt)}", f"AUTO={int(self.args.auto)}"]
if self.test_type.is_benchmark() is True:
extra_make_args += [f"CYCLES={self.args.cycles}"]
else:
extra_make_args += Args.make_j(self.args)

args = (
["make", self.test_type.make_target()]
+ Args.make_j(self.args)
+ extra_make_args
)
args = ["make", self.test_type.make_target()] + extra_make_args

env_update = {}
if self.args.cflags is not None and self.args.cflags != "":
Expand Down Expand Up @@ -180,11 +172,8 @@ def __init__(self, test_type: TEST_TYPES, args):
def compile(
self,
opt,
extra_make_args=None,
):
self.ts["opt" if opt else "no_opt"].compile_schemes(
extra_make_args,
)
self.ts["opt" if opt else "no_opt"].compile_schemes()

def run_scheme(
self,
Expand Down Expand Up @@ -360,16 +349,15 @@ def bench(self):

# NOTE: We haven't yet decided how to output both opt/no-opt benchmark results
if Args.do_opt_all(self.args):
t.compile(False, extra_make_args=[f"CYCLES={cycles}"])
t.compile(False)
if self.args.run:
self._run_bench(t, False)
t.compile(True, extra_make_args=[f"CYCLES={cycles}"])
t.compile(True)
if self.args.run:
resultss = self._run_bench(t, True)
else:
t.compile(
Args.do_opt(self.args),
extra_make_args=[f"CYCLES={cycles}"],
)
if self.args.run:
resultss = self._run_bench(
Expand Down
3 changes: 3 additions & 0 deletions scripts/lib/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ class TEST_TYPES(Enum):
BENCH_COMPONENTS = 5
ACVP = 6

def is_benchmark(self):
return self in [TEST_TYPES.BENCH, TEST_TYPES.BENCH_COMPONENTS]

def desc(self):
if self == TEST_TYPES.MLKEM:
return "Functional Test"
Expand Down

0 comments on commit ee52fd5

Please sign in to comment.