Skip to content

Commit 0b2a491

Browse files
committed
CI: use bash instead of python for proof checking
Signed-off-by: Andrew Helwer <ahelwer@pm.me>
1 parent c2641e6 commit 0b2a491

4 files changed

Lines changed: 47 additions & 22 deletions

File tree

.github/scripts/check_proofs.py

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,21 @@
2626

2727
logging.basicConfig(level = logging.DEBUG if args.verbose else logging.INFO)
2828

29-
proof_module_paths = sorted(
30-
[
31-
(manifest_dir, spec, module, tla_utils.parse_timespan(module['proof']['runtime']))
32-
for manifest_dir, spec in manifest
33-
for module in spec['modules']
34-
if 'proof' in module
35-
and module['path'] not in skip_modules
36-
and (only_modules == [] or module['path'] in only_modules)
37-
],
38-
key = lambda m : m[3]
39-
)
29+
proof_module_paths = [
30+
(manifest_dir, spec, module)
31+
for manifest_dir, spec in manifest
32+
for module in spec['modules']
33+
if 'proof' in module
34+
and module['path'] not in skip_modules
35+
and (only_modules == [] or module['path'] in only_modules)
36+
]
4037

4138
for path in skip_modules:
4239
logging.info(f'Skipping {path}')
4340

4441
success = True
4542
tlapm_path = join(tlapm_path, 'bin', 'tlapm')
46-
for manifest_dir, spec, module, expected_runtime in proof_module_paths:
43+
for manifest_dir, spec, module in proof_module_paths:
4744
module_path = module['path']
4845
logging.info(module_path)
4946
start_time = timer()
@@ -63,16 +60,12 @@
6360
end_time = timer()
6461
actual_runtime = timedelta(seconds = end_time - start_time)
6562
output = ' '.join(tlapm_result.args) + '\n' + tlapm_result.stdout
66-
logging.info(f'Checked proofs in {tla_utils.format_timespan(actual_runtime)} vs. {tla_utils.format_timespan(expected_runtime)} expected')
63+
logging.info(f'Checked proofs in {tla_utils.format_timespan(actual_runtime)}')
6764
if tlapm_result.returncode != 0:
6865
logging.error(f'Proof checking failed for {module_path}:')
6966
logging.error(output)
7067
success = False
7168
else:
72-
if 'proof' not in module or module['proof']['runtime'] == 'unknown':
73-
module['proof'] = { 'runtime' : tla_utils.format_timespan(actual_runtime) }
74-
manifest_path = join(manifest_dir, 'manifest.json')
75-
tla_utils.write_json(spec, manifest_path)
7669
logging.debug(output)
7770
except subprocess.TimeoutExpired as tlapm_result:
7871
# stdout is a string on Windows, byte array everywhere else

.github/scripts/linux-setup.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ main() {
4848
mkdir -p "$DEPS_DIR/community"
4949
wget -nv https://github.com/tlaplus/CommunityModules/releases/latest/download/CommunityModules-deps.jar \
5050
-O "$DEPS_DIR/community/modules.jar"
51+
unzip "$DEPS_DIR/community/modules.jar" -d "$DEPS_DIR/community/"
5152
# Get TLAPS modules
5253
wget -nv https://github.com/tlaplus/tlapm/archive/main.tar.gz -O /tmp/tlapm.tar.gz
5354
tar -xzf /tmp/tlapm.tar.gz --directory "$DEPS_DIR"

.github/workflows/CI.yml

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,40 @@ jobs:
135135
- name: Check proofs
136136
if: matrix.os != 'windows-latest' && !matrix.unicode
137137
run: |
138-
python $SCRIPT_DIR/check_proofs.py \
139-
--tlapm_path $DEPS_DIR/tlapm \
140-
--examples_root .
138+
# Exempting specs for various reasons:
139+
# - Use of RECURSIVE, which TLAPM cannot currently handle (many)
140+
# - Pre-module text bug (MCDistributedReplicatedLog.tla)
141+
# - Unresolved ToString operator (ewd840)
142+
# - Use of nonstandard TLCExt module (SimKnuthYao.tla)
143+
# - Use of nonstandard Randomization module (SpanTreeTest.tla)
144+
# - Nonstandard multi-module (BufferedRandomAccessFile.tla)
145+
# - Nested module identifier bug (diskpaxos, Composing, RealTime)
146+
# - TLAPM level-checking failure (YoYoPruning.tla)
147+
# - Use of Apalache module (Einstein.tla)
148+
# - Very long-running proof (BPConProof.tla)
149+
find specifications -type f -iname "*.tla" \
150+
\( \
151+
-not -name "Chameneos.tla" \
152+
-and -not -name "ReachabilityTest.tla" \
153+
-and -not -name "MCReachabilityTest.tla" \
154+
-and -not -name "MCDistributedReplicatedLog.tla" \
155+
-and -not -name "SimKnuthYao.tla" \
156+
-and -not -name "SpanTreeTest.tla" \
157+
-and -not -name "TransitiveClosure.tla" \
158+
-and -not -name "BufferedRandomAccessFile.tla" \
159+
-and -not -name "YoYoPruning.tla" \
160+
-and -not -name "MCYoYoPruning.tla" \
161+
-and -not -name "Einstein.tla" \
162+
-and -not -name "BPConProof.tla" \
163+
-and -not -wholename "*/Composing/*" \
164+
-and -not -wholename "*/RealTime/*" \
165+
-and -not -wholename "*/LeastCircularSubstring/*" \
166+
-and -not -wholename "*/diskpaxos/*" \
167+
-and -not -wholename "*/ewd998/*" \
168+
-and -not -wholename "*/ewd840/*" \
169+
\) \
170+
-print0 | xargs -0 -n1 -r -t \
171+
time $DEPS_DIR/tlapm/bin/tlapm --cleanfp --stretch 5 -I $DEPS_DIR/community
141172
- name: Smoke-test manifest generation script
142173
run: |
143174
python $SCRIPT_DIR/generate_manifest.py \

specifications/CoffeeCan/manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"models": [
1616
{
1717
"path": "specifications/CoffeeCan/CoffeeCan1000Beans.cfg",
18-
"runtime": "00:00:15",
18+
"runtime": "00:00:45",
1919
"mode": "exhaustive search",
2020
"result": "success",
2121
"distinctStates": 501500,
@@ -40,4 +40,4 @@
4040
]
4141
}
4242
]
43-
}
43+
}

0 commit comments

Comments
 (0)