From 290013e534947003965d0417a7b13e3ab26769ae Mon Sep 17 00:00:00 2001 From: mcgratta Date: Fri, 20 Dec 2024 14:29:11 -0500 Subject: [PATCH] FDS Validation: Add a check to Process_All script --- Validation/Process_All_Output.sh | 43 +++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/Validation/Process_All_Output.sh b/Validation/Process_All_Output.sh index aa145b801a..77c45024ac 100755 --- a/Validation/Process_All_Output.sh +++ b/Validation/Process_All_Output.sh @@ -1,9 +1,36 @@ #!/bin/bash +# This script contains a list of validation sets whose results are to be copied to the 'out' repository. +# The script checks to see that every case within each validation set has run successfully. +# The script also checks to see if older versions of the results might accidentally overwrite newer versions. + +# This function scans the '_git.txt' files within a given directory and converts the git hash to a Unix time stamp. + +GET_UNIX_TIME() +{ + gitrevisions=$TEMPDIR/gitrevisions.$$ + cat $1/*git.txt 2> /dev/null | sort -u > $gitrevisions + gitrev=`head -1 $gitrevisions` + gitdate2=0 + if [ "$gitrev" != "" ] ; then + gitrevshort=`echo $gitrev | awk -F - '{print $(NF-1)}' | sed 's/^g//'` + gitdate2=`git show -s --format=%at $gitrevshort | head -1 | awk '{print $1}'` + fi + rm $gitrevisions +} + +# This function takes a validation set and determines whether or not it should be processed. + PROCESS() { case=$1 + casedir=$FIREMODELS/out/$case + GET_UNIX_TIME $casedir + out_date=$gitdate2 curdir=`pwd` + casedir=$case/Current_Results + GET_UNIX_TIME $casedir + new_date=$gitdate2 cd $case nout=`ls -l Current_Results/*.out |& grep -v cannot | wc -l` nfds=`ls -l Current_Results/*.fds |& grep -v cannot | wc -l` @@ -15,6 +42,8 @@ PROCESS() status="***error: $case cases not run" if [ $nfds -gt 0 ] && [ $nfds -gt $nout ]; then status="***error: some $case cases did not run or are not complete" + elif [ $out_date \> $new_date ]; then + status="***error: existing output is newer than the cases being processed" else if [ $nout -gt 0 ] && [ $nout -gt $nsuccess ]; then status="some $case cases failed" @@ -33,11 +62,17 @@ PROCESS() cd $curdir } -# This list of active validation data sets is used by Validationbot -# to automatically run validation cases on a regular basis. +# Define some directories. + +TEMPDIR=$HOME/temp +if [ ! -d $TEMPDIR ]; then + mkdir $TEMPDIR +fi + +FIREMODELS=../.. -# There should exist a line entry for every directory under Validation. -# If the case is under development, simply comment out the line. +# There should exist a line entry for every directory in the Validation directory of the fds repository. +# If the case is under development, simply comment out the line below. PROCESS Arup_Tunnel PROCESS ATF_Corridors