Index: /branches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST/inc/trusting.env
===================================================================
--- /branches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST/inc/trusting.env	(revision 8833)
+++ /branches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST/inc/trusting.env	(revision 8834)
@@ -2,16 +2,59 @@
 
 
+##--------------------------------------------------------------------------------
 ## 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 (verbose output and skip XIOS compilation)
+    TRUST_IO_XIOS_MODE=''
+    TRUST_MAIN_STDOUT='1> /dev/null'
+else
+    ## std mode (merge stdout & stderr to /dev/null, XIOS compilation from scratch)
+    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
+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
+    if [[ ${TRUST_SVN_BRANCH}                          \
+	  && ${TRUST_SVN_BRANCH} == 'nemo_v3_6_STABLE'   ]]; then
 	TRUST_CFG_REF='ORCA2_LIM_PISCES'
     fi
@@ -20,4 +63,5 @@
 
 
+##--------------------------------------------------------------------------------
 ## Source user & (super)computer configurations
 ##--------------------------------------------------------------------------------
@@ -26,4 +70,5 @@
 
 
+##--------------------------------------------------------------------------------
 ## Checking and export environment variables
 ##--------------------------------------------------------------------------------
@@ -40,5 +85,5 @@
 ##------------------------------------------
 
-export TRUST_SVN_REPO='https://forge.ipsl.jussieu.fr/nemo/svn'
+export TRUST_SVN_REPO='https://forge.ipsl.jussieu.fr'
 export TRUST_SVN_CO=( 'ARCH           CONFIG          NEMO              
                        EXTERNAL/AGRIF EXTERNAL/fcm    EXTERNAL/IOIPSL   
@@ -65,4 +110,5 @@
 	[ ${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'
@@ -97,4 +143,5 @@
 ##----------------------
 
+## 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
@@ -103,9 +150,12 @@
 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
 
+## 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
@@ -114,5 +164,5 @@
 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
@@ -122,7 +172,9 @@
 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
 
Index: /branches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST/inc/trusting_func.sh
===================================================================
--- /branches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST/inc/trusting_func.sh	(revision 8833)
+++ /branches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST/inc/trusting_func.sh	(revision 8834)
@@ -2,4 +2,5 @@
 
 
+##--------------------------------------------------------------------------------
 ## Messenger filenames
 ##--------------------------------------------------------------------------------
@@ -13,8 +14,6 @@
 
 
+##--------------------------------------------------------------------------------
 ## Functions in order of use
-##--------------------------------------------------------------------------------
-
-## 
 ##--------------------------------------------------------------------------------
 
@@ -30,17 +29,15 @@
 ##--------------------------------------------------------------------------------
 
-init_files() {
-    echo 'Date'        	       > ${file_date}
-    echo 'Result'              > ${file_rslt}
-    echo 'Status'      	       > ${file_stat}
-    echo 'NEMOGCM rev.'        > ${file_nemo}
-    echo 'XIOS rev.'   	       > ${file_xios}
-    echo 'Fortran compiler'    > ${file_cmpf}
-    echo 'MPI libs'    	       > ${file_lmpi}
-    echo 'NetCDF libs'         > ${file_ncdf}
-    echo 'Input files' 	       > ${file_inpt}
-    echo 'Elapsed time'        > ${file_time}
-    echo 'Memory (Phy./Virt.)' > ${file_memy}
-    echo 'Comments'            > ${file_note}
+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 'Elapsed time' > ${file_time}
+    echo 'RAM (Phy./Virt.)' > ${file_memy}; echo 'Comments'     > ${file_note}
 
     ## 'FAILED' status with 'Unknown error' by default
@@ -49,11 +46,5 @@
     echo 'Unknown error' \
 	>> ${file_stat}
-}
-
-
-##
-##--------------------------------------------------------------------------------
-
-get_date() {
+
     ## UTC time zone for timestamping
     local dat=$( date -ud "${TRUST_TEST_DATE}" +"%F %R %Z" )
@@ -72,18 +63,8 @@
 
     ## Loop on essential NEMO directories
-    for dir in ${TRUST_SVN_UP} ${TRUST_IO_XIOS}; do
-
-	## For time being, just get revision from XIOS with no action on directory
-	if [ $dir == ${TRUST_IO_XIOS} ]; then
-	    rev_loc=$( svn info $dir | awk '/Last Changed Rev/ {print $NF}' )
-	    echo 'XIOS '${rev_loc} \
-		>> model.log
-	    echo "<a href=\"https://forge.ipsl.jussieu.fr/ioserver/changeset/${rev_loc}\" target=\"_blank\">${rev_loc}</a>" \
-		>> ${file_xios}
-	    continue
-	fi
+    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  \
+	rev_loc=$( svn info ${TRUST_SVN_NEMOGCM}/$dir     \
 	           | awk '/Last Changed Rev/ {print $NF}'   )
 
@@ -94,7 +75,8 @@
     echo 'NEMOGCM '$rev \
 	>> model.log
-    echo "<a href=\"https://forge.ipsl.jussieu.fr/nemo/changeset/$rev\" target=\"_blank\">$rev</a>" \
+    echo "<a href=\"${TRUST_SVN_REPO}/nemo/changeset/$rev\" target=\"_blank\">$rev</a>" \
 	>> ${file_nemo}
 }
+
 
 ##
@@ -123,5 +105,4 @@
 
 	## Cleaning characters string to display proper soft name
-	#str=$( echo $str | sed 's|[/-]||g'  )
 	ver=$( echo $ver | sed 's|[/-]| |g' )
 
@@ -130,10 +111,60 @@
     done
 
+    sed -n 2p model.log \
+	>> ${file_cmpf}
     sed -n 3p model.log \
-	>> ${file_cmpf}
+	>> ${file_lmpi}
     sed -n 4p model.log \
-	>> ${file_lmpi}
-    sed -n 5p 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}' )
+    echo 'XIOS '$rev \
+	>> ${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 mode
+    if [[ -d ${TRUST_CFG_NEW} && ${TRUST_FLAG_DEBUG} == 'false' ]]; then
+	./makenemo -n ${TRUST_CFG_NEW} clean_config \
+	    > /dev/null <<EOF
+y
+EOF
+    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'
 }
 
@@ -144,40 +175,33 @@
 get_inputs() {
      # List archive content & extract it by default
-    local inputs_list=$( eval "
-        for archive in ${TRUST_IO_FORC_TAR}; do
-            tar -tvf ${TRUST_IO_FORC_PATH}/\$archive >> inputs_list.txt;
+    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=$( eval "
-        for archive in ${TRUST_IO_FORC_TAR}; do
-            tar -vxf ${TRUST_IO_FORC_PATH}/\$archive  >       /dev/null;
+         "
+    local inputs_get="
+        for archive in \${TRUST_IO_FORC_TAR}; do
+            tar -vxf \${TRUST_IO_FORC_PATH}/\$archive  >       /dev/null;
          done
-         " )
- 
+         "
+
     ## List & copy files without archive
     if [ -z "${TRUST_IO_FORC_TAR}" ]; then
-        inputs_list=" ls -lh ${TRUST_IO_FORC_PATH}/* >> inputs_list.txt"
-        inputs_get=" \cp     ${TRUST_IO_FORC_PATH}/* .                 "
-    fi
-
-    ${inputs_list}; ${inputs_get}
-
-#    for entry in ${TRUST_IO_FORC_PATH}; do
-#
-	# If path to file (assuming it is an archive)
-#	if   [ -e $entry ]; then
-#	    tar -tvf $entry >> inputs_list.txt;
-#	    tar -vxf $entry  >       /dev/null;
-	# If path to directory
-#	elif [ -d $entry ]; then
-#	    inputs_list=" ls -lh ${TRUST_IO_FORC_PATH}/* >> inputs_list.txt"
-#	    inputs_get=" \cp     ${TRUST_IO_FORC_PATH}/* .                 "
-#	fi    
-
-#    done
+        inputs_list=" ls -lh \${TRUST_IO_FORC_PATH}/* >> inputs_list.txt"
+        inputs_get=" \cp     \${TRUST_IO_FORC_PATH}/* .                 "
+    fi
+
+    cd ${TRUST_TEST_DIR}
+    eval ${inputs_list}
+    echo ${inputs_get}; 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 {} . \;
 }
 
@@ -221,4 +245,16 @@
     [ -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}
 }
 
@@ -257,4 +293,42 @@
 ##--------------------------------------------------------------------------------
 
+job_perfs() {
+    if [ -n "${TRUST_JOB_TIME}" ]; then
+
+    ## Interest for checking unusual time computation
+	local time_cpu=$( eval ${TRUST_JOB_TIME} )
+
+	printf "Elapsed 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 "Memory max 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
@@ -264,4 +338,7 @@
     ## Think of copying initial test ##
     ###################################
+
+    ## Now test is good by default ('OK')
+    TRUST_FLAG_RESULT='OK'
 
     ## Simple diff
@@ -290,5 +367,5 @@
 diff_restarts() {
     local dif filebase filebases ndomain out
-    local files_list='' dif_sum='0' #bcmk='false'
+    local files_list='' dif_sum='0'
 
     ## Find all restart files to rebuild
@@ -352,33 +429,5 @@
     fi
 
-}
-
-
-##
-##--------------------------------------------------------------------------------
-
-get_time() {
-    [ -z "${TRUST_JOB_TIME}" ] && return
-
-    ## Interest for checking unusual time computation
-    local time_cpu=$( eval ${TRUST_JOB_TIME} )
-
-    printf "Elapsed time: "
-    echo ${time_cpu} | tee -a ${file_time}
-}
-
-
-##
-##--------------------------------------------------------------------------------
-
-get_memy() {
-    [[ -z "${TRUST_JOB_RAM_P}" && -z "${TRUST_JOB_RAM_V}" ]] && return
-
-    ## Interest for checking unusual memory usage
-    local memory_pmax=$( eval ${TRUST_JOB_RAM_P} )
-    local memory_vmax=$( eval ${TRUST_JOB_RAM_V} )
-
-    printf "Memory max usage (physical/virtual): "
-    echo ${memory_pmax}' / '${memory_vmax} | tee -a ${file_memy}
+    [ $TRUST_FLAG_RESULT == 'FAILED' ] && get_out L
 }
 
@@ -428,5 +477,5 @@
 
     ## Production mode (-p|--prod)
-    if [ ${TRUST_FLAG_PROD} -eq 1 ]; then
+    if [ ${TRUST_FLAG_PROD} == 'true' ]; then
 
 	## Create or append trusting logfile
@@ -542,5 +591,5 @@
 
     ## Save tested configuration if trusting failed in production mode (-p|--prod)
-    if [[ ${TRUST_FLAG_RESULT} == 'FAILED' && ${TRUST_FLAG_PROD} -eq 1 ]]; then
+    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}                 * \
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 8833)
+++ /branches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST/install_new_branch.sh	(revision 8834)
@@ -46,5 +46,5 @@
 printf "\nWhat branch do you want to install in "${TRUST_DIR_WORK}" for trusting test ? "
 echo 'Enter 0 to abort'
-select branch in 'trunk' $( svn ls ${TRUST_SVN_REPO}/branches/2015 | tr -d / | sort -r ); do
+select branch in 'trunk' $( svn ls ${TRUST_SVN_REPO}/nemo/svn/branches/2015 | tr -d / | sort -r ); do
 
     if [ $REPLY -eq 0 ]; then exit 1; else export TRUST_SVN_BRANCH=$branch; fi
@@ -74,8 +74,8 @@
 
     if [ $elmt == 'TOOLS/maketools' ]; then
-	svn co -q ${TRUST_SVN_REPO}/${svn_bran}/NEMOGCM/TOOLS --depth empty
+	svn co -q ${TRUST_SVN_REPO}/nemo/svn/${svn_bran}/NEMOGCM/TOOLS --depth empty
 	svn up -q $elmt
     else
-	svn co -q ${TRUST_SVN_REPO}/${svn_bran}/NEMOGCM/$elmt $elmt
+	svn co -q ${TRUST_SVN_REPO}/nemo/svn/${svn_bran}/NEMOGCM/$elmt $elmt
     fi
 
Index: /branches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST/trusting.sh
===================================================================
--- /branches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST/trusting.sh	(revision 8833)
+++ /branches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST/trusting.sh	(revision 8834)
@@ -4,4 +4,5 @@
 cd $( dirname $0 )
 
+##--------------------------------------------------------------------------------
 ## Set flags & defaults
 ##--------------------------------------------------------------------------------
@@ -9,28 +10,26 @@
 TRUST_MAIN_DIR=$PWD
 
-TRUST_FLAG_DEBUG=0; TRUST_FLAG_PROD=0; TRUST_FLAG_HELP=0
-TRUST_FLAG_RESULT='FAILED'; TRUST_FLAG_ERROR=0
+TRUST_FLAG_DEBUG='false'  ; TRUST_FLAG_HELP='false' ; TRUST_FLAG_PROD='false'
 
-## No update on SVN directories & 'FAILED' result for 'Unknown error' )
-TRUST_SVN_ACTION='svn status'
-
-xios_mode='--full'; stdout_redir='>&'
 rev=$( svn info | awk '(NR == 9) {print $NF}' )
 
 
-## Get options (replacing initials settings)
+##--------------------------------------------------------------------------------
+## Get arguments from command line
 ##--------------------------------------------------------------------------------
 
-while [ $# -ne 0 ]; do
+while getopts a:b:de:f:j:hm:n:r:t:pu:v:w: arg; do
 
-    case $1 in
-	'-a'|'--archive') TRUST_IO_FORC_TAR=$2; shift 2;; '-b'|'--branch' ) TRUST_SVN_BRANCH=$2; shift 2;;
-	'-d'|'--debug'  ) TRUST_FLAG_DEBUG=1 ; shift  ;; '-e'|'--email'  ) TRUST_TEST_MAILING=$2; shift 2;;
-	'-f'|'--forcdir') TRUST_IO_FORC_PATH=$2; shift 2;; '-j'|'--job'    ) TRUST_COMPILE_NPROC=$2; shift 2;;
-	'-h'|'--help'   ) TRUST_FLAG_HELP=1 ; shift  ;; '-m'|'--machine') TRUST_MAIN_HPCC=$2; shift 2;;
-	'-n'|'--newconf') TRUST_CFG_NEW=$2; shift 2;; '-r'|'--refconf') TRUST_CFG_REF=$2; shift 2;;
-	'-t'|'--time'   ) TRUST_JOB_TIMEOUT=$2; shift 2;; '-p'|'--prod'   ) TRUST_FLAG_PROD=1 ; shift  ;;
-	'-u'|'--user'   ) TRUST_MAIN_USER=$2; shift 2;; '-v'|'--version') TRUST_SVN_REV=$2; shift 2;;
-	'-w'|'--workdir') TRUST_DIR_WORK=$2; shift 2;; "*"             ) TRUST_FLAG_HELP=1 ; shift  ;;
+    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'                                    ;;
     esac
 
