-
Notifications
You must be signed in to change notification settings - Fork 0
/
check_all.sh
executable file
·95 lines (73 loc) · 2.48 KB
/
check_all.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/usr/bin/env bash
# This script is the entry point for the automatic discovery of
# gaps between various versions of the processor.
# It takes all the models pairs from RES_DIR and follwing the naming convention in learn_all produces
# witness graphs comparing them in CEX_DIR.
# LIMIT variable is used to limit the number of
# counterexamples to be considered for each pair of model
#
# If fast is given it uses the fast models.
# Usage:
# ./compare_all.sh [fast]
# Useful paths
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
LOGS_DIR=$SCRIPT_DIR/logs/$1
RES_DIR=$SCRIPT_DIR/results/$1
CEX_DIR=$SCRIPT_DIR/counterexamples/$1
TMP_DIR=$SCRIPT_DIR/tmp
MM_DIR=$SCRIPT_DIR/alvie/code
# LIMIT = 10
# LIMIT=100
# NO LIMIT!
LIMIT=-1
cd $SCRIPT_DIR
mkdir -p $LOGS_DIR
# Loads the list of all available models
readarray ZERO_MODELS <<< "$(ls $RES_DIR/*-0-*-int.dot)"
# Move to the project's directory
cd $MM_DIR
# Compile the project
dune build
run() {
local status=0
(eval $2 & wait $!;
status=$?;
if [[ $status -ne 0 ]]; then
echo -e "$1 ... [KO - $3]"
else
echo "$1 ... [OK]"
fi) &
}
echo -e "\nComparison started: refer to files in $LOGS_DIR for details"
if ((LIMIT >= 0)); then
echo "Max number of counterexamples for each pair is $LIMIT"
else
echo "No limit on the max number of counterexamples for each pair"
fi
for m1 in "${ZERO_MODELS[@]}"
do
m1_name="$(basename $m1 .dot)"
commit=${m1_name:0:7}
att=${m1_name:8:2}
att=${att//-/}
readarray ONE_MODELS <<< "$(ls $RES_DIR/$commit-${att}-*-1-*-int.dot)"
for m2 in "${ONE_MODELS[@]}"
do
m1_nint=${m1//int/nint}
m2_nint=${m2//int/nint}
m2_name="$(basename $m2 .dot)"
# No need of comparing a model with itself
if [ "$m1_name" = "$m2_name" ]; then
continue
fi
cexlimit=""
cexfile="$CEX_DIR/$att/$commit-$att"
logfile="$LOGS_DIR/compare-$commit-$att.log"
name="$commit-$att"
# Call the comparison process
# run "$name" "_build/default/bin/compare.exe --tmpdir \"$TMP_DIR\" --m1 \"${m1%%[[:space:]]}\" --m2 \"${m2%%[[:space:]]}\" --cex-file \"$cexfile\" $cexlimit > \"$logfile\" 2>&1" "$logfile"
run "$name" "_build/default/bin/fa.exe --tmpdir \"$TMP_DIR\" --m1-int \"${m1%%[[:space:]]}\" --m2-int \"${m2%%[[:space:]]}\" --m1-nint \"${m1_nint%%[[:space:]]}\" --m2-nint \"${m2_nint%%[[:space:]]}\" --witness-file-basename \"$cexfile\" --debug $cexlimit > \"$logfile\" 2>&1" "$logfile"
done
done
wait
echo ""