New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
trusting.sh in branches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST – NEMO

source: branches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST/trusting.sh @ 8843

Last change on this file since 8843 was 8843, checked in by nicolasmartin, 6 years ago

Review forcing inputs management + cosmetic changes

  • Property eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Rev URL
File size: 4.5 KB
Line 
1#!/bin/bash
2
3
4cd $( dirname $0 )
5
6##--------------------------------------------------------------------------------
7## Set flags & defaults
8##--------------------------------------------------------------------------------
9
10TRUST_MAIN_DIR=$PWD
11
12TRUST_FLAG_DEBUG='false'  ; TRUST_FLAG_HELP='false' ; TRUST_FLAG_PROD='false'
13
14rev=$( svn info | awk '/Last Changed Rev/ {print $NF}' )
15
16
17##--------------------------------------------------------------------------------
18## Get arguments from command line
19##--------------------------------------------------------------------------------
20
21while getopts a:b:de:f:j:hm:n:r:t:pu:v:w: arg; do
22
23    case $arg in
24   a)  TRUST_IO_FORC_TAR=$OPTARG;; b)    TRUST_SVN_BRANCH=$OPTARG;;
25   d) TRUST_FLAG_DEBUG='true'   ;; e)  TRUST_TEST_MAILING=$OPTARG;;
26   f) TRUST_IO_FORC_PATH=$OPTARG;; j) TRUST_COMPILE_NPROC=$OPTARG;;
27   h)  TRUST_FLAG_HELP='true'   ;; m)     TRUST_MAIN_HPCC=$OPTARG;;
28   n)      TRUST_CFG_NEW=$OPTARG;; r)       TRUST_CFG_REF=$OPTARG;;
29   t)  TRUST_JOB_TIMEOUT=$OPTARG;; p)   TRUST_FLAG_PROD='true'   ;;
30   u)    TRUST_MAIN_USER=$OPTARG;; v)       TRUST_SVN_REV=$OPTARG;;
31   w)     TRUST_DIR_WORK=$OPTARG;;
32   :) echo 'Arg. needed for '$OPTARG && TRUST_FLAG_HELP='true'   ;;
33   *)  TRUST_FLAG_HELP='true'                                    ;;
34    esac
35
36done
37
38
39##--------------------------------------------------------------------------------
40## Initialization (user & HPC environment)
41##--------------------------------------------------------------------------------
42
43if [[ ! -e cfg/${TRUST_MAIN_USER}.cfg || ! -e cfg/${TRUST_MAIN_HPCC}.cfg \
44      || ${TRUST_FLAG_HELP} == 'true'                                      ]]; then
45    cat ./inc/trusting_help.txt
46
47    if [ ${TRUST_FLAG_HELP} == 'false' ]; then
48   printf "\n\n\033[0;33m"
49   printf "At least one configuration (arch or user) file is missing or misspelled:"
50   printf "\t'%s'.cfg\t'%s'.cfg" ${TRUST_MAIN_USER} ${TRUST_MAIN_HPCC}
51   printf "\033[0m"
52    fi
53
54    printf "\n\nContent of 'config' folder:"
55    find config -name *.cfg | cut -d/ -f2 \
56   | xargs -n 4 printf "%-25s\t%-25s\t%-25s\n"
57    exit 1
58else
59    ## Verbose output on debug mode
60    [ ${TRUST_FLAG_DEBUG} == 'true' ] && set -vx
61
62    . ./inc/trusting.env
63    . ./inc/trusting_func.sh
64
65fi
66
67
68##--------------------------------------------------------------------------------
69## Trusting workflow
70##--------------------------------------------------------------------------------
71
72## Test summary
73##-------------
74
75echo
76if [ -t 0 ]; then cat ./inc/banner.txt; else cat ./inc/banner.html; fi
77echo
78echo '****************************************************************************************************'
79echo '*                                                                                                  *'
80echo '*                           NEMO Trusting (Continuous Integration Tool)                            *'
81echo "*                                             ver.$rev                                             *"
82echo '*                                                                                                  *'
83echo '****************************************************************************************************'
84echo
85printf "\t§ Testing configuration\t\t%s on branch %s\n" \ ${TRUST_CFG_REF} ${TRUST_SVN_BRANCH}
86printf "\t§ (Super)Computer\t\t%s\n"                ${TRUST_MAIN_HPCC}
87printf "\t§ User installation\t\t%s\n\n"            ${TRUST_MAIN_USER}
88echo
89if [ ${TRUST_TEST_BENCHMARK} ]; then
90printf "\t§ Benchmark folder\n\t\t\t%s\n"                 ${TRUST_TEST_BENCHMARK}
91fi
92
93
94## Testing directory
95##------------------
96
97print_step 'Timestamped testing directory'
98init
99
100
101## Local working copy
102##-------------------
103
104print_step 'SVN action on NEMO directories'
105printf "${TRUST_SVN_ACTION} on ${TRUST_SVN_NEMOGCM}:\n\n" 
106get_nemo_rev
107
108
109## Environment
110##------------
111
112print_step 'Get testing environment'
113get_soft_rel
114
115
116## Compilation(s)
117##---------------
118
119print_step 'Compile XIOS'
120compile_xios
121
122print_step "Compile ${TRUST_CFG_NEW} cfg from ${TRUST_CFG_REF}"
123compile_nemo
124
125
126## Inputs
127##-------
128
129print_step 'Set job (copying or extracting inputs)'
130get_inputs
131
132print_step 'Compare inputs'
133diff_inputs
134
135
136## Job
137##----
138
139print_step 'Submit job'
140job_submit
141
142print_step 'Pending job'
143job_pending
144
145print_step 'Job finished'
146
147print_step 'Test job state'
148job_state
149
150print_step 'Get job performances'
151job_perfs
152
153
154## Outputs
155##--------
156
157print_step 'Compare outputs'
158diff_results
159
160print_step 'Compare restarts'
161diff_restarts
162
163
164## End, at least nothing major has changed ;-)
165##--------------------------------------------
166
167get_out 0
Note: See TracBrowser for help on using the repository browser.