Index: /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/config/romr005.cfg
===================================================================
--- /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/config/romr005.cfg	(revision 5680)
+++ /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/config/romr005.cfg	(revision 5681)
@@ -1,3 +1,4 @@
 # User configuration
+
 
 # Global Directories:
@@ -6,11 +7,16 @@
 DIR_STOR=$WORKDIR/NEMO/trusting_sav
 
+
 # NEMO overall configuration:
 [ -z "${NEMO_BRAN}" ] && NEMO_BRAN='trunk'
+NEMO_HOME=${DIR_WORK}/NEMO/${NEMO_BRAN}/NEMOGCM
+
 [ -z "${REFE_CONF}" ] && REFE_CONF='ORCA2_LIM_PISCES'
 [ -z "${TEST_CONF}" ] && TEST_CONF='O2LP_trust'
+KEYS_ADD=''; KEYS_DEL=''
+
+NEMO_FORC=${DIR_WORK}/NEMO/FORC
 [ -z "${NEMO_TARF}" ] && NEMO_TARF='ORCA2_LIM_nemo_v3.6.tar'
-NEMO_HOME=${DIR_WORK}/NEMO/${NEMO_BRAN}/NEMOGCM
-NEMO_FORC=${DIR_WORK}/NEMO/FORC
+
 
 # Comparatives directories localization:
@@ -18,8 +24,10 @@
 TEST_DIR=${DIR_SCRA}/${REFE_CONF}/${NEMO_BRAN}/trusting_${DATE}
 
+
 # External softs directories:
 DIR_XIOS=${DIR_WORK}/XIOS/xios-1.0
 #DIR_OASI=${DIR_WORK}/OASIS        
 
+
 # Mailing list to inform of a failure, -p|--publish option required
 [ -z "$EMAIL"] && EMAIL=ntmlod@locean-ipsl.upmc.fr
Index: /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/config/user_template.cfg
===================================================================
--- /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/config/user_template.cfg	(revision 5680)
+++ /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/config/user_template.cfg	(revision 5681)
@@ -1,26 +1,43 @@
-# Copy to ./${CFG_USER}.cfg, fill in according to your installation
+## Copy to ./${CFG_USER}.cfg, fill in according to your installation
 
-# User configuration
+## User configuration
+##-------------------
 
-# NEMO overall configuration:
-[ -z "${NEMO_BRAN}" ] && NEMO_BRAN=''        # ex: 'trunk', 'nemo_v3_6_STABLE', ...
-[ -z "${CONF_REFE}" ] && REFE_CONF=''        # ex: 'ORCA2_LIM_PISCES', 'GYRE', ...
-[ -z "${CONF_TEST}" ] && TEST_CONF=''        # ex: "${CONF_REFE}_trust", ...
-[ -z "${NEMO_TARF}" ] && NEMO_TARF=''     # Archive name (ex: 'ORCA2_LIM_nemo_v3.6.tar', ...), let blank if not requested
-NEMO_HOME=''                              # NEMOGCM directory for computation (./ARCH, ./CONFIG, ...)
-                                             # ex: ".../NEMO/${NEMO_BRAN}/NEMOGCM", ...
-NEMO_FORC=''                              #     Directory with forcing archive from DODS/ESGF server to extract
-                                           # or    " "     ""  all inputs files to copy into ${TEST_DIR}
 
-# Comparatives directories localization:
-REFE_DIR=''			      	  # "Standard" folder where previous result files have been stored for comparison
-                                             # ex: ".../${CONF_REFE}/${NEMO_BRAN}"
-TEST_DIR=''			      	  # Test       folder for computation
-                                             # ex: ".../${CONF_REFE}/${NEMO_BRAN}/trusting_${DATE}"
+## NEMO overall installation:
+[ -z "${NEMO_BRAN}" ] && NEMO_BRAN=''     ## NEMO SVN branch         to test
+                                             ## ex: 'trunk', 'nemo_v3_6_STABLE', ...
+NEMO_HOME=''                              ## NEMOGCM directory (includes ./ARCH, ./CONFIG, ...)
+                                             ## ex: ".../NEMO/${NEMO_BRAN}/NEMOGCM", ...
+## ${NEMO_BRAN} must be consistent with URL branch that have been checkout by SVN to build ${NEMO_HOME}
 