@@ -38,11 +37,13 @@
 
 
-## Initialization (HPC & user environment)
+##--------------------------------------------------------------------------------
+## Initialization (user & HPC 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_USER}.cfg || ! -e cfg/${TRUST_MAIN_HPCC}.cfg \
+      || ${TRUST_FLAG_HELP} == 'true'                                      ]]; then
     cat ./inc/trusting_help.txt
 
-    if [ ${TRUST_FLAG_HELP} -eq 0 ]; then
+    if [ ${TRUST_FLAG_HELP} == 'false' ]; then
 	printf "\n\n\033[0;33m"
 	printf "At least one configuration (arch or user) file is missing or misspelled:"
@@ -56,28 +57,22 @@
     exit 1
 else
-    . ./inc/trusting.env && . ./inc/trusting_func.sh
+    ## Verbose output on debug mode
+    [ ${TRUST_FLAG_DEBUG} == 'true' ] && set -vx
 
-    ## DEBUG option to speed up & expand verbosity of compilation
-    [ ${TRUST_FLAG_DEBUG} -eq 1 ] && { set -vx; xios_mode=''; stdout_redir='>'; }
-
-    ## If -v|--version option has been set, modify default SVN action on directories
-    if   [ $( echo ${TRUST_SVN_REV} | grep  "HEAD\|up\|update"                     ) ]; then
-	TRUST_SVN_ACTION='svn update -r HEAD'
-    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
+    . ./inc/trusting.env
+    . ./inc/trusting_func.sh
 
 fi
 
 
