From bda79d8c6ac95fa4a6b47a4b7801854a24b9e583 Mon Sep 17 00:00:00 2001 From: George Gayno Date: Fri, 28 Feb 2025 09:30:20 -0600 Subject: [PATCH] Added comments and minor logic updates to rt.summary.sh. Fixes #1016 --- reg_tests/cpld_gridgen/rt.summary.sh | 46 ++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/reg_tests/cpld_gridgen/rt.summary.sh b/reg_tests/cpld_gridgen/rt.summary.sh index 9d84768d0..7e4d48b59 100755 --- a/reg_tests/cpld_gridgen/rt.summary.sh +++ b/reg_tests/cpld_gridgen/rt.summary.sh @@ -1,35 +1,55 @@ #!/bin/bash -set -x +set -eux + +#-------------------------------------------------------------------------- +# This script runs once all tests have completed. It checks for +# failed tests and creates some final log files. +#-------------------------------------------------------------------------- cd $PATHRT -rm -f fail_test +#-------------------------------------------------------------------------- +# If there are any failed tests, combine the log files into one log +# called 'fail_test'. +#-------------------------------------------------------------------------- + +rm -f failed_tests FAIL_FILES="fail_test_*" for file in $FAIL_FILES; do if [[ -f "$file" ]]; then - cat "$file" >> fail_test + cat "$file" >> failed_tests + rm -f $file fi done -rm -f RegressionTests_$target.$compiler.log +#-------------------------------------------------------------------------- +# Combine the run logs for each test into one log. +#-------------------------------------------------------------------------- + +LOG_FILE=RegressionTests_${target}.${compiler}.log +rm -f $LOG_FILE for file in RegressionTests_$target.${compiler}.*.log do if [[ -f "$file" ]]; then - cat "$file" >> RegressionTests_$target.$compiler.log + cat "$file" >> $LOG_FILE rm -f $file fi done +#-------------------------------------------------------------------------- +# Summarize the results in summary.log. +#-------------------------------------------------------------------------- + rm -f summary.log -if [[ -e fail_test ]]; then - echo | tee -a RegressionTests_$target.$compiler.log - for file in fail_test_*; do - cat $file >>RegressionTests_$target.$compiler.log - cat $file >>summary.log - done +if [[ -e "failed_tests" ]]; then + echo | tee -a $LOG_FILE + cat failed_tests >>$LOG_FILE + cat failed_tests >>summary.log else - echo | tee -a RegressionTests_$target.$compiler.log - echo "REGRESSION TEST WAS SUCCESSFUL" | tee -a RegressionTests_$target.$compiler.log + echo | tee -a $LOG_FILE + echo "REGRESSION TEST WAS SUCCESSFUL" | tee -a $LOG_FILE echo "All tests passed" >>summary.log fi + +exit 0