-# External softs directories:
-DIR_XIOS=''			      	     # ex: '.../XIOS/xios-1.0'
-#DIR_OASI=''			      	     # ex: '.../OASIS'
+### Reference/'Trusting' configuration
+[ -z "${REFE_CONF}" ] && REFE_CONF=''     ## Reference configuration to test
+                                             ## ex: 'ORCA2_LIM_PISCES', 'GYRE', ...
+[ -z "${TEST_CONF}" ] && TEST_CONF=''     ## Testing configuration name
+                                             ## ex: "${REFE_CONF}_trust", ...
+KEYS_ADD=''; KEYS_DEL=''                  ## CPP keys to add or remove from reference configuration
+                                             ## ex: "key_mpp_rep key_tide", ...
+[ "" == '' ] && KEYS_ADD='' && KEYS_DEL=''
 
-# Mailing list to inform of a failure (-p|--publish option required)
+### Inputs
+NEMO_FORC=''                              ## Directory with forcing archive from DODS/ESGF server to extract or
+                                          ##    " "     ""  all inputs files to copy into ${TEST_DIR}
+[ -z "${NEMO_TARF}" ] && NEMO_TARF=''     ## Archive inputs name, let blank if not requested
+                                             ## ex: 'ORCA2_LIM_nemo_v3.6.tar', 'AMM12_v3.6.tar', ...
+
+
+## Comparative directories path:
+REFE_DIR=''			      	  ## "Standard" folder where benchmark result files have been stored for comparison
+                                             ## ex: ".../${REFE_CONF}/${NEMO_BRAN}"
+TEST_DIR=''			      	  ## Test       folder for computation
+                                             ## ex: ".../${REFE_CONF}/${NEMO_BRAN}/trusting_${DATE}"
+
+
+## External softs directories:
+DIR_XIOS=''			      	     ## ex: '.../XIOS/xios-1.0'
+#DIR_OASI=''			      	     ## ex: '.../OASIS'
+
+
+## Mailing list to inform of a failure (-p|--publish option required)
 [ -z "$EMAIL"] && EMAIL=''
Index: /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting.env
===================================================================
--- /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting.env	(revision 5680)
+++ /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting.env	(revision 5681)
@@ -11,7 +11,8 @@
 . ${NEMO_TRUS}/config/${NEMO_USER}.cfg
 export NEMO_HOME NEMO_BRAN
-export REFE_CONF TEST_CONF REFE_DIR TEST_DIR
+export REFE_CONF TEST_CONF KEYS_ADD KEYS_DEL
+export NEMO_FORC NEMO_TARF
+export REFE_DIR  TEST_DIR
 export DIR_XIOS  #DIR_OASI
-export NEMO_FORC NEMO_TARF
 export EMAIL
 
Index: /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting.sh
===================================================================
--- /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting.sh	(revision 5680)
+++ /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting.sh	(revision 5681)
@@ -11,17 +11,21 @@
 xios_full='--full'; stderr_redir='>&' ## DEBUG options
 
+
 ## Get options for replacing some initials settings
 ##---------------------------------------------------
 while [ $# -ne 0 ]; do
+
     case $1 in
-	-a|--archive) NEMO_TARF=$2         ; shift 2;; -b|--branch ) NEMO_BRAN=$2         ; shift 2;;
-	-d|--debug  ) set -vx; DEBUG=1     ; shift  ;; -e|--email  ) EMAIL=$2             ; shift 2;;
-	-j|--job    ) NPROC=$2             ; shift 2;; -h|--help   ) cat trusting_help.txt; exit  1;;
-	-m|--machine) NEMO_HPCC=$2         ; shift 2;; -n|--newconf) TEST_CONF=$2         ; shift 2;;
-	-r|--refconf) REFE_CONF=$2         ; shift 2;; -t|--time   ) TIME_LIMI=$2         ; shift 2;;
-	-p|--publish) PUBLISH=1            ; shift  ;; -u|--user   ) NEMO_USER=$2         ; shift 2;;
-	-v|--version) NEMO_VERS=$2         ; shift 2;;            *) cat trusting_help.txt; exit  1;;
+	'-a'|'--archive') NEMO_TARF=$2    ; shift 2;; '-b'|'--branch ') NEMO_BRAN=$2         ; shift 2;;
+	'-d'|'--debug  ') set -vx; DEBUG=1; shift  ;; '-e'|'--email  ') EMAIL=$2             ; shift 2;;
+	'-j'|'--job    ') NPROC=$2        ; shift 2;; '-h'|'--help   ') cat trusting_help.txt; exit  1;;
+	'-m'|'--machine') NEMO_HPCC=$2    ; shift 2;; '-n'|'--newconf') TEST_CONF=$2         ; shift 2;;
+	'-r'|'--refconf') REFE_CONF=$2    ; shift 2;; '-t'|'--time   ') TIME_LIMI=$2         ; shift 2;;
+	'-p'|'--publish') PUBLISH=1       ; shift  ;; '-u'|'--user   ') NEMO_USER=$2         ; shift 2;;
+	'-v'|'--version') NEMO_VERS=$2    ; shift 2;; "*"             ) cat trusting_help.txt; exit  1;;
     esac
