wqMerge branch 'dev' of ssh://git.web.rug.nl:222/bics/actlib_dataflow_neuro into dev

This commit is contained in:
alexmadison 2022-04-10 19:43:18 +02:00
commit d3614580dd
2 changed files with 83 additions and 77 deletions

View File

@ -1,85 +1,90 @@
# repeatedly run prsim on one unit_test's PRs #!/bin/sh
fail=0
faildirs=""
proc=""
bold=$(tput bold) bold=$(tput bold)
normal=$(tput sgr0) normal=$(tput sgr0)
und=$(tput smul) und=$(tput smul)
i=${unit}
proc="$i<>"
echo "" faildirs=""
echo "${bold}******************************************" failed=0
echo "* ${i} repetitions , show warnings=${warning}*" iteration=0
echo "******************************************${normal}" numberofruns=100
#
# 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}"
faildirs="${faildirs} ${1}-sim"
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
if [ ! -d "unit_tests" ];
then
echo "${bold}Error:${bold} no unit_tests directory."
exit 1
fi
cd "unit_tests" cd "unit_tests"
echo "${bold}... checking aflat${normal}"
# check aflat # run all test except single one is specified
if ($ACT_HOME/bin/aflat "$i/test_final.act" > "$i/test.prs"); if [ ! -z $2 ]; then
then $numberofruns = $2
echo "${bold}... aflat complete, checking in prsim${normal}" fi
# run prsim on prs if [ -z $1 ]; then
(($ACT_HOME/bin/prsim "$i/test.prs" < "$i/test.prsim") > "$i/prsim.out"); for i in *
if (cat "$i/prsim.out" | grep -e "WRONG ASSERT" -e "FATAL" -e "not found")
then
echo "FAILED in first prsim"
else
# show warnings setting
if [ "${warning}" = "1" ];
then
echo "${bold}Exit on prsim warnings turned ON${normal}"
else
echo "${bold}Exit on prsim warnings turned OFF${normal}"
fi
echo ""
# begin prsim test loop
has_failed=0
iter=0
echo "${bold}using random_seed${normal}"
echo "\nusing random_seed" >> "$i/prsim.out"
while [ has_failed=0 ]
do do
# write prsim test file with random seed appended to top of file if [ -d $i -a -f $i/test.act ]; then
(echo "random_seed $iter \nrandom" > "$i/test_rand.prsim"); while [ $failed = 0 ] && [ $iteration < $numberofruns ]
(cat "$i/test.prsim" >> "$i/test_rand.prsim"); do
(echo "\nTEST $iter\n" >> "$i/prsim.out"); run_test $iteration
done
# validate prsim output
if (($ACT_HOME/bin/prsim "$i/test.prs" < "$i/test_rand.prsim") >> "$i/prsim.out");
then
if [ "${warning}" = "1" ];
then
if (cat "$i/prsim.out" | grep -e "WRONG ASSERT" -e "FATAL" -e "not found" -e "WARNING:");
then
echo "${bold}==> test #${iter} ${und}FAILED in prsim${normal}"
has_failed=1
exit 0
else
echo "==> passed test #${iter}"
iter=$(($iter + 1))
fi
else
if (cat "$i/prsim.out" | grep -e "WRONG ASSERT" -e "FATAL" -e "not found");
then
echo "${bold}==> test #${iter} ${und}FAILED in prsim${normal}"
has_failed=1
exit 0
else
echo "==> passed test #${iter}"
iter=$(($iter + 1))
fi
fi
else
has_failed=1
exit 0
fi fi
done done
(cd ".."; pwd);
exit 1
fi
else else
echo "FAILED in aflat conversion"
while [ $failed = 0 ] && [ $iteration < $numberofruns ]
do
run_test $1 $iteration
done
fi fi
if [ $failed -eq 1 ]; then
echo ""
echo "${bold}*********************************"
echo "* FAILED DIRECTORIES:${normal}$faildirs ${bold}*"
echo "*********************************${normal}"
fi
exit $failed

View File

@ -22,7 +22,8 @@ run_test () {
mkdir $1/run mkdir $1/run
cp init.prs $1/run/test.prs cp init.prs $1/run/test.prs
if aflat -ref=1 $1/test.act >> $1/run/test.prs; then if aflat -ref=1 $1/test.act >> $1/run/test.prs; then
cat init_qdi.prsim $1/test.prsim | prsim -r $1/run/test.prs > $1/run/prsim.out 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 if egrep '(WRONG|WARNING|Node)' $1/run/prsim.out >/dev/null; then
echo "${bold}*** simulation failed ***${normal}" echo "${bold}*** simulation failed ***${normal}"
faildirs="${faildirs} ${1}-sim" faildirs="${faildirs} ${1}-sim"