#!/bin/bash set -e SCRIPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd) cc="gcc-13" max_time=300 if [ "$#" -ne 5 ]; then echo "$0: [n] [length] [r] [ltl-prop] [time-out-path]" > 2 exit 1 fi id="${1}_${2}_${3}_${4}" time_out="$5" filename="reversal_$id.pml" pan_name="pan_$id" trace="$SCRIPT_DIR/outputs/trace_$id.txt" if grep "${1},${2},${3},${4}," "$time_out" >/dev/null; then echo ">>> already done $1 n=$2 length=$3 r=$4" exit 0 fi echo ">>> test-property $1 n=$2 length=$3 r=$4" compile_dir="$(mktemp -d)" cp "$SCRIPT_DIR/reversal.pml.m4" "$compile_dir" cd "$compile_dir" m4 -DN="$2" -DLENGTH="$3" -DR="$4" -DLTL="$1" reversal.pml.m4 > "$filename" spin -a "$filename" "$cc" -Wno-format-overflow -o "$pan_name" pan.c echo "${1},${2},${3},${4}," >> "time.tmp" timeout "${max_time}s" /usr/bin/time -a -o "time.tmp" "./$pan_name" -a -N "$1" | tee "$trace" if [ $? -eq 124 ]; then rm "$trace" echo "TIMEOUT" >> "time.tmp" fi cat time.tmp >> "$time_out" if [ -f "$SCRIPT_DIR/$filename.trail" ]; then # rerun with printf spin -a "$filename" "$cc" -Wno-format-overflow -DPRINTF -o "$pan_name" pan.c rm ./pan.* "./$pan_name" -a -N "$1" | tee "$trace" echo "VERIFICATION FAILED, exiting..." >2 echo "compile dir: $compile_dir" >2 exit 1 fi cd "$SCRIPT_DIR" rm -rf "$compile_dir"