Index: anches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST/inc/banner.html
===================================================================
--- /branches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST/inc/banner.html	(revision 8882)
+++ 	(revision )
@@ -1,33 +1,0 @@
-<pre style="font: 2px/1px monospace;">
-@@@@@@O$$$$$$@@@@@@#$$$$$$&@#$$$$$$$$$$$$$$$&@O$$$$$$&@@@@@@@@@$$$$$$O@@@@@@@@@@@O$$%$O@@@@@@@@@@@@@
-@@@@@@?!!!!!!#@@@@@O!!!!!!#@$!!!!!!!!!!!!!!!#@%!!!!!!?&@@@@@@@$!!!!!!?@@@@@@@@&O#&&&&%??$#@@@@@@@@@@
-@@@@@@?!!!!!!?@@@@@O!!!!!!#@$!!!!!!!!!!!!!!!#@%!!!!!!!%@@@@@@O!!!!!!!?@@@@@@@O#@@&%??!!!!!$@@@@@@@@@
-@@@@@@?!!!!!!!O@@@@O!!!!!!#@$!!!!!!?????????&@%!!!!!!!!$@@@@#!!!!!!!!?@@@@@&O&@&&O$$?!!!!!!%&@@@@@@@
-@@@@@@?!!!!!!!!#@@@O!!!!!!#@$!!!!!!#&&&&&&&&@@%!!!!!!!!!$@@&?!!!!!!!!?@@@@@O&@&??&@@&O!!!!!!%@@@@@@@
-@@@@@@?!!!!!!!!?&@@O!!!!!!#@$!!!!!!#@@@@@@@@@@%!!!!!!!!!!O@%!!!!!!!!!?@@@@O&@@O!O@@@@&O!!!!!!$@@@@@@
-@@@@@@?!!!!!!!!!?#@O!!!!!!#@$!!!!!!#@@@@@@@@@@%!!!!!!!!!!!%!!!!!!!!!!?@@@&O@@$!!O&@@@@&O!!!!!!#@@@@@
-@@@@@@?!!!!!!!!!!!OO!!!!!!#@$!!!!!!$OOOOO@@@@@%!!!!!!!!!!!!!!!!!!!!!!?@@@O@&%!!!!!%#&&@&?!!!!!%@@@@@
-@@@@@@?!!!!!!!!!!!!!!!!!!!#@$!!!!!!!!!!!?@@@@@%!!!!!!!!!!!!!!!!!!!!!!?@@@O&!!!!!!%%eO&@$!!!!!!%&@@@@
-@@@@@@?!!!!!!!!!!!!!!!!!!!#@$!!!!!!!!!!!?@@@@@%!!!!!!!!!!!!!!!!!!!!!!?@@&&$!!!?$O$Oe$@@!!!!!!eO#@@@@
-@@@@@@?!!!!!!!!!!!!!!!!!!!#@$!!!!!!?%%%%$@@@@@%!!!!!!!!!!!!!!!!!!!!!!?@@O&!!!!$&$#%!#@@?!!!!!!$O@@@@
-@@@@@@?!!!!!!!!!!!!!!!!!!!#@$!!!!!!#@@@@@@@@@@%!!!!!!!!!!!!!!!!!!!!!!?@@O&!!!!%?O@%&&&@$!!!!!!?O@@@@
-@@@@@@?!!!!!?#!!!!!!!!!!!!#@$!!!!!!#@@@@@@@@@@%!!!!!!#!!!!!!!!O?!!!!!?@@O#!!!!!!?@@@@@OO!!!!$e?O@@@@
-@@@@@@?!!!!!?@#?!!!!!!!!!!#@$!!!!!!#@@@@@@@@@@%!!!!!!&#!!!!!!%&?!!!!!?@@OOO?!!!%%@@@@@#?!%$#O%%$@@@@
-@@@@@@?!!!!!?@@&%!!!!!!!!!#@$!!!!!!?????????&@%!!!!!!&@O!!!!?&@?!!!!!?@@#&##%$&&&@@@@@@$%#&O!??O@@@@
-@@@@@@?!!!!!?@@@@#?!!!!!!!#@$!!!!!!!!!!!!!!!#@%!!!!!!&@@$!!!&@@?!!!!!?@@&#$&@@@@@@@@@@@?O%%?!!!#@@@@
-@@@@@@?!!!!!?@@@@@@#%!!!!!#@$!!!!!!!!!!!!!!!#@%!!!!!!&@@@$!O@@@?!!!!!?@@@O#&&@@@@@@@@@@O?!!!!!?&@@@@
-@@@@@@?!!!!!?@@@@@@@@&O$%%#@#O##&&&&&&&&##OO&@$!!!!!!&@@@@O@@@@?!!!!!?@@@O&&#&@@@@@@@@@$!!!!!!$@@@@@
-@@@@@@?!!!!!?@@@@@@@@@@@@@@&&#O$$$%%%%$$$OO#&@@&#O%?!&@@@@@@@@@?!!!!!?@@@@OOO@@@@@@@@@&!!!!!!!&@@@@@
-@@@@@@?!!!!!?@@@@@@@@@&#$%?!!!!!!!!!!!!!!!!!!!?%O#@@#@@@@@@@@@@?!!!!!?@@@@#!!%&@@@@@@@%!!!!!!O@@@@@@
-@@@@@@?!!!!!?@@@@@@#$?!!!!!!!!!!!!!!!!!!!!!!!!!!!!!%$&@@@@@@@@@?!!!!!?@@@@@#!!%@@@@@@@O!!$&$$@@@@@@@
-@@@@@@?!!!!!?@@@O%!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!?$#@@@@@@?!!!!!?@@@@@@O!!?@@@@@@@&&@#O@@@@@@&&
-@@@@@@?!!!?O&#$?!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!?$#@@@$?!!!!?@@@@@@@&%!?$#@@@@@&O#@@@@@#O&@
-@@@@@@?!?O&#%!!!!!!!!!??%%$$$OOOOOOOOOO$$%%??!!!!!!!!!!!!!!!?%O&&&O$%%@@@@@@@@@#%?%####O#@@@&#$$#@@@
-@@@@@@%O&#%!!!!!?%$O#&&@@@@@@@@@@@@@@@@@@@@@&&#O$%?!!!!!!!!!!!!!?$O&&&@@@@@@@@@@@&&&&&&&&#$%?%#@@@@@
-@@@@@@&#%!!!?$#&&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&&#O%?!!!!!!!!!!!!??%$OOO#######OO$%??!!?%#@@@@@@@
-@@@@@&$!?%O&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&#O$%?!!!!!!!!!!!!!!!!!!!!!!!!!?$#&@@@@@@@@@
-@@@@O?%O&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&#OO$%????!!!!!!!!??%%O#&@@@@@@@@@@@@@
-@@&$$&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&&&&&&&&&@@@@@@@@@@@@@@@@@@@@
-@#O&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-&&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
-</pre>
Index: /branches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST/inc/env.sh
===================================================================
--- /branches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST/inc/env.sh	(revision 8883)
+++ /branches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST/inc/env.sh	(revision 8883)
@@ -0,0 +1,216 @@
+#!/bin/bash
+
+
+##--------------------------------------------------------------------------------
+## Defaults
+##--------------------------------------------------------------------------------
+
+## Trusting result: 'FAILED' result for 'Unknown error'
+export TRUST_FLAG_RESULT='FAILED' TRUST_FLAG_ERROR='X'
+
+## Locked options from command line (export as of now to environment) 
+##-------------------------------------------------------------------
+
+if   [ ${TRUST_FLAG_DEBUG} == 'true' ]; then
+    ## debug mode (skip XIOS compilation    , output stdout & stderr)
+    TRUST_IO_XIOS_MODE=''
+    TRUST_MAIN_STDOUT=''
+elif [ ${TRUST_FLAG_DEV}   == 'true' ]; then
+    ## dev mode   (skip XIOS compilation    , output only stderr    )
+    TRUST_IO_XIOS_MODE=''
+    TRUST_MAIN_STDOUT='1> /dev/null'
+else
+    ## prod mode  (compile XIOS from scratch, no stdout nor stderr  )
+    TRUST_IO_XIOS_MODE='--full'
+    TRUST_MAIN_STDOUT='>& /dev/null'
+fi
+
+export TRUST_IO_XIOS_MODE TRUST_MAIN_STDOUT
+
+## If '-v' arg. has been set, modify default SVN action on working copy
+if [ ${TRUST_SVN_REV} ]; then
+
+    if   [ $( echo ${TRUST_SVN_REV} | grep  "HEAD\|up\|update"                     ) ]; then
+	TRUST_SVN_ACTION='svn update -r HEAD --accept mine-conflict'
+    elif [ $( echo ${TRUST_SVN_REV} | grep -o '{[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}}' ) ]; then
+	TRUST_SVN_ACTION='svn update -r     '$( echo ${TRUST_SVN_REV} | grep -o '{[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}}' )
+    elif [ $( echo ${TRUST_SVN_REV} | grep -o '[0-9]*'                             ) ]; then
+	TRUST_SVN_ACTION='svn update -r     '$( echo ${TRUST_SVN_REV} | grep -o '[0-9]*' )
+    fi
+
+else
+    ## By default, no update on SVN directories
+    TRUST_SVN_ACTION='svn status'
+fi
+
+export TRUST_SVN_ACTION
+
+
+## Options editable by .cfg files (no export at this time)
+##--------------------------------------------------------
+
+## NEMO 'trunk' branch by default
+[ -z "${TRUST_SVN_BRANCH}" ] && TRUST_SVN_BRANCH='trunk'
+
+## Ref. cfg. unset or empty (mandatory)
+if [ -z "${TRUST_CFG_REF}" ]; then
+
+    ## Default cfg from trunk excepting last stable
+    TRUST_CFG_REF='ORCA2_LIM3_PISCES'
+
+    if [[ ${TRUST_SVN_BRANCH}                          \
+	  && ${TRUST_SVN_BRANCH} == 'nemo_v3_6_STABLE'   ]]; then
+	TRUST_CFG_REF='ORCA2_LIM_PISCES'
+    fi
+
+fi
+
+
+##--------------------------------------------------------------------------------
+## Source user & (super)computer configurations
+##--------------------------------------------------------------------------------
+. ./cfg/${TRUST_MAIN_SETUP}.cfg
+. ./cfg/${TRUST_MAIN_HPCC}.cfg
+
+
+##--------------------------------------------------------------------------------
+## Checking and export environment variables
+##--------------------------------------------------------------------------------
+
+## Trusting installation
+## ---------------------
+
+[ -z "${TRUST_DIR_WORK}"    ] &&    TRUST_DIR_WORK=${TRUST_MAIN_DIR}/../CONFIG
+[ -z "${TRUST_DIR_SCRATCH}" ] && TRUST_DIR_SCRATCH=${TRUST_MAIN_DIR}
+export TRUST_DIR_WORK TRUST_DIR_SCRATCH TRUST_DIR_STORE
+
+
+## Branch checkout (./install_new_branch.sh)
+##------------------------------------------
+
+export TRUST_SVN_REPO='https://forge.ipsl.jussieu.fr'
+export TRUST_SVN_CO=( 'ARCH           CONFIG          NEMO              
+                       EXTERNAL/AGRIF EXTERNAL/fcm    EXTERNAL/IOIPSL   
+                       TOOLS/COMPILE  TOOLS/maketools TOOLS/REBUILD_NEMO
+                       TRUST                                            ' )
+export TRUST_SVN_UP=( 'ARCH           CONFIG          NEMO           
+                       EXTERNAL/AGRIF EXTERNAL/fcm    EXTERNAL/IOIPSL
+                       TOOLS/COMPILE                                 ' )
+
+export TRUST_SVN_BRANCH
+export TRUST_SVN_NEMOGCM=${TRUST_DIR_WORK}/${TRUST_SVN_BRANCH}/NEMOGCM
+
+
+## NEMO Configuration
+##-------------------
+
+[ -z "${TRUST_CFG_NEW}" ] && TRUST_CFG_NEW=${TRUST_CFG_REF}'_trust'
+export TRUST_CFG_NEW TRUST_CFG_REF
+export TRUST_CFG_KEY_ADD TRUST_CFG_KEY_DEL
+
+
+## Inputs/Outputs
+## --------------
+
+[ -z "${TRUST_IO_XIOS}" ] && get_out A
+export TRUST_IO_XIOS
+
+## Forcing directory set and not empty
+if [ ${TRUST_IO_FORC_PATH} ]; then
+
+    ## Forcing archive unset
+    if [[ ! ${TRUST_IO_FORC_TAR} && ${TRUST_IO_FORC_TAR-_} ]]; then
+
+	## Default forcing archive from trunk
+	TRUST_IO_FORC_TAR='ORCA2_LIM_nemo_v3.7.tar INPUTS_PISCES_v3.6st.tar'
+	[ ${TRUST_CFG_REF} == 'AMM12' ] && TRUST_IO_FORC_TAR='AMM12_v3.7.tar'
+
+	## Update forcing archive for stable
+	if [ ${TRUST_SVN_BRANCH} == 'nemo_v3_6_STABLE' ]; then
+	    TRUST_IO_FORC_TAR='ORCA2_LIM_nemo_v3.6.tar'
+
+	    if   [ ${TRUST_CFG_REF} == 'ORCA1_LIM3_PISCES' ]; then
+		TRUST_IO_FORC_TAR='INPUTS_ORCA1_LIM3_PISCES_V10.tar'
+	    elif [ ${TRUST_CFG_REF} == 'AMM12'             ]; then
+		TRUST_IO_FORC_TAR='AMM12_v3.6.tar'
+	    fi
+
+	fi
+
+    fi
+
+fi
+
+export TRUST_IO_FORC_PATH TRUST_IO_FORC_TAR
+export TRUST_IO_CDO
+
+
+## Compilation
+##------------
+
+## Assuming the sourcing of XIOS arch .env file (modules) for setting 
+if [ -z "${TRUST_JOB_ENV}" ]; then
+    TRUST_JOB_ENV=${TRUST_IO_XIOS}/arch/arch-${TRUST_MAIN_HPCC}.env
+fi
+
+export TRUST_JOB_ENV
+
+## Default parallel compilation on 4 procs
+[ -z "${TRUST_COMPILE_NPROC}" ] && TRUST_COMPILE_NPROC='4'
+export TRUST_COMPILE_NPROC
+
+## Not mandatory
+export TRUST_COMPILE_FORTRAN TRUST_COMPILE_MPI TRUST_COMPILE_NETCDF
+
+
+## Running
+##--------
+
+## Assuming the job submit script is in './batch', if not 
+if [ -z "${TRUST_JOB_SCRIPT}" ]; then
+    TRUST_JOB_SCRIPT=${TRUST_MAIN_DIR}/batch/${TRUST_MAIN_HPCC}.sh || get_out A
+fi
+
+export TRUST_JOB_SCRIPT 
+
+## Mandatory job management cmds (submit, status checking and killing job)
+if [[ -z "${TRUST_JOB_SUBMIT}" || -z "${TRUST_JOB_STATE}" \
+                               || -z "${TRUST_JOB_KILL}"    ]]; then
+    get_out A
+fi
+
+export TRUST_JOB_SUBMIT TRUST_JOB_STATE TRUST_JOB_KILL
+
+## Default test timeout to 3h (pending AND running time)
+[ -z "${TRUST_JOB_TIMEOUT}" ] && TRUST_JOB_TIMEOUT='10800'
+export TRUST_JOB_TIMEOUT
+
+## Job informations not mandatory
+export TRUST_JOB_INFO TRUST_JOB_TIME TRUST_JOB_RAM_P TRUST_JOB_RAM_V
+
+
+## Trusting test
+##--------------
+
+export TRUST_TEST_NAME=${TRUST_MAIN_SETUP}'_'${TRUST_MAIN_HPCC}
+export TRUST_TEST_DATE=$( date -u +"%Y%m%d%Z%H%M" )
+
+export TRUST_TEST_SUMMARY=trusting_${TRUST_TEST_DATE}_${TRUST_TEST_NAME}.txt
+export  TRUST_TEST_BACKUP=trusting_${TRUST_TEST_DATE}_${TRUST_TEST_NAME}.tgz
+
+##       TRUST_TEST_DIR unset
+if [[ ! ${TRUST_TEST_DIR}       && ${TRUST_TEST_DIR-_}       ]]; then
+        TRUST_TEST_DIR=${TRUST_DIR_SCRATCH}/${TRUST_CFG_REF}/${TRUST_SVN_BRANCH}
+        TRUST_TEST_DIR+=/${TRUST_TEST_DATE}
+    export TRUST_TEST_DIR
+fi
+
+## TRUST_TEST_BENCHMARK unset
+if [[ ! ${TRUST_TEST_BENCHMARK} && ${TRUST_TEST_BENCHMARK-_} ]]; then
+    TRUST_TEST_BENCHMARK=${TRUST_DIR_STORE}/${TRUST_CFG_REF}/${TRUST_SVN_BRANCH}
+    export TRUST_TEST_BENCHMARK
+fi
+
+export TRUST_TEST_LOG=${TRUST_TEST_BENCHMARK}/trusting_${TRUST_TEST_NAME}.txt
+
+export TRUST_TEST_MAILING
Index: /branches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST/inc/functions.sh
===================================================================
--- /branches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST/inc/functions.sh	(revision 8883)
+++ /branches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST/inc/functions.sh	(revision 8883)
@@ -0,0 +1,626 @@
+#!/bin/bash
+
+
+##--------------------------------------------------------------------------------
+## Messenger filenames
+##--------------------------------------------------------------------------------
+
+file_date=mesg_01_date.txt  ; file_rslt=mesg_02_result.txt
+file_stat=mesg_03_status.txt; file_nemo=mesg_04_nemo.txt
+file_xios=mesg_05_xios.txt  ; file_cmpf=mesg_06_compiler.txt
+file_lmpi=mesg_07_mpi.txt   ; file_ncdf=mesg_08_netcdf.txt
+file_inpt=mesg_09_inputs.txt; file_time=mesg_10_time.txt
+file_memy=mesg_11_memory.txt; file_note=mesg_12_comments.txt
+
+
+##--------------------------------------------------------------------------------
+## Functions in order of use
+##--------------------------------------------------------------------------------
+
+display_help() {
+    cat ./inc/trusting_help.txt
+}
+
+step() {
+    local char_nb=$( echo "$1" | wc -c )
+    local outline=$( printf "%${char_nb}s" )
+
+    printf "\n%s\n%s\n\n" "$1" ${outline// /-}
+}
+
+
+##
+##--------------------------------------------------------------------------------
+
+init() {
+    mkdir -p ${TRUST_TEST_DIR} ${TRUST_TEST_BENCHMARK} || get_out B
+    cd       ${TRUST_TEST_DIR}
+    echo     ${TRUST_TEST_DIR}
+
+    echo 'Date'        	    > ${file_date}; echo 'Result'   > ${file_rslt}
+    echo 'Status'      	    > ${file_stat}; echo 'NEMOGCM'  > ${file_nemo}
+    echo 'XIOS'   	    > ${file_xios}; echo 'Fortran'  > ${file_cmpf}
+    echo 'MPI'    	    > ${file_lmpi}; echo 'NetCDF'   > ${file_ncdf}
+    echo 'Inputs' 	    > ${file_inpt}; echo 'Time'     > ${file_time}
+    echo 'RAM (Phy./Virt.)' > ${file_memy}; echo 'Comments' > ${file_note}
+
+    ## 'FAILED' status with 'Unknown error' by default
+    echo ${TRUST_FLAG_RESULT} \
+	>> ${file_rslt}
+    echo 'Unknown error' \
+	>> ${file_stat}
+
+    ## UTC time zone for timestamping
+    local dat=$( date -ud "${TRUST_TEST_DATE}" +"%F %R %Z" )
+
+    echo $dat           \
+	>> ${file_date}
+}
+
+
+##
+##--------------------------------------------------------------------------------
+
+get_nemo_rev() {
+    local dir rev_loc
+    local rev=0
+
+    ## Loop on essential NEMO directories
+    for dir in ${TRUST_SVN_UP}; do
+
+	echo $dir && ${TRUST_SVN_ACTION} ${TRUST_SVN_NEMOGCM}/$dir || get_out C
+	rev_loc=$( svn info ${TRUST_SVN_NEMOGCM}/$dir         \
+	               | awk '/Last Changed Rev/ {print $NF}'   )
+
+	## Keep last rev. nb
+	[ ${rev_loc} -gt $rev ] && rev=${rev_loc}
+    done
+
+    echo 'NEMOGCM '$rev \
+	>> model.log
+    echo "<a href=\"${TRUST_SVN_REPO}/nemo/changeset/$rev\" target=\"_blank\">$rev</a>" \
+	>> ${file_nemo}
+}
+
+
+##
+##--------------------------------------------------------------------------------
+
+get_soft_rel() {
+    local ver str
+
+    ## Sourcing environment
+    . ${TRUST_JOB_ENV} >& /dev/null
+
+    for str in ${TRUST_COMPILE_FORTRAN}                         \
+	       ${TRUST_COMPILE_MPI}     ${TRUST_COMPILE_NETCDF} \
+	       ${TRUST_IO_CDO}                                    ; do
+	[ -z "$str" ] && continue
+	ver=''
+
+	## Extract version number after searching pattern in PATH env. variable
+	ver=$( echo $PATH | sed "s|.*\($str[0-9.]*\).*|\1|" )
+
+	## option --version would work for main Fortran compilers and CDO
+	if [[ $str =~ ${TRUST_COMPILE_FORTRAN}|${TRUST_IO_CDO} ]]; then
+	    ver=$( $str --version 2>&1 | grep -m1 -oe '\<[0-9. ]*\>' \
+		       | xargs echo $str                               )
+	fi
+
+	## Cleaning characters string to display proper soft name
+	ver=$( echo $ver | sed 's|[/-]| |g' )
+
+	echo $ver        \
+	    >> model.log
+    done
+
+    sed -n 2p model.log \
+	>> ${file_cmpf}
+    sed -n 3p model.log \
+	>> ${file_lmpi}
+    sed -n 4p model.log \
+	>> ${file_ncdf}
+
+    cat model.log | awk '{printf "%-20s %s %s\n", $1, $2, $3}'
+    env | sort > env.log
+}
+
+
+##
+##--------------------------------------------------------------------------------
+
+compile_xios() {
+    cd ${TRUST_IO_XIOS}
+
+    rev=$( svn info | awk '/Last Changed Rev/ {print $NF}' )
+    printf 'XIOS                 branch %s rev. %s\n' \
+	$( basename ${TRUST_IO_XIOS} ) $rev           \
+	| tee -a ${TRUST_TEST_DIR}/model.log
+    echo "<a href=\"${TRUST_SVN_REPO}/ioserver/changeset/$rev target=\"_blank\">$rev</a>" \
+	>> ${TRUST_TEST_DIR}/${file_xios}
+
+    eval "
+    ./make_xios ${TRUST_IO_XIOS_MODE} --arch ${TRUST_MAIN_HPCC}     \
+	                              --job  ${TRUST_COMPILE_NPROC} \
+	${TRUST_MAIN_STDOUT}
+    "
+
+    [ ! -e ./lib/libxios.a ] && get_out D || echo 'Success'
+}
+
+
+##
+##--------------------------------------------------------------------------------
+
+compile_nemo() {
+    cd ${TRUST_SVN_NEMOGCM}/CONFIG
+
+    ## Recompiling from scratch if not in debug or dev mode
+    if [[ ${TRUST_FLAG_DEBUG} == 'false' && ${TRUST_FLAG_DEV} == 'false' ]]; then
+
+	  if [[ -d ${TRUST_CFG_NEW} ]]; then
+	      ./makenemo -n ${TRUST_CFG_NEW} clean_config \
+	      > /dev/null <<EOF
+y
+EOF
+	  fi
+
+    fi
+
+    eval "
+    ./makenemo -n ${TRUST_CFG_NEW}   -r ${TRUST_CFG_REF}       \
+               -m ${TRUST_MAIN_HPCC} -j ${TRUST_COMPILE_NPROC} \
+               ${TRUST_CFG_KEY_ADD} ${TRUST_CFG_KEY_DEL}       \
+	${TRUST_MAIN_STDOUT}
+    "
+
+    [ ! -e ./${TRUST_CFG_NEW}/BLD/bin/nemo.exe ] && get_out E || echo 'Success'
+}
+
+
+##
+##--------------------------------------------------------------------------------
+
+get_inputs() {
+    cd ${TRUST_TEST_DIR}
+
+    ## Test forcing directory
+    if [[ ! ${TRUST_IO_FORC_PATH} && ${TRUST_IO_FORC_PATH-_} ]]; then
+
+	echo 'No forcing files needed'
+
+    else
+
+	## Test forcing archive
+	if [ -n "${TRUST_IO_FORC_TAR}" ]; then
+
+	    echo 'Forcing archive(s): '${TRUST_IO_FORC_TAR}
+
+	    # List archive content & extract it by default
+	    local inputs_list="
+            for archive in \${TRUST_IO_FORC_TAR}; do
+		tar -tvf \${TRUST_IO_FORC_PATH}/\$archive >> inputs_list.txt;
+            done
+            "
+	    local inputs_get="
+            for archive in \${TRUST_IO_FORC_TAR}; do
+		tar -vxf \${TRUST_IO_FORC_PATH}/\$archive  >       /dev/null;
+            done
+            "
+
+	else
+
+	    echo 'Forcing directory: '${TRUST_IO_FORC_PATH}
+
+	    ## List & copy files without archive
+            local inputs_list=" ls -lh \${TRUST_IO_FORC_PATH}/* >> inputs_list.txt"
+            local inputs_get=" \cp     \${TRUST_IO_FORC_PATH}/* .                 "
+	fi
+
+    fi
+
+    eval ${inputs_list}
+    eval ${inputs_get}
+
+    if [ $( find -name '*.gz' -print -quit ) ]; then
+	find . -name '*.gz' -exec gzip -d {} \;
+    fi
+
+    cp   ${TRUST_SVN_NEMOGCM}/CONFIG/${TRUST_CFG_NEW}/cpp_* .
+    find ${TRUST_SVN_NEMOGCM}/CONFIG/${TRUST_CFG_NEW}/EXP00 \
+ 	 -regex '.*\(_cfg\|.in\|opa\|_ref\|.xml\)'          \
+	 -exec  cp {} . \;
+}
+
+
+##
+##--------------------------------------------------------------------------------
+
+diff_inputs() {
+    local dif file
+    local files_list='' mesg='Same' 
+
+    ###################################
+    ## Think of copying initial test ##
+    ###################################
+
+    ## Simple diff
+    for file in cpp_* 'inputs_list.txt' *namelist_* *.xml; do
+	dif=''
+
+	## Continue even if input file is not in here (see after)
+	if [ -e ${TRUST_TEST_BENCHMARK}/$file ]; then
+	    dif=$( diff -q $file ${TRUST_TEST_BENCHMARK}/$file )
+	else 
+	    dif=0
+	fi
+
+	## Pass over useless file omission in benckmark directory
+	if [[ -n "$dif" && "$dif" != '0' ]]; then
+	    mesg='Different'
+	    echo $dif
+	    files_list+=$file' '
+	fi
+
+    done
+
+    [ $mesg == 'Same' ] && echo $mesg
+    echo $mesg          \
+	>> ${file_inpt}
+
+    ## List different files for web comment
+    [ -n "${files_list}" ] && echo 'Inputs  : '${files_list}'differ<br>' \
+	>> temp_${file_note}
+}
+
+
+##
+##--------------------------------------------------------------------------------
+
+job_submit() {
+    ## Copy the submitting script to testing folder
+    cp ${TRUST_JOB_SCRIPT} ${TRUST_TEST_DIR}
+
+    TRUST_JOB_ID=$( eval ${TRUST_JOB_SUBMIT} )
+    [ $? -ne 0 ] && get_out G || printf "Success (job ID %s)\n" ${TRUST_JOB_ID}
+}
+
+
+##
+##--------------------------------------------------------------------------------
+
+job_pending() {
+    local outline=$( printf "%100s" ) time_elapsed=0 time_increment=30
+
+    sleep ${time_increment}
+
+    ## Append a log file while pending
+    while [[ $( eval ${TRUST_JOB_STATE} )                \
+	     && ${time_elapsed} -lt ${TRUST_JOB_TIMEOUT}   ]]; do
+	printf "\n%s\n" ${outline// /#} \
+	    >> computation.log
+	[ -n "${TRUST_JOB_INFO}" ] && eval ${TRUST_JOB_INFO} \
+	    >> computation.log
+	sleep ${time_increment}
+	time_elapsed=$(( ${time_elapsed} + ${time_increment} ))
+    done
+
+    sleep ${time_increment}
+
+    ## Kill remaining job & stop the test if it's too long
+    if [ ${time_elapsed} -eq ${TRUST_JOB_TIMEOUT} ]; then
+	eval ${TRUST_JOB_KILL} &> /dev/null
+	get_out I
+    fi
+
+}
+
+
+##
+##--------------------------------------------------------------------------------
+
+job_perfs() {
+    if [ -n "${TRUST_JOB_TIME}" ]; then
+
+    ## Interest for checking unusual time computation
+	local time_cpu=$( eval ${TRUST_JOB_TIME} )
+
+	printf "Time: "
+	echo ${time_cpu} | tee -a ${file_time}
+
+    fi
+
+    if [[ -n "${TRUST_JOB_RAM_P}" && -n "${TRUST_JOB_RAM_V}" ]]; then
+
+    ## Interest for checking unusual memory usage
+	local memory_pmax=$( eval ${TRUST_JOB_RAM_P} )
+	local memory_vmax=$( eval ${TRUST_JOB_RAM_V} )
+
+	printf "Max memory usage (physical/virtual): "
+	echo ${memory_pmax}' / '${memory_vmax} | tee -a ${file_memy}
+    fi
+}
+
+
+##
+##--------------------------------------------------------------------------------
+
+job_state() {
+    if [[ ! -e time.step || $( grep 'E R R O R' ocean.output ) ]]; then
+	get_out H
+    else
+	echo 'Success' ## Must be reviewed
+    fi
+}
+
+
+##
+##--------------------------------------------------------------------------------
+
+diff_results() {
+    local file
+    local files_list='' mesg='Same'
+
+    ###################################
+    ## Think of copying initial test ##
+    ###################################
+
+    ## Now test is good by default ('OK')
+    TRUST_FLAG_RESULT='OK'
+
+    ## Simple diff
+    for file in 'ocean.output' *.stat; do
+	## Stop if no minimal benchmark files (ocean.output, eventual stat files)
+	[ ! -e ${TRUST_TEST_BENCHMARK}/$file ] && get_out J
+
+	diff -q $file ${TRUST_TEST_BENCHMARK}/$file
+
+	## Continue even if it differs
+	if [ $? -ne 0 ]; then mesg='Different'; files_list+=$file' '; fi
+
+    done
+
+    [ $mesg == 'Same' ] && echo $mesg
+
+    ## List different files for web comment
+    [ -n "${files_list}" ] && echo 'Results : '${files_list}'differ<br>' \
+	>> temp_${file_note}
+}
+
+
+##
+##--------------------------------------------------------------------------------
+
+diff_restarts() {
+    local dif filebase filebases ndomain out
+    local files_list='' dif_sum='0'
+
+    ## Find all restart files to rebuild
+    if [ $( find -regex ".*_restart.*[0-9]\.nc" -print -quit ) ]; then
+        ###############################################################
+	## Think to set the configuration name in the 'namelist_cfg' ##
+	###############################################################
+	filebases=$( find -regextype sed -regex ".*${TRUST_CFG_NEW}.*_[0-9]\{4\}\.nc" \
+	                 | sed 's/\(.*\)_.*/\1/' | sort -u                              )
+
+	for filebase in $filebases; do
+
+	    ndomain=$( find -regex ".*${filebase}_[0-9]*.nc" \
+		           | wc -l | awk '{print $1}'          )
+
+            #####################################################
+            ## Handle 2 possibilities of 'rebuild_nemo' origin ##
+            #####################################################
+
+	    ${TRUST_SVN_NEMOGCM}/TOOLS/REBUILD_NEMO/rebuild_nemo \
+		-t ${TRUST_COMPILE_NPROC} $filebase $ndomain       \
+		> /dev/null
+
+	    ## Possibility of remaining decomposed restarts (even after rebuild)
+	    if [ $? -eq 0 ]; then
+		rm -f ${filebase}_[0-9]*.nc \
+                    > /dev/null
+	    else
+		get_out K
+	    fi
+
+            ## Stop if no benchmark files (restart file)
+	    if [ -e ${TRUST_TEST_BENCHMARK}/$filebase.nc ]; then
+
+		cdo diffn $filebase.nc ${TRUST_TEST_BENCHMARK}/$filebase.nc \
+		    > cdo_diff.out 2> /dev/null
+
+		## Identical if cdo_diff.out is zero size
+		[ ! -s cdo_diff.out ] && continue
+
+		dif=$( grep -om1 '[0-9]* of [0-9]* records' cdo_diff.out )
+
+		if [ -n "$dif" ]; then
+		    files_list+=$filebase' ' && echo $filebase'.nc: '$dif
+		    let dif_sum+=$( echo $dif | sed '|^\([0-9]*\).*|\1|' )
+		fi
+
+	    fi
+
+	done
+
+        ## List modified restart(s) for web comment with sum of differences
+	if [ ${dif_sum} -ne 0 ]; then
+	    echo 'Restarts: '${files_list}${dif_sum}' record(s) differ<br>' \
+		>> temp_${file_note}
+	else
+	    echo 'Same'
+	fi
+
+    fi
+
+    [ $TRUST_FLAG_RESULT == 'FAILED' ] && get_out L
+}
+
+
+##
+##--------------------------------------------------------------------------------
+
+comments() {
+    local opat
+    local line='' state=$1
+
+    if [ -e ocean.output ]; then
+        ## 'W A R N I N G' pattern by default
+	opat="-A2 \"^ $state\""
+	[ "$state" == 'E R R O R' ] && opat="-A4 \"$state\""
+
+        ## Select first occurence for web comment
+	line=$( eval grep -m1 $opat ocean.output | tr -d '\n' )
+    fi
+
+    [ -n "$line" ] && ( echo $line; printf "$line<br>" \
+	>> temp_${file_note} )
+}
+
+
+##
+##--------------------------------------------------------------------------------
+
+log_make() {
+    ## Format comments for web
+    if [ -e temp_${file_note} ]; then
+	cat temp_${file_note} | tr -d '\n' | sed 's/<br>$//' \
+	    >> ${file_note}
+    fi
+
+    ## Construct txt file with all messenger files
+    paste -d ';' mesg_*.txt | tee ${TRUST_TEST_SUMMARY}
+}
+
+
+##
+##--------------------------------------------------------------------------------
+
+prod_publish() {
+    local cmd
+    local rev=$( awk '/NEMOGCM/ {print $NF}' model.log )
+
+    ## Production mode (-p|--prod)
+    if [ ${TRUST_FLAG_PROD} == 'true' ]; then
+
+	## Create or append trusting logfile
+	if [ -f ${TRUST_TEST_LOG} ]; then cmd='tail -1'; else cmd='cat'; fi
+
+	$cmd ${TRUST_TEST_SUMMARY} \
+	    >> ${TRUST_TEST_LOG}
+
+        ## Send mail only when FAILED
+	if [[ -n "${TRUST_TEST_MAILING}"          \
+	      && ${TRUST_FLAG_RESULT} == 'FAILED'   ]]; then
+
+	    ## Content
+	    cat <<END_MAIL      \
+		> trusting.mail
+Dear all,
+
+
+The following trusting sequence has not completed successfully:
+
+Testing configuration ${TRUST_CFG_NEW} based on ${TRUST_CFG_REF}.
+User installation ${TRUST_MAIN_SETUP}
+HPC environment ${TRUST_MAIN_HPCC}
+
+Here is the running environment summary:
+`cat model.log`
+
+For more details, look into the testing folder at:
+${TRUST_TEST_DIR}
+An archive is also available to share the questionable configuration:
+${TRUST_TEST_BENCHMARK}/${TRUST_TEST_BACKUP}
+
+END_MAIL
+
+	    ## Send with detailed subject
+	    mail -s "[NEMO Trusting][${TRUST_CFG_REF}][${TRUST_SVN_BRANCH}] \
+		     ${TRUST_FLAG_RESULT} ${TRUST_FLAG_ERROR}"              \
+		 ${TRUST_TEST_MAILING}                                      \
+		<  trusting.mail
+	fi
+
+    fi
+}
+
+
+##
+##--------------------------------------------------------------------------------
+
+get_out() {
+    local time_step=0
+
+    TRUST_FLAG_ERROR=$1
+
+    printf "\n\nEnd of test\n"
+
+    ## In case of compilation error
+    cd ${TRUST_TEST_DIR}
+
+    if [ ${TRUST_FLAG_RESULT} == 'FAILED' ]; then
+	echo 'Failure'
+
+        ## Error identification
+	case ${TRUST_FLAG_ERROR} in
+
+	    ## Initialisation
+	    'A') TRUST_FLAG_ERROR='Missing environment variable'      ;;
+	    'B') TRUST_FLAG_ERROR='Unable to create testing directory';;
+	    'C') TRUST_FLAG_ERROR='SVN issue on local working copy'   ;;
+
+            ## Compilation
+	    'D') TRUST_FLAG_ERROR='XIOS compilation failed'           ;;
+	    'E') TRUST_FLAG_ERROR='NEMO compilation failed'           ;;
+
+	    ## Submission
+	    'F') TRUST_FLAG_ERROR='Missing input files'               ;;
+	    'G') TRUST_FLAG_ERROR='Job submission error'              ;;
+
+	    ## Computing
+	    'H') TRUST_FLAG_ERROR='Crashed at time step '
+		comments 'E R R O R'
+		[ -e time.step ] && time_step=$( cat time.step )
+		TRUST_FLAG_ERROR+=${time_step:=0}                     ;;
+	    'I') TRUST_FLAG_ERROR='Exceeded time limit of '
+		TRUST_FLAG_ERROR+=$(( ${TRUST_JOB_TIMEOUT}/3600 ))'h' ;;
+
+	    ## Results
+	    'J') TRUST_FLAG_ERROR='Missing previous outputs'          ;;
+	    'K') TRUST_FLAG_ERROR='Restart rebuild error'             ;;
+	    'L') TRUST_FLAG_ERROR='New outputs differ'                ;;
+
+	    ## Other
+	    '*') TRUST_FLAG_ERROR='Unknown error'                     ;;
+
+	esac
+
+    else
+	echo 'Success' && TRUST_FLAG_ERROR='Code is reliable'
+    fi
+
+    ## Eventual comments from ocean.output
+    [[ ! ${TRUST_FLAG_ERROR} =~ 'Crashed at time step' ]] && comments 'W A R N I N G'
+
+    ## Last messenger files
+    sed -i "2 s/.*/$TRUST_FLAG_RESULT/" ${file_rslt}
+    sed -i "2 s/.*/$TRUST_FLAG_ERROR/"  ${file_stat}
+
+    ## Save tested configuration if trusting failed in production mode ('-p')
+    if [[ ${TRUST_FLAG_RESULT} == 'FAILED' && ${TRUST_FLAG_PROD} == 'true' ]]; then
+	echo 'Creating archive '${TRUST_TEST_BACKUP}' under '${TRUST_TEST_BENCHMARK}
+	tar -czf ${TRUST_TEST_BENCHMARK}/${TRUST_TEST_BACKUP}                 * \
+	    -C   ${TRUST_SVN_NEMOGCM}/CONFIG/${TRUST_CFG_NEW}/MY_SRC . \
+	    -C   ${TRUST_SVN_NEMOGCM}/CONFIG/${TRUST_CFG_NEW}          \
+	         cpp_${TRUST_CFG_NEW}.fcm
+    fi
+
+    ## Logfile construct & eventual sending of notification email
+    printf "\nTrusting digest:\n----------------\n"
+    log_make
+    prod_publish
+
+    exit 0
+}
Index: /branches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST/inc/help.txt
===================================================================
--- /branches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST/inc/help.txt	(revision 8883)
+++ /branches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST/inc/help.txt	(revision 8883)
@@ -0,0 +1,40 @@
+
+./trusting.sh            Launch trusting test on $ARCH machine from $USER installation
+./install_new_branch     Install new branch in $USER installation for trusting test on $ARCH machine
+
+Examples: `./trusting.sh        -u romr005 -m X64_CURIE -p -b nemo_v3_6_STABLE`
+          `./install_new_branch -u romr005 -m X64_ADA   -w $HOME/NEMO         `
+
+Mandatory
+    Default settings to source in ./config, templates (arch_template.cfg & user_template.cfg)
+    -m,--machine      Architecture environment (compilation & computation settings)
+    -u,--user         User             ""      (NEMO & XIOS installation)		   
+
+
+Options (modify default settings)
+SVN
+    -b,--branch	      Branch name in working directory ('trunk'|'nemo_v3_6_stable'|...)
+    -v,--version      Action on working copy ('status' by default)
+  		           '{'YYYY-MM-DD'}'  Update to revision available at this date
+		           [0-9]*	       ""   ""    ""    number
+		           HEAD|up|update      ""   "" last revision
+		           st|status	     Show differences with repository
+    -w,--workdir      Installation directory for testing branches
+
+Inputs
+    -a,--archive      Forcing input files archive to extract, if void it will copy all files from given folder (see next line)
+    -f,--forcdir      Path to your personal folder of forcing inputs
+
+Testing configuration
+    -n,--new_conf     Testing   configuration folder created in ./CONFIG
+    -r,--ref_conf     Reference      " "      for trusting test
+
+Compiling & computation
+    -j,--job          Number of processes for compiling
+    -t,--time         Timeout for computation (s)
+
+Trusting output
+    -d,--debug        Verbose output for debugging purpose (`set -vx`)
+    -e,--email        Email trusting digest report to following addresses only on failure
+    -h,--help         Print this help & exit
+    -p,--prod         Production mode (append trusting logfile)
Index: anches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST/inc/trusting.env
===================================================================
--- /branches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST/inc/trusting.env	(revision 8882)
+++ 	(revision )
@@ -1,216 +1,0 @@
-#!/bin/bash
-
-
-##--------------------------------------------------------------------------------
-## Defaults
-##--------------------------------------------------------------------------------
-
-## Trusting result: 'FAILED' result for 'Unknown error'
-export TRUST_FLAG_RESULT='FAILED' TRUST_FLAG_ERROR='X'
-
-## Locked options from command line (export as of now to environment) 
-##-------------------------------------------------------------------
-
-if   [ ${TRUST_FLAG_DEBUG} == 'true' ]; then
-    ## debug mode (skip XIOS compilation    , output stdout & stderr)
-    TRUST_IO_XIOS_MODE=''
-    TRUST_MAIN_STDOUT=''
-elif [ ${TRUST_FLAG_DEV}   == 'true' ]; then
-    ## dev mode   (skip XIOS compilation    , output only stderr    )
-    TRUST_IO_XIOS_MODE=''
-    TRUST_MAIN_STDOUT='1> /dev/null'
-else
-    ## prod mode  (compile XIOS from scratch, no stdout nor stderr  )
-    TRUST_IO_XIOS_MODE='--full'
-    TRUST_MAIN_STDOUT='>& /dev/null'
-fi
-
-export TRUST_IO_XIOS_MODE TRUST_MAIN_STDOUT
-
-## If '-v' arg. has been set, modify default SVN action on working copy
-if [ ${TRUST_SVN_REV} ]; then
-
-    if   [ $( echo ${TRUST_SVN_REV} | grep  "HEAD\|up\|update"                     ) ]; then
-	TRUST_SVN_ACTION='svn update -r HEAD --accept mine-conflict'
-    elif [ $( echo ${TRUST_SVN_REV} | grep -o '{[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}}' ) ]; then
-	TRUST_SVN_ACTION='svn update -r     '$( echo ${TRUST_SVN_REV} | grep -o '{[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}}' )
-    elif [ $( echo ${TRUST_SVN_REV} | grep -o '[0-9]*'                             ) ]; then
-	TRUST_SVN_ACTION='svn update -r     '$( echo ${TRUST_SVN_REV} | grep -o '[0-9]*' )
-    fi
-
-else
-    ## By default, no update on SVN directories
-    TRUST_SVN_ACTION='svn status'
-fi
-
-export TRUST_SVN_ACTION
-
-
-## Options editable by .cfg files (no export at this time)
-##--------------------------------------------------------
-
-## NEMO 'trunk' branch by default
-[ -z "${TRUST_SVN_BRANCH}" ] && TRUST_SVN_BRANCH='trunk'
-
-## Ref. cfg. unset or empty (mandatory)
-if [ -z "${TRUST_CFG_REF}" ]; then
-
-    ## Default cfg from trunk excepting last stable
-    TRUST_CFG_REF='ORCA2_LIM3_PISCES'
-
-    if [[ ${TRUST_SVN_BRANCH}                          \
-	  && ${TRUST_SVN_BRANCH} == 'nemo_v3_6_STABLE'   ]]; then
-	TRUST_CFG_REF='ORCA2_LIM_PISCES'
-    fi
-
-fi
-
-
-##--------------------------------------------------------------------------------
-## Source user & (super)computer configurations
-##--------------------------------------------------------------------------------
-. ./cfg/${TRUST_MAIN_USER}.cfg
-. ./cfg/${TRUST_MAIN_HPCC}.cfg
-
-
-##--------------------------------------------------------------------------------
-## Checking and export environment variables
-##--------------------------------------------------------------------------------
-
-## Trusting installation
-## ---------------------
-
-[ -z "${TRUST_DIR_WORK}"    ] &&    TRUST_DIR_WORK=${TRUST_MAIN_DIR}/../CONFIG
-[ -z "${TRUST_DIR_SCRATCH}" ] && TRUST_DIR_SCRATCH=${TRUST_MAIN_DIR}
-export TRUST_DIR_WORK TRUST_DIR_SCRATCH TRUST_DIR_STORE
-
-
-## Branch checkout (./install_new_branch.sh)
-##------------------------------------------
-
-export TRUST_SVN_REPO='https://forge.ipsl.jussieu.fr'
-export TRUST_SVN_CO=( 'ARCH           CONFIG          NEMO              
-                       EXTERNAL/AGRIF EXTERNAL/fcm    EXTERNAL/IOIPSL   
-                       TOOLS/COMPILE  TOOLS/maketools TOOLS/REBUILD_NEMO
-                       TRUST                                            ' )
-export TRUST_SVN_UP=( 'ARCH           CONFIG          NEMO           
-                       EXTERNAL/AGRIF EXTERNAL/fcm    EXTERNAL/IOIPSL
-                       TOOLS/COMPILE                                 ' )
-
-export TRUST_SVN_BRANCH
-export TRUST_SVN_NEMOGCM=${TRUST_DIR_WORK}/${TRUST_SVN_BRANCH}/NEMOGCM
-
-
-## NEMO Configuration
-##-------------------
-
-[ -z "${TRUST_CFG_NEW}" ] && TRUST_CFG_NEW=${TRUST_CFG_REF}'_trust'
-export TRUST_CFG_NEW TRUST_CFG_REF
-export TRUST_CFG_KEY_ADD TRUST_CFG_KEY_DEL
-
-
-## Inputs/Outputs
-## --------------
-
-[ -z "${TRUST_IO_XIOS}" ] && get_out A
-export TRUST_IO_XIOS
-
-## Forcing directory set and not empty
-if [ ${TRUST_IO_FORC_PATH} ]; then
-
-    ## Forcing archive unset
-    if [[ ! ${TRUST_IO_FORC_TAR} && ${TRUST_IO_FORC_TAR-_} ]]; then
-
-	## Default forcing archive from trunk
-	TRUST_IO_FORC_TAR='ORCA2_LIM_nemo_v3.7.tar INPUTS_PISCES_v3.6st.tar'
-	[ ${TRUST_CFG_REF} == 'AMM12' ] && TRUST_IO_FORC_TAR='AMM12_v3.7.tar'
-
-	## Update forcing archive for stable
-	if [ ${TRUST_SVN_BRANCH} == 'nemo_v3_6_STABLE' ]; then
-	    TRUST_IO_FORC_TAR='ORCA2_LIM_nemo_v3.6.tar'
-
-	    if   [ ${TRUST_CFG_REF} == 'ORCA1_LIM3_PISCES' ]; then
-		TRUST_IO_FORC_TAR='INPUTS_ORCA1_LIM3_PISCES_V10.tar'
-	    elif [ ${TRUST_CFG_REF} == 'AMM12'             ]; then
-		TRUST_IO_FORC_TAR='AMM12_v3.6.tar'
-	    fi
-
-	fi
-
-    fi
-
-fi
-
-export TRUST_IO_FORC_PATH TRUST_IO_FORC_TAR
-export TRUST_IO_CDO
-
-
-## Compilation
-##------------
-
-## Assuming the sourcing of XIOS arch .env file (modules) for setting 
-if [ -z "${TRUST_JOB_ENV}" ]; then
-    TRUST_JOB_ENV=${TRUST_IO_XIOS}/arch/arch-${TRUST_MAIN_HPCC}.env
-fi
-
-export TRUST_JOB_ENV
-
-## Default parallel compilation on 4 procs
-[ -z "${TRUST_COMPILE_NPROC}" ] && TRUST_COMPILE_NPROC='4'
-export TRUST_COMPILE_NPROC
-
-## Not mandatory
-export TRUST_COMPILE_FORTRAN TRUST_COMPILE_MPI TRUST_COMPILE_NETCDF
-
-
-## Running
-##--------
-
-## Assuming the job submit script is in './batch', if not 
-if [ -z "${TRUST_JOB_SCRIPT}" ]; then
-    TRUST_JOB_SCRIPT=${TRUST_MAIN_DIR}/batch/${TRUST_MAIN_HPCC}.sh || get_out A
-fi
-
-export TRUST_JOB_SCRIPT 
-
-## Mandatory job management cmds (submit, status checking and killing job)
-if [[ -z "${TRUST_JOB_SUBMIT}" || -z "${TRUST_JOB_STATE}" \
-                               || -z "${TRUST_JOB_KILL}"    ]]; then
-    get_out A
-fi
-
-export TRUST_JOB_SUBMIT TRUST_JOB_STATE TRUST_JOB_KILL
-
-## Default test timeout to 3h (pending AND running time)
-[ -z "${TRUST_JOB_TIMEOUT}" ] && TRUST_JOB_TIMEOUT='10800'
-export TRUST_JOB_TIMEOUT
-
-## Job informations not mandatory
-export TRUST_JOB_INFO TRUST_JOB_TIME TRUST_JOB_RAM_P TRUST_JOB_RAM_V
-
-
-## Trusting test
-##--------------
-
-export TRUST_TEST_NAME=${TRUST_MAIN_USER}'_'${TRUST_MAIN_HPCC}
-export TRUST_TEST_DATE=$( date -u +"%Y%m%d%Z%H%M" )
-
-export TRUST_TEST_SUMMARY=trusting_${TRUST_TEST_DATE}_${TRUST_TEST_NAME}.txt
-export  TRUST_TEST_BACKUP=trusting_${TRUST_TEST_DATE}_${TRUST_TEST_NAME}.tgz
-
-##       TRUST_TEST_DIR unset
-if [[ ! ${TRUST_TEST_DIR}       && ${TRUST_TEST_DIR-_}       ]]; then
-        TRUST_TEST_DIR=${TRUST_DIR_SCRATCH}/${TRUST_CFG_REF}/${TRUST_SVN_BRANCH}
-        TRUST_TEST_DIR+=/${TRUST_TEST_DATE}
-    export TRUST_TEST_DIR
-fi
-
-## TRUST_TEST_BENCHMARK unset
-if [[ ! ${TRUST_TEST_BENCHMARK} && ${TRUST_TEST_BENCHMARK-_} ]]; then
-    TRUST_TEST_BENCHMARK=${TRUST_DIR_STORE}/${TRUST_CFG_REF}/${TRUST_SVN_BRANCH}
-    export TRUST_TEST_BENCHMARK
-fi
-
-export TRUST_TEST_LOG=${TRUST_TEST_BENCHMARK}/trusting_${TRUST_TEST_NAME}.txt
-
-export TRUST_TEST_MAILING
Index: anches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST/inc/trusting_func.sh
===================================================================
--- /branches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST/inc/trusting_func.sh	(revision 8882)
+++ 	(revision )
@@ -1,622 +1,0 @@
-#!/bin/bash
-
-
-##--------------------------------------------------------------------------------
-## Messenger filenames
-##--------------------------------------------------------------------------------
-
-file_date=mesg_01_date.txt  ; file_rslt=mesg_02_result.txt
-file_stat=mesg_03_status.txt; file_nemo=mesg_04_nemo.txt
-file_xios=mesg_05_xios.txt  ; file_cmpf=mesg_06_compiler.txt
-file_lmpi=mesg_07_mpi.txt   ; file_ncdf=mesg_08_netcdf.txt
-file_inpt=mesg_09_inputs.txt; file_time=mesg_10_time.txt
-file_memy=mesg_11_memory.txt; file_note=mesg_12_comments.txt
-
-
-##--------------------------------------------------------------------------------
-## Functions in order of use
-##--------------------------------------------------------------------------------
-
-step() {
-    local char_nb=$( echo "$1" | wc -c )
-    local outline=$( printf "%${char_nb}s" )
-
-    printf "\n%s\n%s\n\n" "$1" ${outline// /-}
-}
-
-
-##
-##--------------------------------------------------------------------------------
-
-init() {
-    mkdir -p ${TRUST_TEST_DIR} ${TRUST_TEST_BENCHMARK} || get_out B
-    cd       ${TRUST_TEST_DIR}
-    echo     ${TRUST_TEST_DIR}
-
-    echo 'Date'        	    > ${file_date}; echo 'Result'   > ${file_rslt}
-    echo 'Status'      	    > ${file_stat}; echo 'NEMOGCM'  > ${file_nemo}
-    echo 'XIOS'   	    > ${file_xios}; echo 'Fortran'  > ${file_cmpf}
-    echo 'MPI'    	    > ${file_lmpi}; echo 'NetCDF'   > ${file_ncdf}
-    echo 'Inputs' 	    > ${file_inpt}; echo 'Time'     > ${file_time}
-    echo 'RAM (Phy./Virt.)' > ${file_memy}; echo 'Comments' > ${file_note}
-
-    ## 'FAILED' status with 'Unknown error' by default
-    echo ${TRUST_FLAG_RESULT} \
-	>> ${file_rslt}
-    echo 'Unknown error' \
-	>> ${file_stat}
-
-    ## UTC time zone for timestamping
-    local dat=$( date -ud "${TRUST_TEST_DATE}" +"%F %R %Z" )
-
-    echo $dat           \
-	>> ${file_date}
-}
-
-
-##
-##--------------------------------------------------------------------------------
-
-get_nemo_rev() {
-    local dir rev_loc
-    local rev=0
-
-    ## Loop on essential NEMO directories
-    for dir in ${TRUST_SVN_UP}; do
-
-	echo $dir && ${TRUST_SVN_ACTION} ${TRUST_SVN_NEMOGCM}/$dir || get_out C
-	rev_loc=$( svn info ${TRUST_SVN_NEMOGCM}/$dir         \
-	               | awk '/Last Changed Rev/ {print $NF}'   )
-
-	## Keep last rev. nb
-	[ ${rev_loc} -gt $rev ] && rev=${rev_loc}
-    done
-
-    echo 'NEMOGCM '$rev \
-	>> model.log
-    echo "<a href=\"${TRUST_SVN_REPO}/nemo/changeset/$rev\" target=\"_blank\">$rev</a>" \
-	>> ${file_nemo}
-}
-
-
-##
-##--------------------------------------------------------------------------------
-
-get_soft_rel() {
-    local ver str
-
-    ## Sourcing environment
-    . ${TRUST_JOB_ENV} >& /dev/null
-
-    for str in ${TRUST_COMPILE_FORTRAN}                         \
-	       ${TRUST_COMPILE_MPI}     ${TRUST_COMPILE_NETCDF} \
-	       ${TRUST_IO_CDO}                                    ; do
-	[ -z "$str" ] && continue
-	ver=''
-
-	## Extract version number after searching pattern in PATH env. variable
-	ver=$( echo $PATH | sed "s|.*\($str[0-9.]*\).*|\1|" )
-
-	## option --version would work for main Fortran compilers and CDO
-	if [[ $str =~ ${TRUST_COMPILE_FORTRAN}|${TRUST_IO_CDO} ]]; then
-	    ver=$( $str --version 2>&1 | grep -m1 -oe '\<[0-9. ]*\>' \
-		       | xargs echo $str                               )
-	fi
-
-	## Cleaning characters string to display proper soft name
-	ver=$( echo $ver | sed 's|[/-]| |g' )
-
-	echo $ver        \
-	    >> model.log
-    done
-
-    sed -n 2p model.log \
-	>> ${file_cmpf}
-    sed -n 3p model.log \
-	>> ${file_lmpi}
-    sed -n 4p model.log \
-	>> ${file_ncdf}
-
-    cat model.log | awk '{printf "%-20s %s %s\n", $1, $2, $3}'
-    env | sort > env.log
-}
-
-
-##
-##--------------------------------------------------------------------------------
-
-compile_xios() {
-    cd ${TRUST_IO_XIOS}
-
-    rev=$( svn info | awk '/Last Changed Rev/ {print $NF}' )
-    printf 'XIOS                 branch %s rev. %s\n' \
-	$( basename ${TRUST_IO_XIOS} ) $rev           \
-	| tee -a ${TRUST_TEST_DIR}/model.log
-    echo "<a href=\"${TRUST_SVN_REPO}/ioserver/changeset/$rev target=\"_blank\">$rev</a>" \
-	>> ${TRUST_TEST_DIR}/${file_xios}
-
-    eval "
-    ./make_xios ${TRUST_IO_XIOS_MODE} --arch ${TRUST_MAIN_HPCC}     \
-	                              --job  ${TRUST_COMPILE_NPROC} \
-	${TRUST_MAIN_STDOUT}
-    "
-
-    [ ! -e ./lib/libxios.a ] && get_out D || echo 'Success'
-}
-
-
-##
-##--------------------------------------------------------------------------------
-
-compile_nemo() {
-    cd ${TRUST_SVN_NEMOGCM}/CONFIG
-
-    ## Recompiling from scratch if not in debug or dev mode
-    if [[ ${TRUST_FLAG_DEBUG} == 'false' && ${TRUST_FLAG_DEV} == 'false' ]]; then
-
-	  if [[ -d ${TRUST_CFG_NEW} ]]; then
-	      ./makenemo -n ${TRUST_CFG_NEW} clean_config \
-	      > /dev/null <<EOF
-y
-EOF
-	  fi
-
-    fi
-
-    eval "
-    ./makenemo -n ${TRUST_CFG_NEW}   -r ${TRUST_CFG_REF}       \
-               -m ${TRUST_MAIN_HPCC} -j ${TRUST_COMPILE_NPROC} \
-               ${TRUST_CFG_KEY_ADD} ${TRUST_CFG_KEY_DEL}       \
-	${TRUST_MAIN_STDOUT}
-    "
-
-    [ ! -e ./${TRUST_CFG_NEW}/BLD/bin/nemo.exe ] && get_out E || echo 'Success'
-}
-
-
-##
-##--------------------------------------------------------------------------------
-
-get_inputs() {
-    cd ${TRUST_TEST_DIR}
-
-    ## Test forcing directory
-    if [[ ! ${TRUST_IO_FORC_PATH} && ${TRUST_IO_FORC_PATH-_} ]]; then
-
-	echo 'No forcing files needed'
-
-    else
-
-	## Test forcing archive
-	if [ -n "${TRUST_IO_FORC_TAR}" ]; then
-
-	    echo 'Forcing archive(s): '${TRUST_IO_FORC_TAR}
-
-	    # List archive content & extract it by default
-	    local inputs_list="
-            for archive in \${TRUST_IO_FORC_TAR}; do
-		tar -tvf \${TRUST_IO_FORC_PATH}/\$archive >> inputs_list.txt;
-            done
-            "
-	    local inputs_get="
-            for archive in \${TRUST_IO_FORC_TAR}; do
-		tar -vxf \${TRUST_IO_FORC_PATH}/\$archive  >       /dev/null;
-            done
-            "
-
-	else
-
-	    echo 'Forcing directory: '${TRUST_IO_FORC_PATH}
-
-	    ## List & copy files without archive
-            local inputs_list=" ls -lh \${TRUST_IO_FORC_PATH}/* >> inputs_list.txt"
-            local inputs_get=" \cp     \${TRUST_IO_FORC_PATH}/* .                 "
-	fi
-
-    fi
-
-    eval ${inputs_list}
-    eval ${inputs_get}
-
-    if [ $( find -name '*.gz' -print -quit ) ]; then
-	find . -name '*.gz' -exec gzip -d {} \;
-    fi
-
-    cp   ${TRUST_SVN_NEMOGCM}/CONFIG/${TRUST_CFG_NEW}/cpp_* .
-    find ${TRUST_SVN_NEMOGCM}/CONFIG/${TRUST_CFG_NEW}/EXP00 \
- 	 -regex '.*\(_cfg\|.in\|opa\|_ref\|.xml\)'          \
-	 -exec  cp {} . \;
-}
-
-
-##
-##--------------------------------------------------------------------------------
-
-diff_inputs() {
-    local dif file
-    local files_list='' mesg='Same' 
-
-    ###################################
-    ## Think of copying initial test ##
-    ###################################
-
-    ## Simple diff
-    for file in cpp_* 'inputs_list.txt' *namelist_* *.xml; do
-	dif=''
-
-	## Continue even if input file is not in here (see after)
-	if [ -e ${TRUST_TEST_BENCHMARK}/$file ]; then
-	    dif=$( diff -q $file ${TRUST_TEST_BENCHMARK}/$file )
-	else 
-	    dif=0
-	fi
-
-	## Pass over useless file omission in benckmark directory
-	if [[ -n "$dif" && "$dif" != '0' ]]; then
-	    mesg='Different'
-	    echo $dif
-	    files_list+=$file' '
-	fi
-
-    done
-
-    [ $mesg == 'Same' ] && echo $mesg
-    echo $mesg          \
-	>> ${file_inpt}
-
-    ## List different files for web comment
-    [ -n "${files_list}" ] && echo 'Inputs  : '${files_list}'differ<br>' \
-	>> temp_${file_note}
-}
-
-
-##
-##--------------------------------------------------------------------------------
-
-job_submit() {
-    ## Copy the submitting script to testing folder
-    cp ${TRUST_JOB_SCRIPT} ${TRUST_TEST_DIR}
-
-    TRUST_JOB_ID=$( eval ${TRUST_JOB_SUBMIT} )
-    [ $? -ne 0 ] && get_out G || printf "Success (job ID %s)\n" ${TRUST_JOB_ID}
-}
-
-
-##
-##--------------------------------------------------------------------------------
-
-job_pending() {
-    local outline=$( printf "%100s" ) time_elapsed=0 time_increment=30
-
-    sleep ${time_increment}
-
-    ## Append a log file while pending
-    while [[ $( eval ${TRUST_JOB_STATE} )                \
-	     && ${time_elapsed} -lt ${TRUST_JOB_TIMEOUT}   ]]; do
-	printf "\n%s\n" ${outline// /#} \
-	    >> computation.log
-	[ -n "${TRUST_JOB_INFO}" ] && eval ${TRUST_JOB_INFO} \
-	    >> computation.log
-	sleep ${time_increment}
-	time_elapsed=$(( ${time_elapsed} + ${time_increment} ))
-    done
-
-    sleep ${time_increment}
-
-    ## Kill remaining job & stop the test if it's too long
-    if [ ${time_elapsed} -eq ${TRUST_JOB_TIMEOUT} ]; then
-	eval ${TRUST_JOB_KILL} &> /dev/null
-	get_out I
-    fi
-
-}
-
-
-##
-##--------------------------------------------------------------------------------
-
-job_perfs() {
-    if [ -n "${TRUST_JOB_TIME}" ]; then
-
-    ## Interest for checking unusual time computation
-	local time_cpu=$( eval ${TRUST_JOB_TIME} )
-
-	printf "Time: "
-	echo ${time_cpu} | tee -a ${file_time}
-
-    fi
-
-    if [[ -n "${TRUST_JOB_RAM_P}" && -n "${TRUST_JOB_RAM_V}" ]]; then
-
-    ## Interest for checking unusual memory usage
-	local memory_pmax=$( eval ${TRUST_JOB_RAM_P} )
-	local memory_vmax=$( eval ${TRUST_JOB_RAM_V} )
-
-	printf "Max memory usage (physical/virtual): "
-	echo ${memory_pmax}' / '${memory_vmax} | tee -a ${file_memy}
-    fi
-}
-
-
-##
-##--------------------------------------------------------------------------------
-
-job_state() {
-    if [[ ! -e time.step || $( grep 'E R R O R' ocean.output ) ]]; then
-	get_out H
-    else
-	echo 'Success' ## Must be reviewed
-    fi
-}
-
-
-##
-##--------------------------------------------------------------------------------
-
-diff_results() {
-    local file
-    local files_list='' mesg='Same'
-
-    ###################################
-    ## Think of copying initial test ##
-    ###################################
-
-    ## Now test is good by default ('OK')
-    TRUST_FLAG_RESULT='OK'
-
-    ## Simple diff
-    for file in 'ocean.output' *.stat; do
-	## Stop if no minimal benchmark files (ocean.output, eventual stat files)
-	[ ! -e ${TRUST_TEST_BENCHMARK}/$file ] && get_out J
-
-	diff -q $file ${TRUST_TEST_BENCHMARK}/$file
-
-	## Continue even if it differs
-	if [ $? -ne 0 ]; then mesg='Different'; files_list+=$file' '; fi
-
-    done
-
-    [ $mesg == 'Same' ] && echo $mesg
-
-    ## List different files for web comment
-    [ -n "${files_list}" ] && echo 'Results : '${files_list}'differ<br>' \
-	>> temp_${file_note}
-}
-
-
-##
-##--------------------------------------------------------------------------------
-
-diff_restarts() {
-    local dif filebase filebases ndomain out
-    local files_list='' dif_sum='0'
-
-    ## Find all restart files to rebuild
-    if [ $( find -regex ".*_restart.*[0-9]\.nc" -print -quit ) ]; then
-        ###############################################################
-	## Think to set the configuration name in the 'namelist_cfg' ##
-	###############################################################
-	filebases=$( find -regextype sed -regex ".*${TRUST_CFG_NEW}.*_[0-9]\{4\}\.nc" \
-	                 | sed 's/\(.*\)_.*/\1/' | sort -u                              )
-
-	for filebase in $filebases; do
-
-	    ndomain=$( find -regex ".*${filebase}_[0-9]*.nc" \
-		           | wc -l | awk '{print $1}'          )
-
-            #####################################################
-            ## Handle 2 possibilities of 'rebuild_nemo' origin ##
-            #####################################################
-
-	    ${TRUST_SVN_NEMOGCM}/TOOLS/REBUILD_NEMO/rebuild_nemo \
-		-t ${TRUST_COMPILE_NPROC} $filebase $ndomain       \
-		> /dev/null
-
-	    ## Possibility of remaining decomposed restarts (even after rebuild)
-	    if [ $? -eq 0 ]; then
-		rm -f ${filebase}_[0-9]*.nc \
-                    > /dev/null
-	    else
-		get_out K
-	    fi
-
-            ## Stop if no benchmark files (restart file)
-	    if [ -e ${TRUST_TEST_BENCHMARK}/$filebase.nc ]; then
-
-		cdo diffn $filebase.nc ${TRUST_TEST_BENCHMARK}/$filebase.nc \
-		    > cdo_diff.out 2> /dev/null
-
-		## Identical if cdo_diff.out is zero size
-		[ ! -s cdo_diff.out ] && continue
-
-		dif=$( grep -om1 '[0-9]* of [0-9]* records' cdo_diff.out )
-
-		if [ -n "$dif" ]; then
-		    files_list+=$filebase' ' && echo $filebase'.nc: '$dif
-		    let dif_sum+=$( echo $dif | sed '|^\([0-9]*\).*|\1|' )
-		fi
-
-	    fi
-
-	done
-
-        ## List modified restart(s) for web comment with sum of differences
-	if [ ${dif_sum} -ne 0 ]; then
-	    echo 'Restarts: '${files_list}${dif_sum}' record(s) differ<br>' \
-		>> temp_${file_note}
-	else
-	    echo 'Same'
-	fi
-
-    fi
-
-    [ $TRUST_FLAG_RESULT == 'FAILED' ] && get_out L
-}
-
-
-##
-##--------------------------------------------------------------------------------
-
-comments() {
-    local opat
-    local line='' state=$1
-
-    if [ -e ocean.output ]; then
-        ## 'W A R N I N G' pattern by default
-	opat="-A2 \"^ $state\""
-	[ "$state" == 'E R R O R' ] && opat="-A4 \"$state\""
-
-        ## Select first occurence for web comment
-	line=$( eval grep -m1 $opat ocean.output | tr -d '\n' )
-    fi
-
-    [ -n "$line" ] && ( echo $line; printf "$line<br>" \
-	>> temp_${file_note} )
-}
-
-
-##
-##--------------------------------------------------------------------------------
-
-log_make() {
-    ## Format comments for web
-    if [ -e temp_${file_note} ]; then
-	cat temp_${file_note} | tr -d '\n' | sed 's/<br>$//' \
-	    >> ${file_note}
-    fi
-
-    ## Construct txt file with all messenger files
-    paste -d ';' mesg_*.txt | tee ${TRUST_TEST_SUMMARY}
-}
-
-
-##
-##--------------------------------------------------------------------------------
-
-prod_publish() {
-    local cmd
-    local rev=$( awk '/NEMOGCM/ {print $NF}' model.log )
-
-    ## Production mode (-p|--prod)
-    if [ ${TRUST_FLAG_PROD} == 'true' ]; then
-
-	## Create or append trusting logfile
-	if [ -f ${TRUST_TEST_LOG} ]; then cmd='tail -1'; else cmd='cat'; fi
-
-	$cmd ${TRUST_TEST_SUMMARY} \
-	    >> ${TRUST_TEST_LOG}
-
-        ## Send mail only when FAILED
-	if [[ -n "${TRUST_TEST_MAILING}"          \
-	      && ${TRUST_FLAG_RESULT} == 'FAILED'   ]]; then
-
-	    ## Content
-	    cat <<END_MAIL      \
-		> trusting.mail
-Dear all,
-
-
-The following trusting sequence has not completed successfully:
-
-Testing configuration ${TRUST_CFG_NEW} based on ${TRUST_CFG_REF}.
-User installation ${TRUST_MAIN_USER}
-HPC environment ${TRUST_MAIN_HPCC}
-
-Here is the running environment summary:
-`cat model.log`
-
-For more details, look into the testing folder at:
-${TRUST_TEST_DIR}
-An archive is also available to share the questionable configuration:
-${TRUST_TEST_BENCHMARK}/${TRUST_TEST_BACKUP}
-
-END_MAIL
-
-	    ## Send with detailed subject
-	    mail -s "[NEMO Trusting][${TRUST_CFG_REF}][${TRUST_SVN_BRANCH}] \
-		     ${TRUST_FLAG_RESULT} ${TRUST_FLAG_ERROR}"              \
-		 ${TRUST_TEST_MAILING}                                      \
-		<  trusting.mail
-	fi
-
-    fi
-}
-
-
-##
-##--------------------------------------------------------------------------------
-
-get_out() {
-    local time_step=0
-
-    TRUST_FLAG_ERROR=$1
-
-    printf "\n\nEnd of test\n"
-
-    ## In case of compilation error
-    cd ${TRUST_TEST_DIR}
-
-    if [ ${TRUST_FLAG_RESULT} == 'FAILED' ]; then
-	echo 'Failure'
-
-        ## Error identification
-	case ${TRUST_FLAG_ERROR} in
-
-	    ## Initialisation
-	    'A') TRUST_FLAG_ERROR='Missing environment variable'      ;;
-	    'B') TRUST_FLAG_ERROR='Unable to create testing directory';;
-	    'C') TRUST_FLAG_ERROR='SVN issue on local working copy'   ;;
-
-            ## Compilation
-	    'D') TRUST_FLAG_ERROR='XIOS compilation failed'           ;;
-	    'E') TRUST_FLAG_ERROR='NEMO compilation failed'           ;;
-
-	    ## Submission
-	    'F') TRUST_FLAG_ERROR='Missing input files'               ;;
-	    'G') TRUST_FLAG_ERROR='Job submission error'              ;;
-
-	    ## Computing
-	    'H') TRUST_FLAG_ERROR='Crashed at time step '
-		comments 'E R R O R'
-		[ -e time.step ] && time_step=$( cat time.step )
-		TRUST_FLAG_ERROR+=${time_step:=0}                     ;;
-	    'I') TRUST_FLAG_ERROR='Exceeded time limit of '
-		TRUST_FLAG_ERROR+=$(( ${TRUST_JOB_TIMEOUT}/3600 ))'h' ;;
-
-	    ## Results
-	    'J') TRUST_FLAG_ERROR='Missing previous outputs'          ;;
-	    'K') TRUST_FLAG_ERROR='Restart rebuild error'             ;;
-	    'L') TRUST_FLAG_ERROR='New outputs differ'                ;;
-
-	    ## Other
-	    '*') TRUST_FLAG_ERROR='Unknown error'                     ;;
-
-	esac
-
-    else
-	echo 'Success' && TRUST_FLAG_ERROR='Code is reliable'
-    fi
-
-    ## Eventual comments from ocean.output
-    [[ ! ${TRUST_FLAG_ERROR} =~ 'Crashed at time step' ]] && comments 'W A R N I N G'
-
-    ## Last messenger files
-    sed -i "2 s/.*/$TRUST_FLAG_RESULT/" ${file_rslt}
-    sed -i "2 s/.*/$TRUST_FLAG_ERROR/"  ${file_stat}
-
-    ## Save tested configuration if trusting failed in production mode ('-p')
-    if [[ ${TRUST_FLAG_RESULT} == 'FAILED' && ${TRUST_FLAG_PROD} == 'true' ]]; then
-	echo 'Creating archive '${TRUST_TEST_BACKUP}' under '${TRUST_TEST_BENCHMARK}
-	tar -czf ${TRUST_TEST_BENCHMARK}/${TRUST_TEST_BACKUP}                 * \
-	    -C   ${TRUST_SVN_NEMOGCM}/CONFIG/${TRUST_CFG_NEW}/MY_SRC . \
-	    -C   ${TRUST_SVN_NEMOGCM}/CONFIG/${TRUST_CFG_NEW}          \
-	         cpp_${TRUST_CFG_NEW}.fcm
-    fi
-
-    ## Logfile construct & eventual sending of notification email
-    printf "\nTrusting digest:\n----------------\n"
-    log_make
-    prod_publish
-
-    exit 0
-}
Index: anches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST/inc/trusting_help.txt
===================================================================
--- /branches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST/inc/trusting_help.txt	(revision 8882)
+++ 	(revision )
@@ -1,42 +1,0 @@
-Usage: ./trusting.sh        -u $USER -m $ARCH [OPTIONS]
-       ./install_new_branch -u $USER -m $ARCH [OPTIONS]
-
-./trusting.sh            Launch trusting test on $ARCH machine from $USER installation
-./install_new_branch     Install new branch in $USER installation for trusting test on $ARCH machine
-
-Examples: `./trusting.sh        -u romr005 -m X64_CURIE -p -b nemo_v3_6_STABLE`
-          `./install_new_branch -u romr005 -m X64_ADA   -w $HOME/NEMO         `
-
-Mandatory
-    Default settings to source in ./config, templates (arch_template.cfg & user_template.cfg)
-    -m,--machine      Architecture environment (compilation & computation settings)
-    -u,--user         User             ""      (NEMO & XIOS installation)		   
-
-
-Options (modify default settings)
-SVN
-    -b,--branch	      Branch name in working directory ('trunk'|'nemo_v3_6_stable'|...)
-    -v,--version      Action on working copy ('status' by default)
-  		           '{'YYYY-MM-DD'}'  Update to revision available at this date
-		           [0-9]*	       ""   ""    ""    number
-		           HEAD|up|update      ""   "" last revision
-		           st|status	     Show differences with repository
-    -w,--workdir      Installation directory for testing branches
-
-Inputs
-    -a,--archive      Forcing input files archive to extract, if void it will copy all files from given folder (see next line)
-    -f,--forcdir      Path to your personal folder of forcing inputs
-
-Testing configuration
-    -n,--new_conf     Testing   configuration folder created in ./CONFIG
-    -r,--ref_conf     Reference      " "      for trusting test
-
-Compiling & computation
-    -j,--job          Number of processes for compiling
-    -t,--time         Timeout for computation (s)
-
-Trusting output
-    -d,--debug        Verbose output for debugging purpose (`set -vx`)
-    -e,--email        Email trusting digest report to following addresses only on failure
-    -h,--help         Print this help & exit
-    -p,--prod         Production mode (append trusting logfile)
Index: /branches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST/install_new_branch.sh
===================================================================
--- /branches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST/install_new_branch.sh	(revision 8882)
+++ /branches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST/install_new_branch.sh	(revision 8883)
@@ -15,5 +15,5 @@
 	'-d'|'--debug'  ) TRUST_FLAG_DEBUG=1 ; shift  ;; '-j'|'--job' 	  ) TRUST_COMPILE_NPROC=$2; shift 2;;
 	'-m'|'--machine') TRUST_MAIN_HPCC=$2; shift 2;; '-h'|'--help'	  ) TRUST_FLAG_HELP=1 ; shift  ;;
