From 3aa3615d701a24d06f89659ccab307e82352810e Mon Sep 17 00:00:00 2001 From: steveri Date: Fri, 6 Jun 2025 11:04:07 -0700 Subject: [PATCH 1/3] eliminate redundancies and get rid of duplicates --- bin/golden_test.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/bin/golden_test.sh b/bin/golden_test.sh index d1922f8..3e601ee 100755 --- a/bin/golden_test.sh +++ b/bin/golden_test.sh @@ -381,11 +381,8 @@ for t in "${tests[@]}"; do alias mr='make -f $MAKEFILE run TOP=fft SIM=$SIMULATOR' function mr { make -f $MAKEFILE run TOP=fft SIM=$SIMULATOR; } - # Duh? Why twice? [ $DBG ] && echo " make -f $MAKEFILE run TOP=fft SIM=$SIMULATOR" - echo 1. make -f $MAKEFILE run TOP=fft SIM=$SIMULATOR >> $tmp - mr |& egrep -v '^Makefile' >> $tmp - echo 2. make -f $MAKEFILE run TOP=fft SIM=$SIMULATOR >> $tmp + echo make -f $MAKEFILE run TOP=fft SIM=$SIMULATOR >> $tmp mr |& egrep -v '^Makefile' >> $tmp # If "make run" failed, print out a coherent error message. From 7346c31070f7e66a045eb832a10c0a98661afa9f Mon Sep 17 00:00:00 2001 From: steveri Date: Fri, 6 Jun 2025 11:27:51 -0700 Subject: [PATCH 2/3] Better command-line-arg processing... --- bin/golden_test.sh | 153 +++++++++++++-------------------------------- 1 file changed, 45 insertions(+), 108 deletions(-) diff --git a/bin/golden_test.sh b/bin/golden_test.sh index 3e601ee..ea773a2 100755 --- a/bin/golden_test.sh +++ b/bin/golden_test.sh @@ -1,45 +1,7 @@ #!/bin/bash - -cat < /dev/null - ------------------------------------------------------------------------- -# To test vs. csh version, quick test: - -c; golden_test.csh 16 1 1port |& tee tmp.csh -cp /tmp/test_16_1_1port.log tmplog.csh - -c; golden_test.sh 16 1 1port |& tee tmp.sh -cp /tmp/test_16_1_1port.log tmplog.sh - -c; diff tmp.csh tmp.sh -c; diff -Bb tmplog.csh tmplog.sh - - ------------------------------------------------------------------------- -# To test vs. csh version, full test: - -mkdir tmptest; cd tmptest -gtcsh='../golden_test.csh --perl -sim verilator' -gtsh='../golden_test.sh --perl -sim verilator' - - -i=100 -$gtcsh |& head -$i | tee test_results.log.csh$i; \ -$gtsh |& head -$i | tee test_results.log.sh$i -diff -Bb -I '2022$' test_results.log.{csh,sh}$i |& less - -$gtcsh | tee test_results.log.csh | egrep 'PASS|FAIL|ERR'; \ -$gtsh | tee test_results.log.sh | egrep 'PASS|FAIL|ERR' & -diff -Bb -I '2022$' test_results.log.{csh,sh} |& less - -EOF - - -VERBOSE=True -TRAVIS='' - -if [ "$1" == "--help" ]; then cat <& $tmp - fi + echo " $cmd GENESIS_PARAMS=$dq$parms$dq" >& $tmp [ $DBG ] && echo " $cmd GENESIS_PARAMS=$dq$parms$dq" $cmd GENESIS_PARAMS="$parms" &>> $tmp || fatal_error=True @@ -365,9 +322,6 @@ for t in "${tests[@]}"; do echo fatal error echo " ERROR 'make gen' failed. --- $npoints $nunits $nports" - [ $TRAVIS ] && cat $tmp - [ $TRAVIS ] && exit 13 - echo " See $tmp for details" echo " less -r $tmp" [ $sfx == "8_4_1port" ] && echo "*** NOTE $sfx is SUPPOSED to fail! (16 SRAM's for 8 points\!?) ***" @@ -382,9 +336,17 @@ for t in "${tests[@]}"; do function mr { make -f $MAKEFILE run TOP=fft SIM=$SIMULATOR; } [ $DBG ] && echo " make -f $MAKEFILE run TOP=fft SIM=$SIMULATOR" + +# # Duh? Why twice? +# echo 1. make -f $MAKEFILE run TOP=fft SIM=$SIMULATOR >> $tmp +# mr |& egrep -v '^Makefile' >> $tmp +# echo 2. make -f $MAKEFILE run TOP=fft SIM=$SIMULATOR >> $tmp +# mr |& egrep -v '^Makefile' >> $tmp + echo make -f $MAKEFILE run TOP=fft SIM=$SIMULATOR >> $tmp mr |& egrep -v '^Makefile' >> $tmp + # If "make run" failed, print out a coherent error message. if [ ! -e $simlog ]; then echo fatal error @@ -534,28 +496,3 @@ echo echo "NOTE did not keep result summary file '$summfile'" printf "FINAL RESULT = PASS\n" - - -# echo ============================================================================== -# cat $summfile -# echo ============================================================================== -exit - - - - - -############################################################################## -## BOOKMARK ################################################################## -############################################################################## -if [ $"DBG" == 1 ]; then - echo '------------------------------------------------------------------------' - set | egrep '^golden_test' - echo '------------------------------------------------------------------------' -fi -exit -############################################################################## -############################################################################## -############################################################################## - - From 5b46a3461b8f1d9a7cf11dc8a1bc86a97dc07b7a Mon Sep 17 00:00:00 2001 From: steveri Date: Fri, 6 Jun 2025 11:46:20 -0700 Subject: [PATCH 3/3] arg processing was bad... --- bin/golden_test.sh | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/bin/golden_test.sh b/bin/golden_test.sh index ea773a2..b386c92 100755 --- a/bin/golden_test.sh +++ b/bin/golden_test.sh @@ -84,19 +84,26 @@ DO_GT8K= # See below for '-gt8k' DO_ABBREV= # Use "-abbrev" to run only the short tests SIMULATOR="verilator" # simulator can be either vcs or verilator PYTHON_OR_PERL="PERL" # driver can be either python or perl -for arg in $*; do - case "$arg" in +parms=() +while [ $# -gt 0 ] ; do + case "$1" in --help|-h) HELP; exit ;; - --py*) PYTHON_OR_PERL="PYTHON"; shift ;; # DEPRECATED!!! - --perl|--pl) PYTHON_OR_PERL="PERL"; shift ;; - -sim*|--sim*) SIMULATOR=$2; shift; shift ;; - -alg*|--alg*) swizzalg=$2; shift; shift ;; - -abb*|--abb*) DO_ABBREV=True; shift ;; - -gt8*|--gt8*) DO_GT8K=True; shift ;; - -dbg*|--dbg*) DBG=True; shift ;; + --py*) PYTHON_OR_PERL="PYTHON" ;; # DEPRECATED!!! + --perl|--pl) PYTHON_OR_PERL="PERL" ;; + -sim*|--sim*) SIMULATOR=$2; shift ;; + -alg*|--alg*) swizzalg=$2; shift ;; + -abb*|--abb*) DO_ABBREV=True; ;; + -gt8*|--gt8*) DO_GT8K=True; ;; + -dbg*|--dbg*) DBG=True; ;; + *) parms+=($1) ;; # Preserve non-switch parms esac + shift done - +set -- "${parms[@]}" # Restore remaining positional parameters + +# Convenient abbrev ver == verilator +[ "$SIMULATOR" == "ver" ] && SIMULATOR=verilator + echo Using $PYTHON_OR_PERL-based drivers... echo Using simulator $PYTHON_OR_PERL-based drivers...