forked from arminbiere/aiger
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrunaigfuzz
More file actions
executable file
·84 lines (82 loc) · 1.6 KB
/
runaigfuzz
File metadata and controls
executable file
·84 lines (82 loc) · 1.6 KB
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
#!/bin/sh
opts=""
cmd=""
ign=no
aig=/tmp/runaigfuzz-$$.aig
sol=/tmp/runaigfuzz-$$.sol
die () {
echo "*** runaigfuzz: $*" 1>&2
exit 1
}
while [ $# -gt 0 ]
do
case "$1" in
-h)
cat<<EOF
usage: runaigfuzz [-h][-m][-s][-c][-i] <cmd> [<cmdopt> ...]
-h print this command line option summary
-i ignore valid output (0 10 20) and skip simulation
-[acmslSLbj12] see 'aigfuzz -h'
EOF
exit 0
;;
-i) ign=yes;;
-m|-s|-c|-a|-c|-m|-s|-l|-S|-L|-b|-j|-1|-2) opts="$opts $1";;
-*) die "invalid option '$1'";;
*) cmd=$*; break;;
esac
shift
done
[ x"$cmd" = x ] && die "missing command"
trap "rm -f $aig $sol; exit 1" 2 11 15
cnt=0
while true
do
printf "$cnt"
rm -f $aig
aigfuzz $opts > $aig
seed="`aiginfo $aig|awk '/^seed/{print $2}'`"
printf " $seed"
header="`head -1 $aig`"
printf " $header"
bug=bug-$seed.aig
red=red-$seed.aig
rm -f $sol
$cmd $aig > $sol 2>/dev/null
res=$?
printf " exit $res"
case $res in
0|10|20)
case $ign in
yes) sim=no;;
no) sim=yes;;
esac
;;
*)
cp $aig $bug
printf " $bug"
aigdd $bug $red $cmd
printf " $red"
echo " `head -1 $red`"
sim=no
;;
esac
if [ $sim = yes ]
then
aigsim -2 -w -c $aig $sol 1>/dev/null 2>/dev/null
tmp=$?
printf " aigsim $tmp"
if [ $tmp = 1 ]
then
cp $aig $bug
printf " $bug"
aigdd $bug $red runaigmcncheck $cmd
printf " $red"
echo " `head -1 $red`"
fi
fi
printf "\r"
printf " "
printf "\r"
cnt=`expr $cnt + 1`
done