Index: /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/config/X64_CURIE_cron.cfg
===================================================================
--- /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/config/X64_CURIE_cron.cfg	(revision 5689)
+++ /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/config/X64_CURIE_cron.cfg	(revision 5690)
@@ -4,5 +4,5 @@
 CDO='netcdf-utils-'
 COMPILER='ifort'
-MPI='bullxmpi\/'
+MPI='bullxmpi/'
 NETCDF='netcdf-'
 
Index: /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting.env
===================================================================
--- /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting.env	(revision 5689)
+++ /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting.env	(revision 5690)
@@ -2,11 +2,13 @@
 
 
-## Time-stamp & filename pattern
+## Patterns (time-stamp & filename)
+##--------------------------------------
 dat=$( date )
+## UTC time zone for timestamping
 export DATE=$( date -ud "$dat" +"%Y%m%d%Z%H%M" )
 export PATTERNAME=${NEMO_USER}'_'${NEMO_HPCC}
 
-## Sourcing user configuration
-##--------------------------------------
+## Source user configuration
+##---------------------------------------------------
 . ${NEMO_TRUS}/config/${NEMO_USER}.cfg
 export NEMO_HOME NEMO_BRAN
@@ -27,6 +29,6 @@
 export NEMO_TCMP NEMO_TRBD
 
-## Sourcing super-computer configuration
-##--------------------------------------
+## Source super-computer configuration
+##---------------------------------------------------
 . ${NEMO_TRUS}/config/${NEMO_HPCC}.cfg
 export CDO      COMPILER MPI      NETCDF
Index: /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting.sh
===================================================================
--- /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting.sh	(revision 5689)
+++ /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting.sh	(revision 5690)
@@ -7,10 +7,9 @@
 ##---------------------------------------------------
 NEMO_TRUS=$PWD
