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

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

remove jasper from makefiles, correct Fortran regression test scripts

  • Property mode set to 100755
File size: 3.4 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')
19exitonfail=true
20numtest=0
21numpassed=0
22
23rm -f log.run_regr failed
24
25# loop over all reference runs
26
27if [ "$1" = omithigh ]; then # for fast testing, not for production
28  inputs=`ls Inputs |  grep -v high`
29else
30  inputs=`ls Inputs |grep etadothigh`
31fi
32for ref in $inputs; do
33
34  echo 'Working on test case =' $ref | tee -a ../log.run_regr
35
36  # loop over debug and fast runs
37  for exe in 'debug' 'fast'; do
38 
39    numtest=$((numtest + 1))
40    failed=false
41
42    rm -f Work/* # make shure that Work is empty
43    cd Work
44    echo '  Run code version "'${exe}'"' | tee -a ../log.run_regr
45
46    thisexe=calc_etadot_${exe}.out
47    ln ../Inputs/${ref}/fort.* .
48    ( time ${path}${thisexe} ) >& log
49   
50    # check whether runs completeted properly
51    grep -q CONGRATULATIONS log
52    if [ $? = "0" ]; then
53      echo '    CONGRATULATIONS found' | tee -a ../log.run_regr
54    else
55      echo '    missing CONGRATULATIONS. Test failed.' | tee -a ../log.run_regr
56      echo $ref $exe 'FAILED' >> ${testhome}/failed
57      if [ "${exitonfail}" = true ]; then exit; else failed=true; fi
58    fi
59    for outfile in 'fort.15' 'VERTICAL.EC'; do
60      if [ -e $outfile ]; then
61        # compare reference and current version
62        # omega case also produces fort.25 - need to add this
63        outref='../Outputs/Output_ref_'${ref}'_'${exe}'/'$outfile
64        if cmp -s $outfile $outref >/dev/null; then
65          echo '    '$outfile '    test passed' | tee -a ../log.run_regr
66        else
67          echo 'WARNING:' $outfile '     test failed' | tee -a ../log.run_regr
68          echo $ref $exe 'FAILED' >> ${testhome}/failed
69          if [ "${exitonfail}" = true ]; then exit; else failed=true; fi
70        fi
71
72      else
73        echo '    missing '${outfile}' Test failed.' | tee -a ../log.run_regr
74        echo $ref $exe 'FAILED' >> ${testhome}/failed
75        if [ "${exitonfail}" = true ]; then exit; else failed=true; fi
76      fi
77    done # end loop outfiles
78    if [ "${failed}" = false ]; then numpassed=$((numpassed + 1)); fi
79
80  # save and show runtimes
81    log='log'
82    times=$(tail -3 ${log})
83    real=$(echo $times | grep real | awk '{print $2}')
84    user=$(echo $times | grep user | awk '{print $4}')
85    sys=$( echo $times | grep sys  | awk '{print $6}')
86    echo $hash, "'"reference"'", "'"${ref}'_'${exe}"'", ${real}, ${user}, ${sys} >> ../runtimes.csv
87    tail -1 ../runtimes.csv >> log.run_regr
88
89    cd ..
90    rm Work/* # this is for being more safe
91
92  done # end of exe loop
93 
94  echo # go to next reference run
95done # end of ref loop
96
97echo 
98echo ' Regression test: ' $numpassed 'out of' $numtest 'tests passed'. \
99  | tee -a ../log.run_regr
100echo ' More information may be found in log.run_regr' 
101echo ' Runtimes were added to runtimes.csv under '$hash | tee -a ../log.run_regr
102
103# the following code is executed only if exitonfail is not set to 'true'.
104if [ -e failed ]; then 
105  echo
106  echo Some tests failed, see file "failed":
107  echo
108  cat failed|sort -u
109fi
Note: See TracBrowser for help on using the repository browser.
hosted by ZAMG