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 @ 8859

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

Continuation of global refactoring of Trusting tool

  • Introduce new 'dev' mode beetween 'debug' and 'prod' modes to skip XIOS compilation from scratch and working in a solely testing directory (thanks Andrew for the suggestion)
  • Switch cfg files from 'svn:mime-type=text/x-shellscript' to 'svn:executable' trying to get syntax highlighting under Trac
  • Bugfixes: correct XIOS branch 'XIOS_DEV_CMIP6' for ORCA1 and remove remaining 'TRUST_DIR_BENCHMARK' (replace by TRUST_TEST_BENCHMARK)
  • Improve the workflow displayed in the terminal
  • Property svn:executable set to *
File size: 4.6 KB
Line 
1#!/bin/bash
2
3
4cd $( dirname $0 )
5
6##--------------------------------------------------------------------------------
7## Set flags & defaults
8##--------------------------------------------------------------------------------
9
10TRUST_MAIN_DIR=$PWD
11TRUST_FLAG_HELP='false'
12TRUST_FLAG_DEBUG='false'; TRUST_FLAG_DEV='false' ; TRUST_FLAG_PROD='false'
13
14# Revision number of the tool
15rev=$( svn info | awk '/Last Changed Rev/ {print $NF}' )
16
17
18##--------------------------------------------------------------------------------
19## Get short or long arguments from command line
20##--------------------------------------------------------------------------------
21
22while getopts a:b:de:f:j:hm:n:r:t:pu:v:w: arg; do
23
24    case $arg in
25   a)  TRUST_IO_FORC_TAR=$OPTARG;; b)    TRUST_SVN_BRANCH=$OPTARG;;
26   d) TRUST_FLAG_DEBUG='true'   ;; e)  TRUST_TEST_MAILING=$OPTARG;;
27   f) TRUST_IO_FORC_PATH=$OPTARG;; j) TRUST_COMPILE_NPROC=$OPTARG;;
28   h)  TRUST_FLAG_HELP='true'   ;; m)     TRUST_MAIN_HPCC=$OPTARG;;
29   n)      TRUST_CFG_NEW=$OPTARG;; r)       TRUST_CFG_REF=$OPTARG;;
30   t)  TRUST_JOB_TIMEOUT=$OPTARG;; p)   TRUST_FLAG_PROD='true'   ;;
31   u)    TRUST_MAIN_USER=$OPTARG;; v)       TRUST_SVN_REV=$OPTARG;;
32   w)     TRUST_DIR_WORK=$OPTARG;;
33   :) echo 'Arg. needed for '$OPTARG && TRUST_FLAG_HELP='true'   ;;
34   *)  TRUST_FLAG_HELP='true'                                    ;;
35    esac
36
37done
38
39
40##--------------------------------------------------------------------------------
41## Initialization (user & HPC environment)
42##--------------------------------------------------------------------------------
43
44if [[ ! -e cfg/${TRUST_MAIN_USER}.cfg || ! -e cfg/${TRUST_MAIN_HPCC}.cfg \
45      || ${TRUST_FLAG_HELP} == 'true'                                      ]]; then
46    cat ./inc/trusting_help.txt
47
48    ## Color this section to part with help
49    printf "\033[0;33m"
50
51    if [ ${TRUST_FLAG_HELP} == 'false' ]; then
52   printf "                                                           \
53       \nAt least 1 cfg file (arch or user) is missing or misspelled: \
54       '%s.cfg' or '%s.cfg'\n"                                        \
55       ${TRUST_MAIN_USER} ${TRUST_MAIN_HPCC}
56    fi
57
58    echo -e "\nContent of './cfg' folder:"
59    find ./cfg -name *.cfg | cut -d/ -f3 \
60   | xargs -n 3 printf "%-20s\t%-20s\t%-20s\n"
61    printf "\033[0m\n"
62
63    exit 1
64else
65    ## Verbose output on debug mode
66    [ ${TRUST_FLAG_DEBUG} == 'true' ] && set -vx
67
68    . ./inc/trusting.env
69    . ./inc/trusting_func.sh
70
71fi
72
73
74##--------------------------------------------------------------------------------
75## Trusting workflow
76##--------------------------------------------------------------------------------
77
78## Test summary
79##-------------
80
81echo
82if [ -t 0 ]; then cat ./inc/banner.txt; else cat ./inc/banner.html; fi
83echo
84echo '****************************************************************************************************'
85echo '*                                                                                                  *'
86echo '*                           NEMO Trusting (Continuous Integration Tool)                            *'
87echo "*                                             ver.$rev                                             *"
88echo '*                                                                                                  *'
89echo '****************************************************************************************************'
90echo
91printf "\t§ Testing configuration\t\t%s on branch %s\n" \ ${TRUST_CFG_REF} ${TRUST_SVN_BRANCH}
92printf "\t§ (Super)Computer\t\t%s\n"                ${TRUST_MAIN_HPCC}
93printf "\t§ User installation\t\t%s\n\n"            ${TRUST_MAIN_USER}
94echo
95if [ ${TRUST_TEST_BENCHMARK} ]; then
96printf "\t§ Benchmark folder\n\t\t\t%s\n"                 ${TRUST_TEST_BENCHMARK}
97fi
98
99
100## Testing directory
101##------------------
102
103step 'Testing directory'
104init
105
106
107## Local working copy
108##-------------------
109
110step 'Local working copy'
111
112echo "${TRUST_SVN_ACTION} on ${TRUST_SVN_NEMOGCM}:"
113get_nemo_rev
114
115
116## Environment
117##------------
118
119step 'Environment'
120get_soft_rel
121
122
123## Compilation(s)
124##---------------
125
126step 'Compilation(s)'
127
128printf "XIOS? "
129compile_xios
130
131printf "\nNEMO ${TRUST_CFG_NEW} cfg. from ${TRUST_CFG_REF}? "
132compile_nemo
133
134
135## Inputs
136##-------
137
138step 'Inputs'
139
140get_inputs
141
142printf "\nCompare with benchmark? "
143diff_inputs
144
145
146## Job
147##----
148
149step 'Job'
150
151printf "Submit? "
152job_submit
153
154echo 'Pending...'
155job_pending
156
157echo 'Finished!'
158
159printf "State? "
160job_state
161
162printf "Perfs?"
163job_perfs
164
165
166## Output(s)
167##----------
168
169step 'Ouput(s)'
170
171echo 'Compare with benchmark:'
172
173printf "Plain text files? "
174diff_results
175
176printf "Restart files? "
177diff_restarts
178
179
180## End, at least nothing major has changed ;-)
181##--------------------------------------------
182
183get_out 0
Note: See TracBrowser for help on using the repository browser.