Skip to content

Commit 2cd7a26

Browse files
committed
CBMC/CI: Bump disk space to 64G
Signed-off-by: Hanno Becker <beckphan@amazon.co.uk>
1 parent 7539831 commit 2cd7a26

5 files changed

Lines changed: 89 additions & 5 deletions

File tree

.github/workflows/cbmc.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ jobs:
2424
uses: ./.github/workflows/ci_ec2_reusable.yml
2525
with:
2626
name: CBMC (ML-DSA-${{ matrix.parameter_set }}${{ matrix.reduce_ram && ', REDUCE_RAM' || '' }})
27-
ec2_instance_type: c7g.4xlarge
27+
ec2_instance_type: r7g.4xlarge
2828
ec2_ami: ubuntu-latest (aarch64)
29-
ec2_volume_size: 20
29+
ec2_volume_size: 64
3030
compile_mode: native
3131
opt: no_opt
3232
lint: false

nix/cbmc/default.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ buildEnv {
3737
});
3838

3939
inherit
40-
bitwuzla # 0.8.2
41-
cvc5 # 1.3.2
40+
bitwuzla# 0.8.2
41+
cvc5# 1.3.2
4242
ninja; # 1.13.2
4343
};
4444
}

proofs/cbmc/lib/cvc5_arrays_exp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
# Copyright (c) The mldsa-native project authors
3+
# SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
4+
5+
# Enable the experimental array theory in cvc5. CBMC encodes parts of
6+
# the CPROVER library using STORE_ALL, which cvc5 only accepts under
7+
# --arrays-exp.
8+
#
9+
# `exec` is load-bearing: without it bash sits between cbmc and cvc5,
10+
# holds the stdout FD open after cvc5 closes it, and cbmc's reader
11+
# stops mid-stream and treats every property verdict as ERROR even
12+
# though cvc5 returned `unsat`.
13+
exec cvc5 --arrays-exp "$@"

proofs/cbmc/run-cbmc-proofs.py

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,14 @@ def get_args():
199199
"solvers in the canonical list (Z3, BITWUZLA, CVC5)"
200200
),
201201
},
202+
{
203+
"flags": ["--default-solver-only"],
204+
"action": "store_true",
205+
"help": (
206+
"for each harness, run only the solver named by its "
207+
"CBMC_DEFAULT_SOLVER. Cannot be combined with --solver."
208+
),
209+
},
202210
]:
203211
flags = arg.pop("flags")
204212
pars.add_argument(*flags, **arg)
@@ -361,6 +369,25 @@ def read_solver_matrix(proof_dir):
361369
return out
362370

363371

372+
def read_default_solver(proof_dir):
373+
"""Return CBMC_DEFAULT_SOLVER for a per-harness Makefile."""
374+
cmd = ["make", "--no-print-directory", "echo-default-solver"]
375+
proc = subprocess.run(
376+
cmd,
377+
cwd=proof_dir,
378+
universal_newlines=True,
379+
stdout=subprocess.PIPE,
380+
stderr=subprocess.PIPE,
381+
check=False,
382+
)
383+
if proc.returncode:
384+
logging.critical(
385+
"Could not read default solver from %s: %s", proof_dir, proc.stderr
386+
)
387+
sys.exit(1)
388+
return proc.stdout.strip()
389+
390+
364391
def read_proof_uid(proof_dir):
365392
"""Read PROOF_UID from a per-harness Makefile."""
366393
with (pathlib.Path(proof_dir) / "Makefile").open() as handle:
@@ -542,6 +569,10 @@ async def main(): # pylint: disable=too-many-locals
542569
logging.critical("No proof directories found")
543570
sys.exit(1)
544571

572+
if args.default_solver_only and args.solver:
573+
logging.critical("--default-solver-only and --solver are mutually exclusive")
574+
sys.exit(1)
575+
545576
selected_solvers = args.solver if args.solver else list(ALL_SOLVERS)
546577
for s in selected_solvers:
547578
if s not in ALL_SOLVERS:
@@ -552,14 +583,21 @@ async def main(): # pylint: disable=too-many-locals
552583

553584
# Enforce PROOF_UID uniqueness up-front, then expand each proof
554585
# directory into the Cartesian product with its solver matrix.
586+
# When --default-solver-only is given, the per-harness solver list
587+
# collapses to {CBMC_DEFAULT_SOLVER}; otherwise every solver in
588+
# selected_solvers that the matrix declares enabled is used.
555589
proof_uids = {}
556590
pairs_to_run = [] # (proof_dir, solver)
557591
omitted_pairs = [] # (proof_uid, solver)
558592
for proof_dir in proof_dirs:
559593
check_uid_uniqueness(proof_dir, proof_uids)
560594
proof_uid = read_proof_uid(proof_dir)
561595
matrix = read_solver_matrix(proof_dir)
562-
for solver in selected_solvers:
596+
if args.default_solver_only:
597+
per_harness_solvers = [read_default_solver(proof_dir)]
598+
else:
599+
per_harness_solvers = selected_solvers
600+
for solver in per_harness_solvers:
563601
if matrix.get(solver):
564602
pairs_to_run.append((proof_dir, solver))
565603
else:

scripts/tests

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -918,6 +918,15 @@ class Tests:
918918
print(p)
919919
exit(0)
920920

921+
def solver_args():
922+
args = []
923+
if self.args.default_solver_only:
924+
args.append("--default-solver-only")
925+
if self.args.solver:
926+
for s in self.args.solver:
927+
args += ["--solver", s]
928+
return args
929+
921930
def run_cbmc_single_step(mldsa_parameter_set, proofs):
922931
envvars = {"MLD_CONFIG_PARAMETER_SET": mldsa_parameter_set}
923932
if self.args.reduce_ram:
@@ -940,6 +949,7 @@ class Tests:
940949
"-p",
941950
func,
942951
]
952+
+ solver_args()
943953
+ self.make_j(),
944954
cwd="proofs/cbmc",
945955
env=os.environ.copy() | envvars,
@@ -1004,6 +1014,7 @@ class Tests:
10041014
"-p",
10051015
]
10061016
+ proofs
1017+
+ solver_args()
10071018
+ self.make_j()
10081019
)
10091020
if self.args.output_result_json:
@@ -1478,6 +1489,28 @@ def cli():
14781489
default=False,
14791490
)
14801491

1492+
cbmc_parser.add_argument(
1493+
"--solver",
1494+
action="append",
1495+
help=(
1496+
"Restrict CBMC run to the given solver (repeatable). Forwarded "
1497+
"to run-cbmc-proofs.py --solver. Default: all solvers in the "
1498+
"canonical list (Z3, BITWUZLA, CVC5)."
1499+
),
1500+
default=None,
1501+
)
1502+
1503+
cbmc_parser.add_argument(
1504+
"--default-solver-only",
1505+
help=(
1506+
"For each harness, run only the solver named by its "
1507+
"CBMC_DEFAULT_SOLVER. Forwarded to run-cbmc-proofs.py. "
1508+
"Cannot be combined with --solver."
1509+
),
1510+
action="store_true",
1511+
default=False,
1512+
)
1513+
14811514
# hol_light arguments
14821515
hol_light_parser = cmd_subparsers.add_parser(
14831516
"hol_light",

0 commit comments

Comments
 (0)