-## Display contextual summary of trusting test
+##--------------------------------------------------------------------------------
+## Trusting workflow
 ##--------------------------------------------------------------------------------
 
+## Display summary of test
+##------------------------
+
 echo
-
 if [ -t 0 ]; then cat ./inc/banner.txt; else cat ./inc/banner.html; fi
-
 echo
 echo '****************************************************************************************************'
@@ -91,6 +86,8 @@
 printf "\t§ User installation\t\t%s\n\n" 	       ${TRUST_MAIN_USER}
 echo
-printf "\t§ Testing configuration\t\t%s based on %s\n" ${TRUST_CFG_NEW} ${TRUST_CFG_REF}
-printf "\t§ SVN working copy\t\t%s/%s\n"               ${TRUST_DIR_WORK} ${TRUST_SVN_BRANCH}
+printf "\t§ Testing configuration\t\t%s based on %s\n" \
+    ${TRUST_CFG_NEW} ${TRUST_CFG_REF}
+printf "\t§ SVN working copy\t\t%s/%s\n"               \
+    ${TRUST_DIR_WORK} ${TRUST_SVN_BRANCH}
 if [ ${TRUST_TEST_BENCHMARK} ]; then
 printf "\t§ Benchmark folder\t\t%s\n"       	       ${TRUST_TEST_BENCHMARK}
