source: flex_extract.git/Testing/Regression/FortranEtadot/run_regrtest.sh @ 14d9618

ctbtodev
Last change on this file since 14d9618 was 14d9618, checked in by pesei <petra.seibert [at ) univie.ac.at>, 4 years ago

update the Fortran regression test and makefile_fast

  • Property mode set to 100755
File size: 3.5 KB
Line 
1#!/bin/bash
2
3# Do the regression tests
4# can be called without arguments, then will test all cases
5# or with argument "omithigh" then high-resolution cases are omitted
6
7# Copyright Petra Seibert, 2019
8# SPDX-License-Identifier: MIT-0
9
10export OMP_NUM_THREADS=4 # you may want to change this
11export OMP_PLACES=cores
12export OMP_DISPLAY_ENV=verbose
13testhome=`pwd`
14path1=../../../Source/Fortran/
15path=../${path1}
16exedebug=calc_etadot_debug.out
17exefast=calc_etadot_fast.out
18hash=$(git log --abbrev-commit --pretty=oneline -n 1  --pretty=format:'%h')
19csvfile='runtimes_'${HOST}'.csv'
20exitonfail=true
21numtest=0
22numpassed=0
23
24rm -f log.run_regr failed
25
26# loop over all reference runs
27
28if [ "$1" = omithigh ]; then # for fast testing, not for production
29  inputs=`ls Inputs |  grep -v high`
30else
31  inputs=`ls Inputs |grep etadothigh`
32fi
33for ref in $inputs; do
34
35  echo 'Working on test case =' $ref | tee -a ../log.run_regr
36
37  # loop over debug and fast runs
38  for exe in 'debug' 'fast'; do
39 
40    numtest=$((numtest + 1))
41    failed=false
42
43    rm -f Work/* # make shure that Work is empty
44    cd Work
45    echo '  Run code version "'${exe}'"' | tee -a ../log.run_regr
46
47    thisexe=calc_etadot_${exe}.out
48    ln ../Inputs/${ref}/fort.* .
49    ( time ${path}${thisexe} ) >& log
50   
51    # check whether runs completeted properly
52    grep -q CONGRATULATIONS log
53    if [ $? = "0" ]; then
54      echo '    CONGRATULATIONS found' | tee -a ../log.run_regr
55    else
56      echo '    missing CONGRATULATIONS. Test failed.' | tee -a ../log.run_regr
57      echo $ref $exe 'FAILED' >> ${testhome}/failed
58      if [ "${exitonfail}" = true ]; then exit; else failed=true; fi
59    fi
60    for outfile in 'fort.15' 'VERTICAL.EC'; do
61      if [ -e $outfile ]; then
62        # compare reference and current version
63        # omega case also produces fort.25 - need to add this
64        outref='../Outputs/Output_ref_'${ref}'_'${exe}'/'$outfile
65        if cmp -s $outfile $outref >/dev/null; then
66          echo '    '$outfile '    test passed' | tee -a ../log.run_regr
67        else
68          echo 'WARNING:' $outfile '     test failed' | tee -a ../log.run_regr
69          echo $ref $exe 'FAILED' >> ${testhome}/failed
70          if [ "${exitonfail}" = true ]; then exit; else failed=true; fi
71        fi
72
73      else
74        echo '    missing '${outfile}' Test failed.' | tee -a ../log.run_regr
75        echo $ref $exe 'FAILED' >> ${testhome}/failed
76        if [ "${exitonfail}" = true ]; then exit; else failed=true; fi
77      fi
78    done # end loop outfiles
79    if [ "${failed}" = false ]; then numpassed=$((numpassed + 1)); fi
80
81  # save and show runtimes
82    log='log'
83    times=$(tail -3 ${log})
84    real=$(echo $times | grep real | awk '{print $2}')
85    user=$(echo $times | grep user | awk '{print $4}')
86    sys=$( echo $times | grep sys  | awk '{print $6}')
87    echo $hash, "'"reference"'", "'"${ref}'_'${exe}"'", ${real}, ${user}, ${sys} >> ../${csvfile}
88    tail -1 ../${csvfile} >> log.run_regr
89
90    cd ..
91    rm -f Work/* # this is for being more safe
92
93  done # end of exe loop
94 
95  echo # go to next reference run
96done # end of ref loop
97
98echo 
99echo ' Regression test: ' $numpassed 'out of' $numtest 'tests passed'. \
100  | tee -a ../log.run_regr
101echo ' More information may be found in log.run_regr' 
102echo ' Runtimes were added to '${csvfile}' under '$hash | tee -a ../log.run_regr
103
104# the following code is executed only if exitonfail is not set to 'true'.
105if [ -e failed ]; then 
106  echo
107  echo Some tests failed, see file "failed":
108  echo
109  cat failed|sort -u
110fi
Note: See TracBrowser for help on using the repository browser.
hosted by ZAMG