Index: branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting.sh
===================================================================
--- branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting.sh	(revision 5464)
+++ branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting.sh	(revision 5465)
@@ -63,18 +63,18 @@
 print_step 'Compiling XIOS'
 cd ${DIR_XIOS}
-#./make_xios --full --arch $ARCH -job $NPROC #>& /dev/null
+#./make_xios --full --arch $ARCH -job $NPROC >& /dev/null
 [ ! -e ${DIR_XIOS}/lib/libxios.a ] && get_out $STATUS $STEP
 
 # NEMO config compiled from scratch
 #---------------------------------------------------
-print_step "Compiling ${CONF_REF} configuration"
+print_step "Compiling ${REFE_CONF} configuration"
 cd ${NEMO_CONF}
 #[ -d ${TEST_CONF} ] && ./makenemo -n ${TEST_CONF} clean
-./makenemo -n ${TEST_CONF} -r ${REFE_CONF} -m $ARCH -j $NPROC #>& /dev/null
+./makenemo -n ${TEST_CONF} -r ${REFE_CONF} -m $ARCH -j $NPROC >& /dev/null
 [ ! -e ${TEST_CONF}/BLD/bin/nemo.exe ] && get_out $STATUS $STEP
 
 # Get namelists, xml & forced files for running
 #---------------------------------------------------
-print_step "Preparing job by copying ${CONF_REF} input files"
+print_step "Preparing job by copying ${REFE_CONF} input files"
 cd ${TEST_DIR}
 find ${NEMO_CONF}/${TEST_CONF}/EXP00 -regex '.*\(cfg\|opa\|ref\|xml\)' -exec cp {} . \;
@@ -105,8 +105,10 @@
 fi
 
+STATUS='OK'
 # Inspect output text files
 #---------------------------------------------------
 print_step 'Test ASCII output files diff'
 diff_textfiles
+if [ "$STATUS" == 'FAILED' ] && get_out $STATUS $STEP
 
 # Inspect output NetCDF files
@@ -114,4 +116,5 @@
 print_step 'Test last restart NetCDF files diff'
 diff_restart
+if [ "$STATUS" == 'FAILED' ] && get_out $STATUS $STEP
 
 # Get computation duration
@@ -126,4 +129,4 @@
 # End
 #---------------------------------------------------
-[ $STATUS == 'OK' ] && STEP='Code is reliable'
+[ "$STATUS" == 'OK' ] && STEP='Code is reliable'
 get_out $STATUS $STEP
Index: branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting_func.sh
===================================================================
--- branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting_func.sh	(revision 5464)
+++ branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting_func.sh	(revision 5465)
@@ -5,5 +5,5 @@
     state=$1
 
-    if [ $state == 'E R R O R' ]; then
+    if [ "$state" == 'E R R O R' ]; then
 	if [ -e ocean.output ]; then
 	    last_time_step=$( cat ${TEST_DIR}/time.step | tr -d [:space:] )
@@ -20,5 +20,5 @@
     fi
 
-    printf "Comments\n$line\n" | tee mesg_10_comments_${CFG_USER}_${CFG_ARCH}.txt
+    printf "Comments\n$line\n" | tee mesg_11_comments_${CFG_USER}_${CFG_ARCH}.txt
 }
 
@@ -26,5 +26,5 @@
     # Portability !
     real_cpu_time=$( ${JOB_VIEW} ${JOB_ID} | awk 'END{print $9}' )
-    printf "Real CPU time\n${real_cpu_time}\n" | tee mesg_09_realcputime_${CFG_USER}_${CFG_ARCH}.txt
+    printf "Real CPU time\n${real_cpu_time}\n" | tee mesg_10_realcputime_${CFG_USER}_${CFG_ARCH}.txt
 }
 
@@ -48,5 +48,5 @@
     done
 
-    printf "Input files\n$mesg\n" | tee mesg_08_inputfiles_${CFG_USER}_${CFG_ARCH}.txt
+    printf "Input files\n$mesg\n" | tee mesg_09_inputfiles_${CFG_USER}_${CFG_ARCH}.txt
 }
 