@@ -98,149 +95,76 @@
 
 
-## Make timestamped directory with messenger files
-##--------------------------------------------------------------------------------
+## Testing directory
+##------------------
 
 print_step 'Timestamped testing directory'
-
-mkdir -p ${TRUST_TEST_DIR} ${TRUST_TEST_BENCHMARK} || get_out B
-cd       ${TRUST_TEST_DIR}
-echo     ${TRUST_TEST_DIR}
-
-init_files
-
-get_date
+init
 
 
-## Get SVN revision on XIOS & NEMO essentials directories
-##--------------------------------------------------------------------------------
+## Local working copy
+##-------------------
 
-print_step "SVN action on NEMO directories: ${TRUST_SVN_ACTION}"
-
+print_step 'SVN action on NEMO directories'
+echo "${TRUST_SVN_ACTION} on ${TRUST_SVN_NEMOGCM}:"
 get_nemo_rev
 
 
-## Check softwares versions (after sourced arch environment)
-##--------------------------------------------------------------------------------
+## Environment
+##------------
 
 print_step 'Get testing environment'
-
 get_soft_rel
 
-cat model.log | awk '{printf "%-20s %s %s\n", $1, $2, $3}'
-env | sort > env.log
+
+## Compilation(s)
+##---------------
+
+print_step 'Compile XIOS'
+compile_xios
+
+print_step "Compile ${TRUST_CFG_REF} configuration"
+compile_nemo
 
 
-## XIOS compilation from scratch
-##--------------------------------------------------------------------------------
-
-print_step 'Compile XIOS'
-
-cd ${TRUST_IO_XIOS}
-
-eval ./make_xios ${xios_mode} --arch ${TRUST_MAIN_HPCC} --job ${TRUST_COMPILE_NPROC} \
-    ${stdout_redir} /dev/null
-
-[ ! -e lib/libxios.a ] && get_out D || echo 'Success'
-
-
-## NEMO compilation from scratch
-##--------------------------------------------------------------------------------
-
-print_step "Compile ${TRUST_CFG_REF} configuration"
-
-cd ${TRUST_SVN_NEMOGCM}/CONFIG
-
-if [[ -d ${TRUST_CFG_NEW} && ${TRUST_FLAG_DEBUG} -eq 0 ]]; then
-    ./makenemo -n ${TRUST_CFG_NEW} clean_config \
-	> /dev/null <<EOF
-y
-EOF
-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}    \
-    ${stdout_redir} /dev/null
-
-[ ! -e ${TRUST_CFG_NEW}/BLD/bin/nemo.exe ] && get_out E || echo 'Success'
-
-
-## Get all inputs for running
-##--------------------------------------------------------------------------------
+## Inputs
+##-------
 
 print_step 'Set job (copying or extracting inputs)'
-
-cd ${TRUST_TEST_DIR}
-
 get_inputs
 
-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 {} . \;
-
-
-## Check inputs
-##--------------------------------------------------------------------------------
-
 print_step 'Compare inputs'
-
 diff_inputs
 
 
-## Job submission & computation
-##--------------------------------------------------------------------------------
+## Job
+##----
 
 print_step 'Submit job'
-
-## 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_submit
 
 print_step 'Pending job'
-
 job_pending
 
 print_step 'Job finished'
 
-
-## Check job state & get computation performances if succeeded
-##--------------------------------------------------------------------------------
-
 print_step 'Test 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
+job_state
 
 print_step 'Get job performances'
-
-get_time
-
-get_memy
+job_perfs
 
 
-## Check outputs
-##--------------------------------------------------------------------------------
-
-TRUST_FLAG_RESULT='OK' ## 'OK' by default
+## Outputs
+##--------
 
 print_step 'Compare outputs'
-
 diff_results
 
 print_step 'Compare restarts'
-
 diff_restarts
-
-[ $TRUST_FLAG_RESULT= == 'FAILED' ] && get_out L
 
 
 ## End, at least nothing major has changed ;-)
-##--------------------------------------------------------------------------------
+##--------------------------------------------
 
 get_out 0
