Skip to content

Commit

Permalink
tests: fix mac-taskpolicy handling in benchmarks on Darwin
Browse files Browse the repository at this point in the history
Fixed a bug introduced in PR #449, where the exec_wrapper variable was no longer in scope.
This caused the script to abort if --mac-taskpolicy was provided, as it attempted
to check the value of exec_wrapper.

Signed-off-by: Thing-han, Lim <[email protected]>
  • Loading branch information
potsrevennil committed Dec 4, 2024
1 parent f875b7f commit 4c04613
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions scripts/lib/mlkem_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,11 +602,7 @@ def bench(
output = False

if mac_taskpolicy:
if exec_wrapper:
logging.error(f"cannot set both --mac-taskpolicy and --exec-wrapper")
sys.exit(1)
else:
exec_wrapper = f"taskpolicy -c {mac_taskpolicy}"
self.cmd_prefix.extend(["taskpolicy", "-c", f"{mac_taskpolicy}"])

# NOTE: We haven't yet decided how to output both opt/no-opt benchmark results
if self.opt.lower() == "all":
Expand Down Expand Up @@ -713,19 +709,27 @@ def all(opt: bool):

def cbmc(self, k):
config_logger(self.verbose)

def run_cbmc(mlkem_k):
envvars = {"MLKEM_K": mlkem_k}
cpucount = os.cpu_count()
p = subprocess.Popen(
["python3", "run-cbmc-proofs.py", "--summarize", "--no-coverage", f"-j{cpucount}"],
[
"python3",
"run-cbmc-proofs.py",
"--summarize",
"--no-coverage",
f"-j{cpucount}",
],
cwd="cbmc/proofs",
env=os.environ.copy() | envvars,
)
p.communicate()
assert p.returncode == 0

if k == "ALL":
run_cbmc("2")
run_cbmc("3")
run_cbmc("4")
else:
else:
run_cbmc(k)

0 comments on commit 4c04613

Please sign in to comment.