@@ -60,16 +60,16 @@
 
 	for comp in restart restart_ice restart_trc; do
-	    printf "${base_name}_${comp}.nc: "
-
-	    nb_dom=$( find ${TEST_DIR} -name "${base_name}_${comp}_[0-9]*.nc" | wc -l | awk '{print $1}' )
+	    file=${base_name}'_'${comp} && printf "$file'.nc': "
+
+	    nb_dom=$( find ${TEST_DIR} -name "${file}_[0-9]*.nc" | wc -l | awk '{print $1}' )
 	    if [ ${nb_dom} -gt 1 ]; then
-		${NEMO_TRBD}/rebuild_nemo -t $NPROC ${base_name}_$comp ${nb_dom} > /dev/null
+		${NEMO_TRBD}/rebuild_nemo -t $NPROC $file ${nb_dom} > /dev/null
 	    fi
 
 	    # UNIX `cmp` not suitable (filename & timestamp in .nc file)
-	    $CDO diffn ${TEST_DIR}/${base_name}_$comp.nc ${REFE_DIR}/${base_name}_$comp.nc 2> /dev/null
-	    if [ $? -ne 0 ]; then
-		STATUS='FAILED'; STEP='Restart files different'
-		#printf "$CDO diffn\n"
+	    nc_diff=$( $CDO diffn ${TEST_DIR}/$file'.nc' ${REFE_DIR}/$file'.nc' 2> /dev/null | sed -n '$p' )
+	    if [ ! -z "${nc_diff}" ]; then
+		export STATUS='FAILED' STEP='Restart files different'
+		printf "$CDO diffn ${nc_diff}\n"
 	    else
 		printf "identical\n"
@@ -80,5 +80,5 @@
 
     else
-	STATUS='FAILED'; STEP='No restart files found at last time step'
+	export STATUS='FAILED'; STEP='No restart files found at last time step'
 	printf "no restart files found for comparison\n"
     fi
@@ -89,5 +89,5 @@
     for file in ocean.output $( ls *.stat ); do
 	diff $file ${REFE_DIR}/$file
-	[ $? -ne 0 ] && STATUS='FAILED' && STEP='ASCII output file diff'
+	[ $? -ne 0 ] && export STATUS='FAILED' STEP='ASCII output file diff'
     done
 }
@@ -97,11 +97,11 @@
                                  arch_rel=$( echo $LOADEDMODULES | sed  "s#.*$rel/\([^:]*\).*#\1#" )
 	[ -z "${arch_rel}"  ] && arch_rel=$( echo $PATH          | sed  "s#.*$rel/\([^/]*\).*#\1#" )
-	[ $rel == $COMPILER ] && arch_rel=$( $rel --version      | grep -m1 -o ' [0-9.]* '         )
+	[ "$rel" == "$COMPILER" ] && arch_rel=$( $rel --version      | grep -m1 -o ' [0-9.]* '         )
 	echo $rel ${arch_rel} >> model.log
     done
 
-    sed -n 4p model.log | sed 'i\Compiler'    > mesg_05_compiler_${CFG_USER}_${CFG_ARCH}.txt
-    sed -n 5p model.log | sed 'i\MPI libs'    > mesg_06_mpi_${CFG_USER}_${CFG_ARCH}.txt
-    sed -n 6p model.log | sed 'i\NetCDF libs' > mesg_07_netcdf_${CFG_USER}_${CFG_ARCH}.txt
+    sed -n 4p model.log | sed 'i\Compiler'    > mesg_06_compiler_${CFG_USER}_${CFG_ARCH}.txt
+    sed -n 5p model.log | sed 'i\MPI libs'    > mesg_07_mpi_${CFG_USER}_${CFG_ARCH}.txt
+    sed -n 6p model.log | sed 'i\NetCDF libs' > mesg_08_netcdf_${CFG_USER}_${CFG_ARCH}.txt
 }
 
@@ -125,16 +125,21 @@
 
 	# For time being, just get revision number from XIOS