+
 done
+
 
 ## Initialization (super-computer & user environment)
@@ -43,4 +47,5 @@
 . ./trusting_func.sh
 
+
 ## Summary of trusting test context
 ##---------------------------------------------------
@@ -53,4 +58,5 @@
 Trusting SVN version: $( svn info | awk '(NR == 9) {print $NF}' )\n"
 
+
 ## Making timestamped directory with messenger files
 ##---------------------------------------------------
@@ -60,8 +66,10 @@
 init_files && get_date
 
+
 ## SVN action on XIOS & NEMO essentials directories
 ##---------------------------------------------------
 print_step 'SVN command on NEMO directories:'
 get_nemo_rev
+
 
 ## Check softwares versions (source arch environment)
@@ -73,4 +81,5 @@
 cat model.log
 
+
 ## XIOS compiling
 ##---------------------------------------------------
@@ -78,5 +87,6 @@
 cd ${DIR_XIOS}
 [ $DEBUG -eq 1 ] && xios_full='' && stderr_redir='>'
-eval ./make_xios ${xios_full} --arch ${NEMO_HPCC} --job $NPROC ${stderr_redir} /dev/null
+eval ./make_xios ${xios_full} --arch ${NEMO_HPCC} --job $NPROC \
+    ${stderr_redir} /dev/null
 [ ! -e ${DIR_XIOS}/lib/libxios.a ] && get_out 1
 
@@ -85,9 +95,16 @@
 print_step "Compile ${REFE_CONF} configuration"
 cd ${NEMO_CONF}
-[[ -d ${TEST_CONF} && $DEBUG -eq 0 ]] && eval ./makenemo -n ${TEST_CONF} clean_config > /dev/null <<EOF
+
+if [[ -d ${TEST_CONF} && $DEBUG -eq 0 ]]; then
+    eval ./makenemo -n ${TEST_CONF} clean_config > /dev/null <<EOF
 y
 EOF
-eval ./makenemo -n ${TEST_CONF} -r ${REFE_CONF} -m ${NEMO_HPCC} -j $NPROC ${stderr_redir} /dev/null
+fi
+
+eval ./makenemo -n ${TEST_CONF} -r ${REFE_CONF} -m ${NEMO_HPCC} -j $NPROC \
+                add_key ${KEYS_ADD} del_key ${KEYS_DEL}                   \
+    ${stderr_redir} /dev/null
 [ ! -e ${TEST_CONF}/BLD/bin/nemo.exe ] && get_out 2
+
 
 ## Get namelists, xml & forcing files for running
@@ -100,8 +117,10 @@
 [ $( find . -name '*.gz' -print -quit ) ] && find . -name '*.gz' -exec gunzip {} \;
 
+
 ## Check input files in all cases
 ##---------------------------------------------------
 print_step 'Compare with standard input files list'
 diff_inputs
+
 
 ## Job submission & computing
@@ -114,7 +133,9 @@
 print_step 'Job finished'
 
+
 ## Job state
 ##---------------------------------------------------
 print_step 'Test job state'
+
 if   [[ ! -e time.step || $( grep -q 'E R R O R' ocean.output ) ]]; then
     echo 'Error'
@@ -131,4 +152,5 @@
 ST='OK' ## 'OK' by default
 
+
 ## Inspect output text files
 ##---------------------------------------------------
@@ -136,9 +158,11 @@
 diff_results
 