-	'-u'|'--user'   ) TRUST_MAIN_USER=$2; shift 2;; "*"             ) TRUST_FLAG_HELP=1 ; shift  ;;
+	'-u'|'--user'   ) TRUST_MAIN_SETUP=$2; shift 2;; "*"             ) TRUST_FLAG_HELP=1 ; shift  ;;
     esac
 done
@@ -22,5 +22,5 @@
 ## Initialization (HPC & user environment)
 ##---------------------------------------------------
-if [[ ! -e cfg/${TRUST_MAIN_USER}.cfg || ! -e cfg/${TRUST_MAIN_HPCC}.cfg || ${TRUST_FLAG_HELP} -eq 1 ]]; then
+if [[ ! -e cfg/${TRUST_MAIN_SETUP}.cfg || ! -e cfg/${TRUST_MAIN_HPCC}.cfg || ${TRUST_FLAG_HELP} -eq 1 ]]; then
     cat ./inc/trusting_help.txt
 
@@ -28,5 +28,5 @@
 	printf "\n\n\033[0;33m"
 	printf "At least one configuration (arch or user) file is missing or misspelled:"
-	printf "\t'%s'.cfg\t'%s'.cfg" ${TRUST_MAIN_USER} ${TRUST_MAIN_HPCC}
+	printf "\t'%s'.cfg\t'%s'.cfg" ${TRUST_MAIN_SETUP} ${TRUST_MAIN_HPCC}
 	printf "\033[0m"
     fi
