11#! /bin/bash
22
3+ # This script contains a list of validation sets whose results are to be copied to the 'out' repository.
4+ # The script checks to see that every case within each validation set has run successfully.
5+ # The script also checks to see if older versions of the results might accidentally overwrite newer versions.
6+
7+ # This function scans the '_git.txt' files within a given directory and converts the git hash to a Unix time stamp.
8+
9+ GET_UNIX_TIME ()
10+ {
11+ gitrevisions=$TEMPDIR /gitrevisions.$$
12+ cat $1 /* git.txt 2> /dev/null | sort -u > $gitrevisions
13+ gitrev=` head -1 $gitrevisions `
14+ gitdate2=0
15+ if [ " $gitrev " != " " ] ; then
16+ gitrevshort=` echo $gitrev | awk -F - ' {print $(NF-1)}' | sed ' s/^g//' `
17+ gitdate2=` git show -s --format=%at $gitrevshort | head -1 | awk ' {print $1}' `
18+ fi
19+ rm $gitrevisions
20+ }
21+
22+ # This function takes a validation set and determines whether or not it should be processed.
23+
324PROCESS ()
425{
526 case=$1
27+ casedir=$FIREMODELS /out/$case
28+ GET_UNIX_TIME $casedir
29+ out_date=$gitdate2
630 curdir=` pwd`
31+ casedir=$case /Current_Results
32+ GET_UNIX_TIME $casedir
33+ new_date=$gitdate2
734 cd $case
835 nout=` ls -l Current_Results/* .out | & grep -v cannot | wc -l`
936 nfds=` ls -l Current_Results/* .fds | & grep -v cannot | wc -l`
@@ -15,6 +42,8 @@ PROCESS()
1542 status=" ***error: $case cases not run"
1643 if [ $nfds -gt 0 ] && [ $nfds -gt $nout ]; then
1744 status=" ***error: some $case cases did not run or are not complete"
45+ elif [ $out_date \> $new_date ]; then
46+ status=" ***error: existing output is newer than the cases being processed"
1847 else
1948 if [ $nout -gt 0 ] && [ $nout -gt $nsuccess ]; then
2049 status=" some $case cases failed"
@@ -33,11 +62,17 @@ PROCESS()
3362 cd $curdir
3463}
3564
36- # This list of active validation data sets is used by Validationbot
37- # to automatically run validation cases on a regular basis.
65+ # Define some directories.
66+
67+ TEMPDIR=$HOME /temp
68+ if [ ! -d $TEMPDIR ]; then
69+ mkdir $TEMPDIR
70+ fi
71+
72+ FIREMODELS=../..
3873
39- # There should exist a line entry for every directory under Validation.
40- # If the case is under development, simply comment out the line.
74+ # There should exist a line entry for every directory in the Validation directory of the fds repository .
75+ # If the case is under development, simply comment out the line below .
4176
4277PROCESS Arup_Tunnel
4378PROCESS ATF_Corridors
0 commit comments