+
 ## Inspect output NetCDF files
 ##---------------------------------------------------
 print_step 'Test last restart files diff'
 diff_restart
-[ "$ST" == 'FAILED' ] && get_out 8
+[ $ST == 'FAILED' ] && get_out 8
+
 
 ## Get comments (ocean.output & diff model.log)
@@ -146,4 +170,5 @@
 comments 'W A R N I N G'
 
+
 ## End
 ##---------------------------------------------------
Index: /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting_func.sh
===================================================================
--- /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting_func.sh	(revision 5680)
+++ /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting_func.sh	(revision 5681)
@@ -13,5 +13,7 @@
 FILE_TRUS=trusting_${DATE}_$PATTERNAME.txt; FILE_ARCH=trusting_${DATE}_$PATTERNAME.tar.gz
 
+
 print_step() { printf "\nStep.....\n$1\n"; }
+
 
 init_files() {
@@ -27,4 +29,5 @@
 }
 
+
 get_date() {
     local dat=$( date -ud ${DATE} +"%F %R %Z" )
@@ -32,4 +35,5 @@
     echo $dat >> ${FILE_DATE}
 }
+
 
 get_nemo_rev() {
@@ -54,5 +58,5 @@
 
 	## For time being, just get revision number from XIOS
-	if [ "$dir" == "${DIR_XIOS}" ]; then
+	if [ $dir == ${DIR_XIOS} ]; then
 	    rev_loc=$( svn info $dir | awk '(NR == 9) {print $NF}' )
 	    echo 'XIOS '${rev_loc} >> model.log
@@ -73,4 +77,5 @@
 }
 
+
 get_soft_rel() {
     local soft_rel
@@ -85,5 +90,5 @@
 	fi
 
-	[ "$soft" == "$COMPILER" ] && soft_rel=$( $soft --version | grep -m1 -oe '\<[0-9. ]*\>' )
+	[ $soft == $COMPILER ] && soft_rel=$( $soft --version | grep -m1 -oe '\<[0-9. ]*\>' )
 	## Cleaning characters string to display proper soft name
 	soft=$( echo $soft | sed 's#\\##g; s#[/-]$##' )
@@ -95,4 +100,5 @@
 }
 
+
 get_inputs() {
     local cmd_iol="tar -tvf ${NEMO_FORC}/${NEMO_TARF}" cmd_iof="tar -vxf ${NEMO_FORC}/${NEMO_TARF}"
@@ -101,4 +107,5 @@
     ${cmd_iol} > inputs_list.txt && ${cmd_iof} > /dev/null
 }
+
 
 diff_inputs() {
@@ -106,21 +113,23 @@
     local files_list='' mesg='Same' 
 
-    for file in inputs_list.txt namelist_* *.xml; do
+    for file in inputs_list.txt namelist_* *.xml cpp_*; do
 	dif=''
-	if [ -e ${REFE_DIR}/$file ]; then dif=$( diff -q $file ${REFE_DIR}/$file ); else dif=0; fi
+
+	if [ -e ${REFE_DIR}/$file ]; then
+	    dif=$( diff -q $file ${REFE_DIR}/$file )
+	else dif=0; fi
 
 	if [ -n "$dif" ]; then
 	    mesg='Different'
-	    (( "$dif" != '0' )) && echo $dif && files_list+=$file' '
+	    [ $dif != '0' ] && echo $dif && files_list+=$file' '
 	fi
 
     done
 
-    [ "$mesg" == 'Same' ] && echo $mesg
-    echo $mesg >> ${FILE_INPT}
-
+    [ $mesg == 'Same' ] && echo $mesg | tee -a ${FILE_INPT}
     [ -n "${files_list}" ] && echo 'Inputs  : '${files_list}'differ<br>' \
 	>> temp_${FILE_COMM}
 }
+
 
 job_pending() {
@@ -146,4 +155,5 @@
 }
 
+
 diff_results() {
     local files_list=''
@@ -159,9 +169,10 @@
 }
 