-	if [ $dir == ${DIR_XIOS} ]; then
-	    echo 'XIOS '$( svn info $dir | awk '(NR == 5) {print $NF}' ) >> model.log
+	if [ "$dir" == "${DIR_XIOS}" ]; then
+	    rev_loc=$( svn info $dir | awk '(NR == 5) {print $NF}' )
+	    echo   'XIOS '${rev_loc}         >> model.log
+	    printf "XIOS rev.\n${rev_loc}\n" >  mesg_05_xios__${CFG_USER}_${CFG_ARCH}.txt
 	    continue
 	fi
 
-	${svn_cmd} $dir
+	echo ${svn_cmd} $dir': '$( ${svn_cmd} $dir )
 	rev_loc=$( svn info $dir | awk '(NR == 5) {print $NF}' )
 	(( ${rev_loc} >= $rev )) && rev=${rev_loc}
     done
 
-    echo   "NEMOGCM $rev"         >> model.log
-    printf "NEMOGCM rev.\n$rev\n" >  mesg_02_nemogcm_${CFG_USER}_${CFG_ARCH}.txt
+    echo   'NEMOGCM '$rev         >> model.log
+#   printf "NEMOGCM rev.\n$rev\n" >  mesg_04_nemogcm_${CFG_USER}_${CFG_ARCH}.txt
+    printf "NEMOGCM rev.\n\
+            <a href=\"https://forge.ipsl.jussieu.fr/nemo/changeset/$rev\" target=\"_blank\">$rev</a>" \
+    >  mesg_04_nemogcm_${CFG_USER}_${CFG_ARCH}.txt
 }
 
@@ -153,5 +158,5 @@
 
   # Send mail only when FAILED
-  if [[ ! -z $EMAIL && $STATUS == 'FAILED' ]]; then
+  if [[ ! -z $EMAIL && "$STATUS" == 'FAILED' ]]; then
       cat << END_MAIL > trusting.mail
 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
@@ -159,5 +164,5 @@
 
 The trusting sequence for ${CONF_REF} has failed at step:
-`tail -n 1 ${TEST_DIR}/mesg_04_step_${CFG_USER}_${CFG_ARCH}.txt`
+`tail -n 1 ${TEST_DIR}/mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt`
 Directory : ${TEST_DIR}
 
@@ -180,16 +185,16 @@
 
 get_out() {
+    # Save tested configuration if trusting failed
+    if [ "$STATUS" == 'FAILED' ]; then
+	cd ${TEST_DIR}
+	touch mesg_09_inputfiles_${CFG_USER}_${CFG_ARCH}.txt mesg_10_realcputime_${CFG_USER}_${CFG_ARCH}.txt \
+	      mesg_11_comments_${CFG_USER}_${CFG_ARCH}.txt
+	#tar -czf ${REFE_DIR}/trusting_${DATESTR}_${CFG_USER}_${CFG_ARCH}.tar.gz *
+    fi
+
+    printf "Status\n$STATUS\n"  > mesg_02_status_${CFG_USER}_${CFG_ARCH}.txt
+    printf "Step.....\n$STEP\n" > mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt
+
     mesg_make; mesg_publish
-
-    # Save tested configuration if trusting failed
-    if [ $STATUS == 'FAILED' ]; then
-	cd ${TEST_DIR}
-	touch mesg_08_inputfiles_${CFG_USER}_${CFG_ARCH}.txt mesg_09_realcputime_${CFG_USER}_${CFG_ARCH}.txt \
-	      mesg_10_comments_${CFG_USER}_${CFG_ARCH}.txt
-	#tar -czf ${REFE_DIR}/trusting_${DATESTR}_${CFG_USER}_${CFG_ARCH}.tar.gz *
-    fi
-
-    printf "Status\n$STATUS\n"  > mesg_03_status_${CFG_USER}_${CFG_ARCH}.txt
-    printf "Step.....\n$STEP\n" > mesg_04_step_${CFG_USER}_${CFG_ARCH}.txt
 
     exit 1
