diff --git a/generic.sh b/generic.sh index 238807deb57185bdec992df4fc055e46606a1d36..eed0dbc927b549f0b0ffa047f8893e69fef629d1 100755 --- a/generic.sh +++ b/generic.sh @@ -40,7 +40,7 @@ hdl_error() { echo "usage: hdl_error <caller's name> <message> [<exitcode>]" exit 1 fi - caller=`basename ${caller} | tr [a-z] [A-Z]` + caller=$(basename ${caller} | tr [a-z] [A-Z]) echo -n "$(tput setaf 6)$(tput bold)[${caller}] " echo -e "$(tput setaf 1)ERROR - ${msg}. $(tput sgr0)" # Exit if $NO_EXIT does not exist, else only return @@ -56,7 +56,7 @@ hdl_error_noexit() { echo "usage: hdl_error <caller's name> <message>" exit 1 fi - caller=`basename ${caller} | tr [a-z] [A-Z]` + caller=$(basename ${caller} | tr [a-z] [A-Z]) echo -n "$(tput setaf 6)$(tput bold)[${caller}] " echo -e "$(tput setaf 1)ERROR - ${msg}.$(tput sgr0)" } @@ -68,7 +68,7 @@ hdl_warning() { echo "usage: hdl_warning <caller's name> <message>" exit 1 fi - caller=`basename ${caller} | tr [a-z] [A-Z]` + caller=$(basename ${caller} | tr [a-z] [A-Z]) echo -n "$(tput setaf 6)$(tput bold)[${caller}] " echo -e "$(tput setaf 3)WARNING - ${msg}.$(tput sgr0)" return 0 @@ -82,7 +82,7 @@ hdl_info() { echo "usage: hdl_info <scriptname> <msg1> [<msg2> .. <msgN>]" exit 1 fi - caller=`basename ${caller} | tr [a-z] [A-Z]` + caller=$(basename ${caller} | tr [a-z] [A-Z]) echo -e "$(tput setaf 6)$(tput bold)[${caller}] $* $(tput sgr0)" return 0 } @@ -110,16 +110,16 @@ hdl_exec() { case ${ac} in output=*) # well allrighty then, override default msg - output=`echo "${ac}" | sed 's/^output=//'` + output=$(echo "${ac}" | sed 's/^output=//') shift ;; msg=*) # well allrighty then, override default msg - msg=`echo "${ac}" | sed 's/^msg=//'` + msg=$(echo "${ac}" | sed 's/^msg=//') shift ;; expect=*) - expect=`echo "${ac}" | sed 's/^expect=//'` + expect=$(echo "${ac}" | sed 's/^expect=//') shift ;; * ) @@ -196,7 +196,7 @@ timestamp() { pathadd() { for new_dir in ${@:2} do - eval dir_to_add=`echo ${new_dir}` + eval dir_to_add=$(echo ${new_dir}) if [ ! -d ${dir_to_add} ]; then echo "WARNING: directory ${dir_to_add} NOT added to $1 because directory doesn't exist!" else diff --git a/regressiontest/modelsim_regression_test_vhdl_cron.sh b/regressiontest/modelsim_regression_test_vhdl_cron.sh index d2acd61c2d8a4f20c67b13619864e81d136503e2..31b60ac30545e67978d923447cf6cb0dc6818d60 100755 --- a/regressiontest/modelsim_regression_test_vhdl_cron.sh +++ b/regressiontest/modelsim_regression_test_vhdl_cron.sh @@ -66,65 +66,66 @@ git_hash_filename="${RADIOHDL_LOG_DIR}"/modelsim_previous_git_hash.txt [[ -f "${git_hash_filename}" ]] && git_prev_hash=$(cat "${git_hash_filename}") git_active_hash=$(git rev-parse HEAD) -# make clean modelsim_build_list from given buildset_filename, skip lines starting with # echo ".. Read buildsets to check from: ${buildset_filename}" - -# Modelsim test for each line in 'modelsim_used_buildset_list.txt' -while read -r line; do - if [ -n "${line}" ]; then - - # if line starts with # continue while (=~ is for regex) - [[ "$line" =~ ^# ]] && continue - - echo ". Next buildset in 'modelsim_buildset_list.txt' is '${line}'" - - buildset=$(echo "${line}" | cut -d " " -f1) - echo ".. Do all regressiontests for ${buildset}" - - logfile="${RADIOHDL_LOG_DIR}/${buildset}/modelsim_regressiontest.log" - # Using > will start a new file - echo "Do all regressiontests for ${buildset}" > "${logfile}" - - # Delete tempory modelsim files '/tmp/VSOUT*' - echo ".. Remove old /tmp/VSOUT* files" - hdl_exec "$0" rm -f /tmp/VSOUT* 1>> "${logfile}" 2>&1 - - if [ "${git_active_hash}" == "${git_prev_hash}" ]; then - echo ".. Skip regression test, NO change in repository" - # Send nothing changed mail (-n option) - echo ".. Call modelsim_regression_test_vhdl_mail --nochange" - hdl_exec "$0" modelsim_regression_test_vhdl_mail.py "${buildset}" --nochange 1>> "${logfile}" 2>&1 - continue - fi - - # Cleanup last build if exists - echo ".. Cleanup last build ${buildset}" - hdl_exec "$0" rm -rf "${HDL_BUILD_DIR:?}"/"${buildset}" 1>> "${logfile}" 2>&1 - - # Build all IP - echo ".. Call compile_altera_simlibs" - hdl_exec "$0" compile_altera_simlibs "${buildset}" 1>> "${logfile}" 2>&1 - echo ".. Call generate_ip_libs" - hdl_exec "$0" generate_ip_libs "${buildset}" 1>> "${logfile}" 2>&1 - - # re-create it with modelsim_config and quartus_config - echo ".. Call modelsim_config" - hdl_exec "$0" modelsim_config "${buildset}" 1>> "${logfile}" 2>&1 - echo ".. Call quartus_config" - hdl_exec "$0" quartus_config "${buildset}" 1>> "${logfile}" 2>&1 - - # Perform the regression test and put the output in a log file - # -p 4: number of simultaneously test processes, each process needs a license - echo ".. Call modelsim_regression_test_vhdl" - hdl_exec "$0" modelsim_regression_test_vhdl.py "${buildset}" -p 2 1>> "${logfile}" 2>&1 - - # Read the log file en send the result email - echo ".. Call modelsim_regression_test_vhdl_mail" - hdl_exec "$0" modelsim_regression_test_vhdl_mail.py "${buildset}" 1>> "${logfile}" 2>&1 - - fi +# array with builsets +buildsets=() +while read -r line; +do + # skip empty lines and lines starting with # + [[ -z "$line" ]] && continue + [[ "$line" =~ ^# ]] && continue + # get firts word of line + buildset=$(echo "${line}" | cut -d " " -f1) + buildsets+=("${buildset}") done < ${buildset_filename} +# Modelsim test for each line in 'modelsim_buildset_list.txt' +for buildset in "${buildsets[@]}"; +do + echo ".. Do all regressiontests for ${buildset}" + + logfile="${RADIOHDL_LOG_DIR}/${buildset}/modelsim_regressiontest.log" + # Using > will start a new file + echo "Do all regressiontests for ${buildset}" > "${logfile}" + + # Delete tempory modelsim files '/tmp/VSOUT*' + echo ".. Remove old /tmp/VSOUT* files" + hdl_exec "$0" rm -f /tmp/VSOUT* 1>> "${logfile}" 2>&1 + + # if [ "${git_active_hash}" == "${git_prev_hash}" ]; then + # echo ".. Skip regression test, NO change in repository" + # # Send nothing changed mail (-n option) + # echo ".. Call modelsim_regression_test_vhdl_mail --nochange" + # hdl_exec "$0" modelsim_regression_test_vhdl_mail.py "${buildset}" --nochange 1>> "${logfile}" 2>&1 + # continue + # fi + + # # Cleanup last build if exists + # echo ".. Cleanup last build ${buildset}" + # hdl_exec "$0" rm -rf "${HDL_BUILD_DIR:?}"/"${buildset}" 1>> "${logfile}" 2>&1 + + # # Build all IP + # echo ".. Call compile_altera_simlibs" + # hdl_exec "$0" compile_altera_simlibs "${buildset}" 1>> "${logfile}" 2>&1 + # echo ".. Call generate_ip_libs" + # hdl_exec "$0" generate_ip_libs "${buildset}" 1>> "${logfile}" 2>&1 + + # # re-create it with modelsim_config and quartus_config + # echo ".. Call modelsim_config" + # hdl_exec "$0" modelsim_config "${buildset}" 1>> "${logfile}" 2>&1 + # echo ".. Call quartus_config" + # hdl_exec "$0" quartus_config "${buildset}" 1>> "${logfile}" 2>&1 + + # # Perform the regression test and put the output in a log file + # # -p 4: number of simultaneously test processes, each process needs a license + # echo ".. Call modelsim_regression_test_vhdl" + # hdl_exec "$0" modelsim_regression_test_vhdl.py "${buildset}" -p 3 1>> "${logfile}" 2>&1 + + # # Read the log file en send the result email + # echo ".. Call modelsim_regression_test_vhdl_mail" + # hdl_exec "$0" modelsim_regression_test_vhdl_mail.py "${buildset}" 1>> "${logfile}" 2>&1 +done + # save hash for next run echo "${git_active_hash}" > "${git_hash_filename}" echo "done"