+
 diff_restart() {
-    local base_name dif dift file list_comp list_tmsp nb_dom
-    local files_list='' 
-
-    [ ! -e  ${REFE_DIR}/time.step ] && export ST='FAILED' && get_out 7
+    local base_name dif file list_comp list_tmsp nb_dom
+    local files_list='' dift=0
+
+    [ ! -e ${REFE_DIR}/time.step ] && export ST='FAILED' && get_out 7
     export TIME_STEP=$( cat ${REFE_DIR}/time.step | tr -d [:space:] )
     echo 'Last time step of benchmark run: '${TIME_STEP}
@@ -195,30 +206,26 @@
 			       | awk '/records/ {print $0}' | sed '2 s/^/,/' | tr -d '\n'  )
 
-			if [[ -n "${dif}" && $( echo $dif | awk '{ print $1 }') -ne 0 ]]; then
+			if [[ -n "$dif" && (( $( echo $dif | awk '{print $1}' ) -ne 0 )) ]]; then
 			    export ST='FAILED' && files_list+=$file' '
 			    let dift+=$( echo $dif | awk '{print $1}' )
-			    echo $file'.nc: '$dif
-			else
-			    echo 'identical'
+			    echo $file.nc': '$dif
 			fi
 
-		    else
-			export ST='FAILED' && get_out 7
-		    fi
-
-		else
-		    continue
-		fi
+		    else export ST='FAILED' && get_out 7; fi
+
+		else continue; fi
 
 	    done
 	done
 
-	[ -n "${files_list}" ] && echo 'Restarts: '${files_list}$dift' record(s) differ<br>' \
-	    >> temp_${FILE_COMM}
-    else
-	export ST='FAILED'
-    fi
-
-}
+	if (( $dift != 0 )); then
+	    echo 'Restarts: '${files_list}$dift' record(s) differ<br>' \
+		>> temp_${FILE_COMM}
+	else echo 'No restart differ'; fi
+
+    else export ST='FAILED'; fi
+
+}
+
 
 get_cpu_time() {
@@ -227,4 +234,5 @@
     echo ${real_cpu_time} | tee -a ${FILE_CPUT}
 }
+
 
 comments() {
@@ -242,4 +250,5 @@
 }
 
+
 mesg_make() {
     ## Format comments for web
@@ -250,4 +259,5 @@
 }
 
+
 mesg_publish() {
     local cmd
@@ -259,8 +269,9 @@
 	$cmd ${FILE_TRUS} >> ${REFE_DIR}/trusting_$PATTERNAME.txt
 
-        ## Send mail only when FAILED
-	if [[ ! -z "$EMAIL" && "$ST" == 'FAILED' ]]; then
-	    cat << END_MAIL > trusting.mail
-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+  ## Send mail only when FAILED
+	if [[ ! -z "$EMAIL" && $ST == 'FAILED' ]]; then
+	    cat <<END_MAIL \
+		> trusting.mail
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
 Dear $USER,
@@ -270,5 +281,5 @@
 Archive created: ${FILE_ARCH} in ${REFE_DIR}
 
-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
 END_MAIL
@@ -282,4 +293,5 @@
 }
 
+
 get_out() {
     ERR=$1
@@ -287,5 +299,5 @@
     cd ${TEST_DIR}
 
-    if [ "$ST" == 'FAILED' ]; then
+    if [ $ST == 'FAILED' ]; then
 
         ## Error identification
@@ -309,9 +321,9 @@
 
     ## Save tested configuration if trusting failed
-    if [[ "$ST" == 'FAILED' && $PUBLISH -eq 1 && $DEBUG -eq 0 ]]; then
+    if [[ $ST == 'FAILED' && $PUBLISH -eq 1 && $DEBUG -eq 0 ]]; then
 	echo 'Creating archive '${FILE_ARCH}' under '${REFE_DIR}
-	tar -czf ${REFE_DIR}/${FILE_ARCH} * ${TEST_DIR}/${NEMO_CONF}/${TEST_CONF}/cpp_*  \
-                                 	    ${TEST_DIR}/${NEMO_CONF}/${TEST_CONF}/MY_SRC \
-	                                    ${TEST_DIR}/${NEMO_CONF}/${TEST_CONF}/WORK
+	tar -czf ${REFE_DIR}/${FILE_ARCH} * ${NEMO_HOME}/CONFIG/${TEST_CONF}/cpp_*  \
+                                 	    ${NEMO_HOME}/CONFIG/${TEST_CONF}/MY_SRC \
+	                                    ${NEMO_HOME}/CONFIG/${TEST_CONF}/WORK
     fi
 
