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

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

Cleaning of main script 'trusting.sh': transfer code lines to 'trusting_func.sh' with new functions, improve overall readability

  • Property eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Rev URL
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
11
12TRUST_FLAG_DEBUG='false'  ; TRUST_FLAG_HELP='false' ; TRUST_FLAG_PROD='false'
13
14rev=$( svn info | awk '(NR == 9) {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## Display summary of test
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§ (Super)Computer\t\t%s\n"             ${TRUST_MAIN_HPCC}
86printf "\t§ User installation\t\t%s\n\n"         ${TRUST_MAIN_USER}
87echo
88printf "\t§ Testing configuration\t\t%s based on %s\n" \
89    ${TRUST_CFG_NEW} ${TRUST_CFG_REF}
90printf "\t§ SVN working copy\t\t%s/%s\n"               \
91    ${TRUST_DIR_WORK} ${TRUST_SVN_BRANCH}
92if [ ${TRUST_TEST_BENCHMARK} ]; then
93printf "\t§ Benchmark folder\t\t%s\n"               ${TRUST_TEST_BENCHMARK}
94fi
95
96
97## Testing directory
98##------------------
99
100print_step 'Timestamped testing directory'
101init
102
103
104## Local working copy
105##-------------------
106
107print_step 'SVN action on NEMO directories'
108echo "${TRUST_SVN_ACTION} on ${TRUST_SVN_NEMOGCM}:"
109get_nemo_rev
110
111
112## Environment
113##------------
114
115print_step 'Get testing environment'
116get_soft_rel
117
118
119## Compilation(s)
120##---------------
121
122print_step 'Compile XIOS'
123compile_xios
124
125print_step "Compile ${TRUST_CFG_REF} configuration"
126compile_nemo
127
128
129## Inputs
130##-------
131
132print_step 'Set job (copying or extracting inputs)'
133get_inputs
134
135print_step 'Compare inputs'
136diff_inputs
137
138
139## Job
140##----
141
142print_step 'Submit job'
143job_submit
144
145print_step 'Pending job'
146job_pending
147
148print_step 'Job finished'
149
150print_step 'Test job state'
151job_state
152
153print_step 'Get job performances'
154job_perfs
155
156
157## Outputs
158##--------
159
160print_step 'Compare outputs'
161diff_results
162
163print_step 'Compare restarts'
164diff_restarts
165
166
167## End, at least nothing major has changed ;-)
168##--------------------------------------------
169
170get_out 0
Note: See TracBrowser for help on using the repository browser.