tests: fsm to use a randomly-generated seed
[yosys.git] / tests / fsm / run-test.sh
1 #!/bin/bash
2
3 # run this test many times:
4 # time bash -c 'for ((i=0; i<100; i++)); do echo "-- $i --"; bash run-test.sh || exit 1; done'
5
6 set -e
7
8 OPTIND=1
9 count=50
10 seed="" # default to no seed specified
11 while getopts "c:S:" opt
12 do
13 case "$opt" in
14 c) count="$OPTARG" ;;
15 S) seed="-S $OPTARG" ;;
16 esac
17 done
18 shift "$((OPTIND-1))"
19
20 rm -rf temp
21 mkdir -p temp
22 echo "generating tests.."
23 python3 generate.py -c $count $seed
24
25 {
26 all_targets="all_targets:"
27 echo "all: all_targets"
28 echo " @echo"
29 for i in $( ls temp/*.ys | sed 's,[^0-9],,g; s,^0*\(.\),\1,g;' ); do
30 idx=$( printf "%05d" $i )
31 echo "temp/uut_${idx}.log: temp/uut_${idx}.ys temp/uut_${idx}.v"
32 echo " @echo -n '[$i]'"
33 echo " @../../yosys -ql temp/uut_${idx}.out temp/uut_${idx}.ys"
34 echo " @mv temp/uut_${idx}.out temp/uut_${idx}.log"
35 echo " @grep -q 'SAT proof finished' temp/uut_${idx}.log && echo -n K || echo -n T"
36 all_targets="$all_targets temp/uut_${idx}.log"
37 done
38 echo "$all_targets"
39 } > temp/makefile
40
41 echo "running tests.."
42 ${MAKE:-make} -f temp/makefile
43
44 exit 0