source: flex_extract.git/Testing/Regression/FortranEtadot/run_ref.sh @ 6bc4b42

ctbtodev
Last change on this file since 6bc4b42 was 6bc4b42, checked in by pesei <petra seibert -@…>, 5 years ago

Add script to run regression tests

called run_regrtest.sh + small corr on run_ref.sh

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