Index: /branches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST/trusting.sh
===================================================================
--- /branches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST/trusting.sh	(revision 8882)
+++ /branches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST/trusting.sh	(revision 8883)
@@ -2,35 +2,95 @@
 
 
+## Possibility to call from outside
 cd $( dirname $0 )
-
-##--------------------------------------------------------------------------------
-## Set flags & defaults
-##--------------------------------------------------------------------------------
-
 TRUST_MAIN_DIR=$PWD
-TRUST_FLAG_HELP='false'
-TRUST_FLAG_DEBUG='false'; TRUST_FLAG_DEV='false' ; TRUST_FLAG_PROD='false'
-
-# Revision number of the tool
+
+## Tool revision in use
 rev=$( svn info | awk '/Last Changed Rev/ {print $NF}' )
 
 
 ##--------------------------------------------------------------------------------
-## Get short or long arguments from command line
-##--------------------------------------------------------------------------------
-
-while getopts a:b:de:f:j:hm:n:r:t:pu:v:w: arg; do
-
-    case $arg in
-	a)  TRUST_IO_FORC_TAR=$OPTARG;; b)    TRUST_SVN_BRANCH=$OPTARG;;
-	d) TRUST_FLAG_DEBUG='true'   ;; e)  TRUST_TEST_MAILING=$OPTARG;;
-	f) TRUST_IO_FORC_PATH=$OPTARG;; j) TRUST_COMPILE_NPROC=$OPTARG;;
-	h)  TRUST_FLAG_HELP='true'   ;; m)     TRUST_MAIN_HPCC=$OPTARG;;
-	n)      TRUST_CFG_NEW=$OPTARG;; r)       TRUST_CFG_REF=$OPTARG;;
-	t)  TRUST_JOB_TIMEOUT=$OPTARG;; p)   TRUST_FLAG_PROD='true'   ;;
-	u)    TRUST_MAIN_USER=$OPTARG;; v)       TRUST_SVN_REV=$OPTARG;;
-	w)     TRUST_DIR_WORK=$OPTARG;;
-	:) echo 'Arg. needed for '$OPTARG && TRUST_FLAG_HELP='true'   ;;
-	*)  TRUST_FLAG_HELP='true'                                    ;;
+## Flags default
+##--------------------------------------------------------------------------------
+
+TRUST_FLAG_DEBUG='false'; TRUST_FLAG_DEV='false'
+TRUST_FLAG_HELP='false' ; TRUST_FLAG_PROD='false'
+
+
+##--------------------------------------------------------------------------------
+## Options from command line
+##--------------------------------------------------------------------------------
+
+while getopts ab:c:de:hj:lm:n:p:r:s:t:u:v:-: shortopt; do
+
+##  Attempt to maintain consistency with 'makenemo' available options
+##o makenemo: a d e h j k m n r s t u v
+##o trusting: | | | = = | = = = | | | |
+
+    case $shortopt in
+	## Mandatory (HPCC environment)
+	'm') TRUST_MAIN_HPCC=$OPTARG    ;;
+
+	## NEMO configuration
+	'n') TRUST_CFG_NEW=$OPTARG      ;; 'r') TRUST_CFG_REF=$OPTARG     ;;
+
+	## Compilation
+	'j') TRUST_COMPILE_NPROC=$OPTARG;;
+
+	## Flags
+	'h') TRUST_FLAG_HELP='true'     ;;
+
+	## Implement long options for specific not to reducing further short possibilites
+	## https://stackoverflow.com/questions/402377/using-getopts-in-bash-shell-script-to-get-long-and-short-command-line-options
+	'-')
+	    [ $OPTIND -ge 1 ] && optind=$( expr $OPTIND - 1 ) || optind=$OPTIND
+            longopt=${!optind}
+	    
+	    OPTION=${longopt/=[0-9A-Za-z_-]*/}; OPTARG=${longopt/[a-z-]*=/}
+
+            case $OPTION in
+		## Mandatory (installation environment)
+		'--setup'   ) TRUST_MAIN_SETUP=$OPTARG   ;;
+
+		##  Alt 'CONFIG' directory for standalone 'TRUST' to check several local branches
+		##+ (default to ./../CONFIG parent)
+		'--cfgdir'  ) TRUST_DIR_WORK=$OPTARG     ;;
+
+		## Local working copy
+		'--branch'  ) TRUST_SVN_BRANCH=$OPTARG   ;;
+		'--update'  ) TRUST_SVN_REV=$OPTARG      ;;
+
+		## Compilation & Computing
+		'--timeout' ) TRUST_JOB_TIMEOUT=$OPTARG  ;; 
+
+		## Inputs
+		'--forctar' ) 
+		    TRUST_IO_FORC_TAR=''
+
+		    ## Set but not empty
+		    if [ $OPTARG ]; then 
+			TRUST_IO_FORC_TAR=$OPTARG
+		    else
+			OPTARG='null'
+		    fi
+                                                         ;;
+		'--forcpath') TRUST_IO_FORC_PATH=$OPTARG ;;
+
+		## Mailing
+		'--email'   ) TRUST_TEST_MAILING=$OPTARG ;;
+
+		## Flags (no argument needed)
+		'--dev'     ) TRUST_FLAG_DEV='true'  ; OPTARG='null';;
+		'--prod'    ) TRUST_FLAG_PROD='true' ; OPTARG='null';;
+		'--debug'   ) TRUST_FLAG_DEBUG='true'; OPTARG='null';;
+
+		*           ) printf "\033[0;31m%s illegal long option %s\033[0m\n" \
+		    $0 $OPTION;;
+            esac
+
+	    OPTIND=1; shift             ;;
+
+	## Illegal option
+	'?')  TRUST_FLAG_HELP='true'    ;;
     esac
 