-DEBUG=0; PUBLISH=0; TIME_STEP=0
-IMOD=0; ST='FAILED' ## No 'module' command & 'FAILED' status
-xios_full='--full'; stderr_redir='>&' ## DEBUG options
+DEBUG=0; PUBLISH=0
+IMOD=0; ST='FAILED' ## No modules system & 'FAILED' status
 
 
-## Get options for replacing some initials settings
+## Get options for replacing initials settings
 ##---------------------------------------------------
 while [ $# -ne 0 ]; do
@@ -27,4 +26,8 @@
 
 done
+
+## DEBUG options to speed up & expand verbosity of compilation
+xios_full='--full'; stderr_redir='>&'
+[ $DEBUG -eq 1 ] && xios_full='' && stderr_redir='>'
 
 
@@ -48,5 +51,5 @@
 
 
-## Summary of trusting test context
+## Display contextual summary of trusting test
 ##---------------------------------------------------
 echo 'NEMO Trusting test:'
@@ -58,5 +61,5 @@
 
 
-## Making timestamped directory with messenger files
+## Make timestamped directory with messenger files
 ##---------------------------------------------------
 cd ${TEST_DIR}
@@ -66,10 +69,10 @@
 
 
-## SVN action on XIOS & NEMO essentials directories
+## Get SVN revision on XIOS & NEMO essentials directories
 ##---------------------------------------------------
 print_step 'SVN command on NEMO directories:'; get_nemo_rev
 
 
-## Check softwares versions (source arch environment)
+## Check softwares versions (after sourced arch environment)
 ##---------------------------------------------------
 print_step 'Get softwares releases'
@@ -81,15 +84,15 @@
 
 
-## XIOS compiling
+## XIOS compilation from scratch
 ##---------------------------------------------------
 cd ${DIR_XIOS}
 
 print_step 'Compile XIOS'
-[ $DEBUG -eq 1 ] && xios_full='' && stderr_redir='>'
 eval ./make_xios ${xios_full} --arch ${NEMO_HPCC} --job $NPROC \
     ${stderr_redir} /dev/null
 [ ! -e ${DIR_XIOS}/lib/libxios.a ] && get_out 1
 
-## NEMO config compiled from scratch
+
+## NEMO compilation from scratch
 ##---------------------------------------------------
 cd ${NEMO_CONF}
@@ -109,9 +112,9 @@
 
 
-## Get namelists, xml & forcing files for running
+## Get all inputs for running
 ##---------------------------------------------------
 cd ${TEST_DIR}
 
-print_step 'Set job (copying & extracting input files)'
+print_step 'Set job (copying or extracting inputs)'
 cp ${NEMO_CONF}/${TEST_CONF}/cpp_* .
 find ${NEMO_CONF}/${TEST_CONF}/EXP00 -regex '.*\(_cfg\|.in\|opa\|_ref\|.xml\)' -exec cp {} . \;
@@ -122,10 +125,10 @@
 
 
-## Check input files in all cases
+## Check inputs
 ##---------------------------------------------------
-print_step 'Compare with benchmark input files list'; diff_inputs
+print_step 'Compare inputs to benchmark files'; diff_inputs
 
 
-## Job submission & computing
+## Job submission & computation
 ##---------------------------------------------------
 print_step 'Submit job'; JOB_ID=$( eval ${JOB_SUBM} )
@@ -137,5 +140,5 @@
 
 
-## Job state & get time computation if succeeded
+## Check job state & get computing time if succeeded
 ##---------------------------------------------------
 print_step 'Test job state'
@@ -151,5 +154,5 @@
 
 
-## Inspect outputs
+## Check outputs
 ##---------------------------------------------------
 ST='OK' ## 'OK' by default
@@ -159,5 +162,5 @@
 
 
-## End
+## End, at least nothing has changed ;-)
 ##---------------------------------------------------
 get_out 'Code is reliable'
Index: /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting_func.sh
===================================================================
--- /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting_func.sh	(revision 5689)
+++ /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting_func.sh	(revision 5690)
@@ -12,5 +12,5 @@
 FILE_COMM=mesg_11_comments_$PATTERNAME.txt;
 
-## Trusting summary & archive timestamped filenames
+## Timestamped outcome & archive filenames
 FILE_TRUS=trusting_${DATE}_$PATTERNAME.txt; FILE_ARCH=trusting_${DATE}_$PATTERNAME.tar.gz
 
@@ -27,5 +27,5 @@
     echo 'Comments'    	 >  ${FILE_COMM}
 
-    # 'Failed' status with 'Unknown error' by default
+    ## 'Failed' status with 'Unknown error' by default
     echo $ST             \
 	>> ${FILE_STAT}
@@ -36,5 +36,6 @@
 
 get_date() {
-    local dat=$( date -ud ${DATE} +"%F %R %Z" )
+    ## UTC time zone for timestamping
+    local dat=$( date -ud "${DATE}" +"%F %R %Z" )
 
     echo $dat          \
@@ -58,4 +59,5 @@
     fi
 
+    ## Loop on essential directories
     for dir in ${NEMO_ARCH} ${NEMO_CONF} ${NEMO_ENGI} \
                ${NEMO_EAGR} ${NEMO_EIOI} ${NEMO_EFCM} \
@@ -63,5 +65,5 @@
 	       ${DIR_XIOS}                             ; do
 
-	## For time being, just get revision number from XIOS
+	## For time being, just get revision from XIOS with no action on directory
 	if [ $dir == ${DIR_XIOS} ]; then
 	    rev_loc=$( svn info $dir | awk '(NR == 9) {print $NF}' )
@@ -76,4 +78,6 @@
 	${svn_cmd} $dir
 	rev_loc=$( svn info $dir | awk '(NR == 9) {print $NF}' )
+
+	## Keep last rev. nb
 	[ ${rev_loc} -gt $rev ] && rev=${rev_loc}
     done
@@ -92,13 +96,23 @@
 	soft_rel=''
 
+	## Software strings to identify depends on use (sed is case-insensitive)
         if [ $IMOD -eq 1 ]; then
-	    soft_rel=$( echo $LOADEDMODULES | sed "s/.*$soft\/\([0-9.a-z_]*\).*/\1/i" )
+	    ## Modules system: next word after "$soft/"
+	    soft_rel=$( echo $LOADEDMODULES | sed "s#.*$soft/\([0-9.a-z_]*\).*#\1#i" )
+	    ## LOADEDMODULES=netcdf/mpi/4.1.3:cdo/1.5.9:intel/2013.0
+	    ## LOADEDMODULES=bullxmpi/1.2.8.2:netcdf/4.3.3.1_hdf5_parallel:cdo/1.6.7
 	else
-	    soft_rel=$( echo $PATH          | sed "s/.*$soft\([0-9.a-z_]*\).*/\1/i"   )
-	fi
-
+	    ## Hard-coded paths: next word after "$soft"
+	    soft_rel=$( echo $PATH          | sed "s#.*$soft\([0-9.a-z_]*\).*#\1#i"  )
+	    ## PATH=/smplocal/intel/impi/4.1.0.024/intel64/bin:/smplocal/pub/cdo/1.5.9/bin:/smplocal/pub/NetCDF/4.1.3/mpi/bin
+	    ## PATH=/usr/local/netcdf-4.3.3.1_hdf5_parallel/bin:/opt/mpi/bullxmpi/1.2.8.2/bin:/usr/local/netcdf-utils-4.3.3.1_hdf5/bin
+	fi
+
+	## option --version would work for main compilers (gfortran, intel, pgfortran, ...)
 	[ $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#[/-]$##' )
+
 	echo $soft ${soft_rel} \
 	    >> model.log
@@ -115,8 +129,12 @@
 
 get_inputs() {
+    # List archive content & extract by default
     local cmd_iol="tar -tvf ${NEMO_FORC}/${NEMO_TARF}" cmd_iof="tar -vxf ${NEMO_FORC}/${NEMO_TARF}"
 
+    ## List & copy file in case of personal inputs
     [ -z "${NEMO_TARF}" ] && cmd_iol="ls ${NEMO_FORC}/*" && cmd_iof="\cp ${NEMO_FORC}/* ."
-    ${cmd_iol} > inputs_list.txt && ${cmd_iof} > /dev/null
+
+    ${cmd_iol} > inputs_list.txt
+    ${cmd_iof} > /dev/null
 }
 
@@ -126,8 +144,16 @@
     local files_list='' mesg='Same' 
 
+    ## Simple diff
     for file in 'inputs_list.txt' *namelist_* *.xml cpp_*; do
 	dif=''
+
+	## Continue even if input file is not in here (see after)
 	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' '; fi
+
+	## Pass over useless file omission in benckmark directory
+	if [ -n "$dif" && "$dif" != '0' ]; then
+	    mesg='Different'; echo $dif; files_list+=$file' '
+	fi
+
     done
 
@@ -135,4 +161,6 @@
     echo $mesg         \
 	>> ${FILE_INPT}
+
+    ## List different files for web comment
     [ -n "${files_list}" ] && echo 'Inputs  : '${files_list}'differ<br>' \
 	>> temp_${FILE_COMM}
@@ -145,4 +173,5 @@
     sleep ${time_increment}
 
+    ## Append a log file while pending
     while [[ $( ${JOB_LIST} | grep ${JOB_ID} ) && ${time_elapsed} -lt ${TIME_LIMI} ]]; do
 	printf "\n%s\n" ${outline// /#} \
@@ -156,7 +185,7 @@
     sleep ${time_increment}
 
+    ## Kill remaining job & stop the test if it's too long
     if [ ${time_elapsed} -eq ${TIME_LIMI} ]; then
 	${JOB_DELE} ${JOB_ID} &> /dev/null
-	export TIME_LIMIT/=3600
 	get_out 6
     fi
@@ -167,10 +196,17 @@
     local files_list=''
 
+    ## Simple diff
     for file in 'ocean.output' *.stat; do
+
+	## Stop if no benchmark files (ocean.output, eventual stat files)
 	[ ! -e ${REFE_DIR}/$file ] && export ST='FAILED' && get_out 7
+
 	diff -q $file ${REFE_DIR}/$file
+
+	## Continue even if it differs
 	[ $? -ne 0 ] && export ST='FAILED' && files_list+=$file' '
     done
 
+    ## List different files for web comment
     [ -n "${files_list}" ] && echo 'Results : '${files_list}'differ<br>' \
 	>> temp_${FILE_COMM}
@@ -182,7 +218,9 @@
     local files_list='' dift=0
 
+    ## Stop if no benchmark files (time.step)
     [ ! -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}
+
+    time_step=$( cat ${REFE_DIR}/time.step | tr -d [:space:] )
+    echo 'Last time step of benchmark run: '${time_step}
 
     ## Find all restart files to rebuild
@@ -195,4 +233,5 @@
 	             | sed "s#^.*\([0-9]\{8\}\)_restart.*#\1#"       | sort -u )
 
+	## Loop on each time step
 	for tmsp in ${list_tmsp}; do
 	    for comp in ${list_comp}; do
@@ -208,10 +247,14 @@
 
 		## Compare restart files at same time step
-		if [ $tmsp -eq ${TIME_STEP} ]; then
+		if [ $tmsp -eq ${time_step} ]; then
+
+                    ## Stop if no benchmark files (restart file)
 		    if [ -e ${REFE_DIR}/$file.nc ]; then
+
 	                ## UNIX `cmp` not suitable (timestamp in .nc file)
 			dif=$( $CDO diffn $file.nc ${REFE_DIR}/$file.nc 2> /dev/null      \
 			       | awk '/records/ {print $0}' | sed '2 s/^/,/' | tr -d '\n'  )
 
+			## CDO can return no output on stdout with no difference
 			if [[ -n "$dif" && $( echo $dif | awk '{print $1}' ) -ne 0 ]]; then
 			    export ST='FAILED' && files_list+=$file' '
@@ -231,4 +274,5 @@
 	done
 
+        ## List different files for web comment with sum of different parameters
 	if [ $dift -ne 0 ]; then
 	    echo 'Restarts: '${files_list}$dift' record(s) differ<br>' | tee -a temp_${FILE_COMM}
@@ -245,4 +289,5 @@
 
 get_cpu_time() {
+    ## Interest 
     local real_cpu_time=$( eval ${JOB_TIME} )
 
@@ -252,12 +297,13 @@
 
 comments() {
+    local opt
     local state=$1
 
-    if [ "$state" == 'E R R O R' ]; then
-	[ -e time.step ] && export TIME_STEP=$( cat time.step | tr -d ' ' )
-	[ -e ocean.output ] && line=$( grep -m1 -A4 "$state"   ocean.output | tr -d '\n' )
-    else
-	[ -e ocean.output ] && line=$( grep -m1 -A2 "^ $state" ocean.output | tr -d '\n' )
-    fi
+    ## 'W A R N I N G' by default
+    opt='-A2 "^ $state"'
+    [ "$state" == 'E R R O R' ] && opt="-A4 $state"
+
+    ## Select first occurence for web comment
+    line=$( grep -m1 $opt ocean.output | tr -d '\n' )
 
     echo   $line
@@ -272,4 +318,5 @@
 	>> ${FILE_COMM}
 
+    ## Construct txt file for web with all messenger files
     paste -d ';' mesg_*.txt | tee ${FILE_TRUS}
 }
@@ -279,6 +326,8 @@
     local cmd
 
+    ## Production mode (-p|--publish)
     if [ $PUBLISH -eq 1 ]; then
 
+	## Create or append historical trusting file
 	if [ -f ${REFE_DIR}/trusting_$PATTERNAME.txt ]; then cmd='tail -1'; else cmd='cat'; fi
 
@@ -286,6 +335,8 @@
 	    >> ${REFE_DIR}/trusting_$PATTERNAME.txt
 
-  ## Send mail only when FAILED
+        ## Send mail only when FAILED
 	if [[ ! -z "$EMAIL" && $ST == 'FAILED' ]]; then
+
+	    ## Content
 	    cat <<END_MAIL \
 		> trusting.mail
@@ -302,4 +353,6 @@
 `cat ${TEST_DIR}/${FILE_TRUS}`
 END_MAIL
+
+	    ## Send with detailed subject
 	    mail -s "[NEMO Trusting ${NEMO_HPCC} ${REFE_CONF} ${NEMO_BRAN}] $ST $ERR" $EMAIL \
 		<  trusting.mail
@@ -320,21 +373,35 @@
 	case $ERR in
 	    ## Compilation
-	    1) ERR='XIOS compilation failed'          ;; 2) ERR='NEMO compilation failed'            ;;
+	    1) ERR='XIOS compilation failed' ;; 2) ERR='NEMO compilation failed';;
 	    ## Submission
