Skip to content

Commit c6162d2

Browse files
committed
testing: HOL-Light: add support for cross-proofing
This commit introduces two new flags to the hol_light command of the tests script. The first allows user specification of which architecture to run/list the proofs for and the second allows for entering the nix cross-compilation devshell for that architecture. If either are not passed, the behavior is unchanged. Signed-off-by: Andreas Hatziiliou <andreas.hatziiliou@savoirfairelinux.com>
1 parent 22a3bb0 commit c6162d2

1 file changed

Lines changed: 30 additions & 6 deletions

File tree

scripts/tests

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,9 @@ class Tests:
10171017

10181018
def hol_light(self):
10191019

1020-
if platform.machine().lower() in ["arm64", "aarch64"]:
1020+
if self.args.arch:
1021+
arch = self.args.arch
1022+
elif platform.machine().lower() in ["arm64", "aarch64"]:
10211023
arch = "aarch64"
10221024
elif platform.machine().lower() in ["x86_64"]:
10231025
arch = "x86_64"
@@ -1050,12 +1052,19 @@ class Tests:
10501052
os.remove(os.path.join(proof_dir, proof_target))
10511053
except FileNotFoundError:
10521054
pass
1055+
1056+
make_cmd = [
1057+
"make",
1058+
f"mlkem/{func}.correct",
1059+
] + self.make_j()
1060+
1061+
# If --use-nix is specified, enter nix shell
1062+
if self.args.use_nix:
1063+
nix_profile = f"hol_light-cross-{arch}"
1064+
make_cmd = ["nix", "develop", f".#{nix_profile}", "-c"] + make_cmd
1065+
10531066
p = subprocess.run(
1054-
[
1055-
"make",
1056-
f"mlkem/{func}.correct",
1057-
]
1058-
+ self.make_j(),
1067+
make_cmd,
10591068
cwd="proofs/hol_light/" + arch,
10601069
env=os.environ.copy(),
10611070
capture_output=(self.args.verbose is False),
@@ -1481,6 +1490,21 @@ def cli():
14811490
default=False,
14821491
)
14831492

1493+
hol_light_parser.add_argument(
1494+
"-a",
1495+
"--arch",
1496+
help="Architecture for which to list/run HOL_LIGHT proofs (aarch64 or x86_64).",
1497+
choices=["aarch64", "x86_64"],
1498+
default=None,
1499+
)
1500+
1501+
hol_light_parser.add_argument(
1502+
"--use-nix",
1503+
help="Use nix cross environment for the specified architecture.",
1504+
action="store_true",
1505+
default=False,
1506+
)
1507+
14841508
# func arguments
14851509
func_parser = cmd_subparsers.add_parser(
14861510
"func",

0 commit comments

Comments
 (0)