@@ -42,7 +102,8 @@
 ##--------------------------------------------------------------------------------
 
-if [[ ! -e cfg/${TRUST_MAIN_USER}.cfg || ! -e cfg/${TRUST_MAIN_HPCC}.cfg \
-      || ${TRUST_FLAG_HELP} == 'true'                                      ]]; then
-    cat ./inc/trusting_help.txt
+if [[ ! -e ./cfg/${TRUST_MAIN_SETUP}.cfg || ! -e ./cfg/${TRUST_MAIN_HPCC}.cfg ]]; then
+
+    printf "\nUsage: %s -m arch --setup cfg [OPTIONS]\n"        $0
+    printf "\nSee help for options description, %s -h|--help\n" $0
 
     ## Color this section to part with help
@@ -53,5 +114,8 @@
 	    \nAt least 1 cfg file (arch or user) is missing or misspelled: \
 	    '%s.cfg' or '%s.cfg'\n"                                        \
-	    ${TRUST_MAIN_USER} ${TRUST_MAIN_HPCC}
+	    ${TRUST_MAIN_SETUP} ${TRUST_MAIN_HPCC}
+    else
+	printf "\033[0m"
+	cat ./inc/help.txt
     fi
 
@@ -66,6 +130,6 @@
     [ ${TRUST_FLAG_DEBUG} == 'true' ] && set -vx
 
