source: flex_extract.git/Testing/Regression/FortranEtadot/run_ref.sh @ 2d1c338

ctbtodev
Last change on this file since 2d1c338 was 2d1c338, checked in by Petra Seibert <petra@…>, 5 years ago

1st version of Fortran testing environment, FORDv5->v6, Test->Testing

Includes the first version of the Fortran regression testing environment
without input files (too big)
FORD documentation of the Fortran code: v5 removed from VCS, V6 added
The directory "Test" has been renamed to "Testing" for clarity.

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