actlib_dataflow_neuro/test/repeat_unit.sh

95 lines
2.0 KiB
Bash
Raw Normal View History

2022-04-10 15:44:45 +02:00
#!/bin/sh
2022-04-10 15:44:45 +02:00
fail=0
faildirs=""
proc=""
bold=$(tput bold)
normal=$(tput sgr0)
und=$(tput smul)
2022-04-10 15:44:45 +02:00
faildirs=""
failed=0
iteration=0
numberofruns=100
2022-04-10 15:44:45 +02:00
#
# run_test name [option]
#
run_test () {
echo "Testing ${bold}$1 ${normal} for $2 random delay runs"
# clear run directory
if [ -d $1/run ]; then
rm -rf $1/run
fi
mkdir $1/run
cp init.prs $1/run/test.prs
if aflat -ref=1 $1/test.act >> $1/run/test.prs; then
echo "random_seed $2" > $1/run/prsim.in
cat init_qdi.prsim $1/test.prsim >> $1/run/prsim.in
cat $1/run/prsim.in | prsim -r $1/run/test.prs > $1/run/prsim.out
if egrep '(WRONG|WARNING|Node)' $1/run/prsim.out >/dev/null; then
echo "${bold}*** simulation failed seed: $2 ***${normal}"
2022-04-12 10:31:50 +02:00
faildirs="${faildirs} ${1}-sim($2)"
2022-04-10 15:44:45 +02:00
failed=1
echo
fi
else
echo "${bold}*** circuit construction failed ***${normal}"
faildirs="${faildirs} ${1}-ckt"
failed=1
echo
fi
}
if [ ! $(command -v aflat) ]; then #&& ! command -v prsim ]; then
echo "${bold}Error:${bold} aflat & prsim necessary for tests."
exit 1
fi
2022-04-10 15:44:45 +02:00
if [ ! -d "unit_tests" ];
then
2022-04-10 15:44:45 +02:00
echo "${bold}Error:${bold} no unit_tests directory."
exit 1
fi
cd "unit_tests"
# run all test except single one is specified
2022-04-11 20:16:32 +02:00
if [ ! -z $3 ]; then
iteration=$3
2022-04-12 10:31:50 +02:00
fi
if [ ! -z $2 ]; then
2022-04-11 17:00:28 +02:00
numberofruns=$2
2022-04-10 15:44:45 +02:00
fi
if [ -z $1 ]; then
for i in *
do
if [ -d $i -a -f $i/test.act ]; then
2022-04-12 10:31:50 +02:00
while [ $iteration -lt $numberofruns ]
2022-04-10 15:44:45 +02:00
do
run_test $iteration
2022-04-11 17:00:28 +02:00
iteration=$iteration+1
2022-04-10 15:44:45 +02:00
done
fi
2022-04-10 15:44:45 +02:00
done
else
2022-04-12 10:31:50 +02:00
while [ $iteration -lt $numberofruns ]
2022-04-10 15:44:45 +02:00
do
run_test $1 $iteration
2022-04-11 17:00:28 +02:00
iteration=$((iteration+1))
2022-04-10 15:44:45 +02:00
done
fi
2022-04-10 15:44:45 +02:00
if [ $failed -eq 1 ]; then
echo ""
echo "${bold}*********************************"
echo "* FAILED DIRECTORIES:${normal}$faildirs ${bold}*"
echo "*********************************${normal}"
fi
exit $failed