File tree Expand file tree Collapse file tree 2 files changed +18
-6
lines changed
Expand file tree Collapse file tree 2 files changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -72,6 +72,11 @@ The TLA+ spec defines the desired behaviors of the model. To validate the correc
7272./validate-model.sh -s ./MCetcdraft.tla -c ./MCetcdraft.cfg
7373```
7474
75+ You can also add ` -m ` option to run model checking in simulation mode, which will randomly walk in the state machine and is helpful for finding issues quickly.
76+
77+ ``` console
78+ ./validate-model.sh -m -s ./MCetcdraft.tla -c ./MCetcdraft.cfg
79+ ```
7580
7681## Validate Collected Traces
7782With above example trace logger, validate.sh can be used to validate traces parallelly.
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
3- WORKDIR=" $( mktemp -d) "
3+ WORKDIR=" ${WORKDIR :- $ (mktemp -d)} "
44TOOLDIR=" ${WORKDIR} /tool"
55STATEDIR=" ${WORKDIR} /state"
6- FAILFAST=false
76PARALLEL=$( nproc)
7+ SIMULATE=false
88
99function show_usage {
10- echo " usage: validate-model.sh -s <spec> -c <config>" >&2
10+ echo " usage: validate-model.sh [-m] -s <spec> -c <config>" >&2
1111}
1212
1313function install_tlaplus {
@@ -22,16 +22,23 @@ function validate {
2222 local config=${2}
2323 local tooldir=${3}
2424 local statedir=${4}
25+ local sim=${5:- false}
2526
2627 set -o pipefail
27- java -XX:+UseParallelGC -cp ${tooldir} /tla2tools.jar:${tooldir} /CommunityModules-deps.jar tlc2.TLC -config " ${config} " " ${spec} " -lncheck final -metadir " ${statedir} " -fpmem 0.9
28+ if [ " $sim " = true ]; then
29+ java -XX:+UseParallelGC -cp ${tooldir} /tla2tools.jar:${tooldir} /CommunityModules-deps.jar tlc2.TLC -config " ${config} " " ${spec} " -lncheck final -metadir " ${statedir} " -fpmem 0.9 -workers auto -simulate
30+ else
31+ java -XX:+UseParallelGC -cp ${tooldir} /tla2tools.jar:${tooldir} /CommunityModules-deps.jar tlc2.TLC -config " ${config} " " ${spec} " -lncheck final -metadir " ${statedir} " -fpmem 0.9 -workers auto
32+ fi
33+
2834}
2935
30- while getopts :hs:c:p : flag
36+ while getopts :hms:c : flag
3137do
3238 case " ${flag} " in
3339 s) SPEC=${OPTARG} ;;
3440 c) CONFIG=${OPTARG} ;;
41+ m) SIMULATE=true;;
3542 h|* ) show_usage; exit 1;;
3643 esac
3744done
@@ -47,5 +54,5 @@ echo "config: ${CONFIG}"
4754
4855install_tlaplus
4956
50- validate $SPEC $CONFIG $TOOLDIR $STATEDIR
57+ validate $SPEC $CONFIG $TOOLDIR $STATEDIR $SIMULATE
5158
You can’t perform that action at this time.
0 commit comments