-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathrun_and_verify.sh
50 lines (42 loc) · 1.11 KB
/
run_and_verify.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
#!/bin/bash
set -e
set -o pipefail
red=$(tput setaf 1)
green=$(tput setaf 2)
yellow=$(tput setaf 3)
blue=$(tput setaf 4)
reset=$(tput sgr0)
dfile="$1"
pfile="$2"
timeout="$3"
shift 3
logdir="logs/$(echo $dfile|sed 's,/,_,g')_$(basename $pfile .hddl)_$@_$(date +%s)/"
logdir=${logdir// /_}
mkdir -p "$logdir"
outfile="$logdir/OUT"
timefile="$logdir/TIME"
verifile="$logdir/VERIFY"
echo -ne "Running lilotane on ${blue}$pfile${reset} ... "
/usr/bin/time -o "$timefile" /usr/bin/timeout $timeout ./lilotane $dfile $pfile $@ > "$outfile"
retval="0"
if grep -q non-zero "$timefile"; then
retval=$(grep non-zero "$timefile"|grep -oE "[0-9]+")
fi
if [ "$retval" == "0" ]; then
echo -ne "exit code ${green}$retval${reset}. "
else
echo -ne "${yellow}exit code $retval.${reset} "
fi
if cat "$outfile"|grep -q "<=="; then
echo -ne "Verifying ... "
./pandaPIparser $dfile $pfile -verify "$outfile" > "$verifile"
if grep -q "false" "$verifile"; then
echo "${red}Verification error!${reset} Output:"
cat "$verifile"
exit 1
else
echo "${green}All ok.${reset}"
fi
else
echo ""
fi