-	    3) ERR='Missing input files'              ;; 4) ERR='Job submission error'               ;;
+	    3) ERR='Missing input files'     ;; 4) ERR='Job submission error'   ;;
 	    ## Running
-	    5) ERR='Crashed at time step '${TIME_STEP};; 6) ERR='Exceeded time limit '${TIME_LIMI}'h';;
+	    5) ERR='Crashed at time step'    ;; 6) ERR='Exceeded time limit'    ;;
 	    ## Results
-	    7) ERR='Missing previous outputs'         ;; 8) ERR='New outputs differ'                 ;;
+	    7) ERR='Missing previous outputs';; 8) ERR='New outputs differ'     ;;
 	    ## Undefined
-	    *) ERR='Unknown error'                    ;;
+	    *) ERR='Unknown error'           ;;
 	esac
 
-	export ERR
-    fi
-
-    sed -i "2 s/.*/$ST/" ${FILE_STAT} && sed -i "2 s/.*/$ERR/" ${FILE_RESU}
-
-    ## Save tested configuration if trusting failed
+    fi
+
+    ## Eventual comments from ocean.output
+    print_step 'Comments'
+    if [ -e ocean.output ]; then 
+	if [ $ERR -eq 5 ]; then
+	    comments 'E R R O R'
+	    [ -e time.step ] && ERR+=' '$( cat time.step | tr -d ' ' )
+	else
+	    comments 'W A R N I N G'
+	    [ $ERR -eq 6   ] && ERR+=' '$(( ${TIME_LIMIT}/3600 ))'h'
+	fi
+    fi
+
+    ## Share trusting result (locally or not)
+    export ERR
+    sed -i "2 s/.*/$ST/"  ${FILE_STAT}
+    sed -i "2 s/.*/$ERR/" ${FILE_RESU}
+
+    ## Save tested configuration if trusting failed in production mode (-p|--publish)
     if [[ $ST == 'FAILED' && $PUBLISH -eq 1 && $DEBUG -eq 0 ]]; then
 	echo 'Creating archive '${FILE_ARCH}' under '${REFE_DIR}
@@ -343,10 +410,5 @@
     fi
 
-    if [ $ERR -eq 5 ]; then
-	print_step 'Comments'; comments 'E R R O R'
-    else
-	print_step 'Comments'; comments 'W A R N I N G'
-    fi
-
+    ## 
     print_step 'Trusting outcome'; mesg_make; mesg_publish
 
