Skip to content

Commit

Permalink
Make: Add examples into scope of clean
Browse files Browse the repository at this point in the history
Signed-off-by: Hanno Becker <[email protected]>
  • Loading branch information
hanno-becker committed Jan 7, 2025
1 parent c980d49 commit 8614622
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 15 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,7 @@ run_bench_components: \
clean:
-$(RM) -rf *.gcno *.gcda *.lcov *.o *.so
-$(RM) -rf $(BUILD_DIR)
make clean -C examples/bring_your_own_fips202
make clean -C examples/custom_backend
make clean -C examples/mlkem_native_as_code_package
make clean -C examples/monolithic_build
12 changes: 7 additions & 5 deletions scripts/lib/mlkem_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,16 @@ def _compile_schemes(self, test_type, opt):
args = ["make", test_type.make_target()] + extra_make_args

# Force static compilation for cross builds
cflags = self.args.cflags
if cflags is None:
cflags = ""

if test_type.is_example() and self.args.cross_prefix != "":
if self.args.cflags is None:
self.args.cflags = ""
self.args.cflags += " -static"
cflags += " -static"

env_update = {}
if self.args.cflags is not None and self.args.cflags != "":
env_update["CFLAGS"] = self.args.cflags
if cflags != "":
env_update["CFLAGS"] = cflags
if self.args.cross_prefix != "":
env_update["CROSS_PREFIX"] = self.args.cross_prefix

Expand Down
23 changes: 13 additions & 10 deletions scripts/lib/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ class TEST_TYPES(Enum):
KAT = 4
BENCH_COMPONENTS = 5
ACVP = 6
EXAMPLE_BRING_YOUR_OWN_FIPS202 = 7,
CUSTOM_BACKEND = 8,
MLKEM_NATIVE_AS_A_CODE_PACKAGE = 9,
MONOLITHIC_BUILD = 10,
EXAMPLE_BRING_YOUR_OWN_FIPS202 = (7,)
CUSTOM_BACKEND = (8,)
MLKEM_NATIVE_AS_A_CODE_PACKAGE = (9,)
MONOLITHIC_BUILD = (10,)

def is_benchmark(self):
return self in [TEST_TYPES.BENCH, TEST_TYPES.BENCH_COMPONENTS]
Expand All @@ -50,11 +50,12 @@ def is_example(self):

@staticmethod
def examples():
return [TEST_TYPES.EXAMPLE_BRING_YOUR_OWN_FIPS202,
TEST_TYPES.CUSTOM_BACKEND,
TEST_TYPES.MLKEM_NATIVE_AS_A_CODE_PACKAGE,
TEST_TYPES.MONOLITHIC_BUILD]

return [
TEST_TYPES.EXAMPLE_BRING_YOUR_OWN_FIPS202,
TEST_TYPES.CUSTOM_BACKEND,
TEST_TYPES.MLKEM_NATIVE_AS_A_CODE_PACKAGE,
TEST_TYPES.MONOLITHIC_BUILD,
]

def desc(self):
if self == TEST_TYPES.FUNC:
Expand Down Expand Up @@ -122,6 +123,7 @@ def make_run_target(self, scheme):
else:
return run_t


def dict2str(dict):
s = ""
for k, v in dict.items():
Expand Down Expand Up @@ -239,7 +241,8 @@ def logger(test_type, scheme, cross_prefix, opt):

return logging.getLogger(
"{0:<{1}} {2:<11} {3:<17}".format(
(test_type.desc()), sz,
(test_type.desc()),
sz,
str(scheme),
"({}{}):".format(compile_mode, opt_label),
)
Expand Down

0 comments on commit 8614622

Please sign in to comment.