-    . ./inc/trusting.env
-    . ./inc/trusting_func.sh
+    . ./inc/env.sh
+    . ./inc/functions.sh
 
 fi
@@ -80,5 +144,8 @@
 
 echo
-if [ -t 0 ]; then cat ./inc/banner.txt; else cat ./inc/banner.html; fi
+## Formatting for email (test not in interactive mode)
+[ ! -t 0 ] && echo '<pre style="font: 2px/1px monospace;">'
+cat ./inc/banner.txt
+[ ! -t 0 ] && echo '</pre>'
 echo
 echo '****************************************************************************************************'
@@ -91,5 +158,5 @@
 printf "\t§ Testing configuration\t\t%s on branch %s\n" \ ${TRUST_CFG_REF} ${TRUST_SVN_BRANCH}
 printf "\t§ (Super)Computer\t\t%s\n" 		          ${TRUST_MAIN_HPCC}
-printf "\t§ User installation\t\t%s\n\n" 	          ${TRUST_MAIN_USER}
+printf "\t§ User installation\t\t%s\n\n" 	          ${TRUST_MAIN_SETUP}
 echo
 if [ ${TRUST_TEST_BENCHMARK} ]; then
@@ -160,5 +227,5 @@
 job_state
 
-printf "Perfs?"
+printf "Perfs?\n"
 job_perfs
 
