Index: /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/install_dir.sh
===================================================================
--- /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/install_dir.sh	(revision 5671)
+++ /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/install_dir.sh	(revision 5672)
@@ -11,7 +11,7 @@
 
 for elmt in 'ARCH' 'CONFIG' 'NEMO' 'EXTERNAL/IOIPSL' 'EXTERNAL/fcm' 'TOOLS' 'TRUST'; do
-    svn_bran=${NEMO_BRAN}
-    [ "$elmt" == 'TRUST' ] && svn_bran='branches/2015/dev_r5092_CNRS_SETTE'
-    svn co http://forge.ipsl.jussieu.fr/nemo/svn/${svn_bran}/NEMOGCM/$elmt ${}/NEMOGCM/$elmt
+    svn_bran=${NEMO_BRAN}; rev=''
+    [ "$elmt" == 'TRUST' ] && svn_bran='branches/2015/dev_r5092_CNRS_SETTE' && rev='-r 5671'
+    svn co $rev http://forge.ipsl.jussieu.fr/nemo/svn/${svn_bran}/NEMOGCM/$elmt ${}/NEMOGCM/$elmt
 
 done
@@ -20,5 +20,7 @@
 
 for elmt in $( ls * ); do
-    [ ! $( echo $elmt | grep "COMPILE\|maketools\|REBUILD_NEMO" ) ] && rm -rf $elmt
+    if [ ! $( echo $elmt | grep "COMPILE\|maketools\|REBUILD_NEMO" ) ]; then
+	echo $elmt && rm -rf $elmt > /dev/null
+    fi
 done
 
Index: /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting_func.sh
===================================================================
--- /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting_func.sh	(revision 5671)
+++ /branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting_func.sh	(revision 5672)
@@ -86,9 +86,11 @@
 
 	[ "$soft" == "$COMPILER" ] && soft_rel=$( $soft --version | grep -m1 -oe '\<[0-9. ]*\>' )
-	soft=$( echo $soft | sed 's#\\##g; s#[/-]$##' )	## Cleaning characters string to display proper soft name
+	## Cleaning characters string to display proper soft name
+	soft=$( echo $soft | sed 's#\\##g; s#[/-]$##' )
 	echo $soft ${soft_rel} >> model.log
     done
 
-    sed -n 4p model.log >> ${FILE_COMP}; sed -n 5p model.log >> ${FILE_MPIN}; sed -n 6p model.log >> ${FILE_NCDF}
+    sed -n 4p model.log >> ${FILE_COMP}; sed -n 5p model.log >> ${FILE_MPIN}
+    sed -n 6p model.log >> ${FILE_NCDF}
 }
 
@@ -110,5 +112,5 @@
 	if [ -n "$dif" ]; then
 	    mesg='Different'
-	    [ "$dif" != '0' ] && echo $dif && files_list+=$file' '
+	    (( "$dif" != '0' )) && echo $dif && files_list+=$file' '
 	fi
 
@@ -118,15 +120,16 @@
     echo $mesg >> ${FILE_INPT}
 
-    [ -n "${files_list}" ] && echo 'Inputs  : '${files_list}'differ<br>' >> temp_${FILE_COMM}
+    [ -n "${files_list}" ] && echo 'Inputs  : '${files_list}'differ<br>' \
+	>> temp_${FILE_COMM}
 }
 
 job_pending() {
-    local time_elapsed=0 time_increment=30
+    local outline=$( printf "%100s" ) time_elapsed=0 time_increment=30
 
     sleep ${time_increment}
 
     while [[ $( ${JOB_LIST} | grep ${JOB_ID} ) && ${time_elapsed} -lt ${TIME_LIMI} ]]; do
-	printf "\n####################################################\n" >> computation.log
-	${JOB_INFO} ${JOB_ID}                                             >> computation.log
+	printf "\n%s\n" ${outline// /#} >> computation.log
+	${JOB_INFO} ${JOB_ID}           >> computation.log
 	sleep ${time_increment}
 	time_elapsed=$(( ${time_elapsed} + ${time_increment} ))
@@ -135,5 +138,5 @@
     sleep ${time_increment}
 
-    if [ ${time_elapsed} -eq ${TIME_LIMI} ]; then
+    if (( ${time_elapsed} == ${TIME_LIMI} )); then
 	${JOB_DELE} ${JOB_ID} &> /dev/null
 	let TIME_LIMIT/=3600
@@ -152,52 +155,65 @@
     done
 
-    [ -n "${files_list}" ] && echo 'Results : '${files_list}'differ<br>' >> temp_${FILE_COMM}
+    [ -n "${files_list}" ] && echo 'Results : '${files_list}'differ<br>' \
+	>> temp_${FILE_COMM}
 }
 
 diff_restart() {
-    local base_name diff_rcd file nb_dom
-    local dif=0 files_list='' list_rst=('restart restart_ice restart_trc restart_oce_out')
+    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
-
     export TIME_STEP=$( cat ${REFE_DIR}/time.step | tr -d [:space:] )
-    echo 'Last time step of standard run: '${TIME_STEP}
-
-    if [ $( find -regex ".*_0+$TIME_STEP_restart.*\.nc" -print -quit ) ]; then
-	base_name=$( find -regex ".*_0+$TIME_STEP_restart.*\.nc" -print -quit  \
-	             | cut -d/ -f2 | sed "s/^\(.*$TIME_STEP\)\_restart.*/\1\_/" )
-
-	for comp in ${list_rst}; do
-	    file=${base_name}${comp}
-
-	    nb_dom=$( find -name "${file}_[0-9]*.nc" | wc -l | awk '{ print $1 }' )
-	    if   [ ${nb_dom} -gt 1 ]; then
-		${NEMO_TRBD}/rebuild_nemo -t $NPROC $file ${nb_dom} > /dev/null
-		[ $? -eq 0 ] && rm -f ${base_name}${comp}_[0-9]*.nc > /dev/null
-	    elif [ ${nb_dom} -eq 0 ]; then
-		export ST='FAILED' && get_out 8
-	    fi
-
-	    if [ -e ${REFE_DIR}/$file.nc ]; then
-	    ## UNIX `cmp` not suitable (filename & timestamp in .nc file)
-		diff_rcd=$( $CDO diffn $file.nc ${REFE_DIR}/$file.nc 2> /dev/null      \
-		            | awk '/records/ {print $0}' | sed '2 s/^/,/' | tr -d '\n'  )
-
-		if [[ ! -z ${diff_rcd} && $( echo ${diff_rcd} | awk '{ print $1 }') -ne 0 ]]; then
-		    export ST='FAILED'
-		    files_list+=$file' '
-		    let dif+=$( echo ${diff_rcd} | awk '{print $1}' )
-		    echo $file.nc': '${diff_rcd}
+    echo 'Last time step of benchmark run: '${TIME_STEP}
+
+    ## Find all restart files to rebuild
+    if [ $( find -regex ".*_restart.*[0-9]\.nc" -print -quit ) ]; then
+	base_name=$( find -regex ".*_restart.*[0-9]\.nc"                      \
+	             | sed "s#^\./\(.*\)_[0-9]*_restart.*#\1#"       | sort -u )
+	list_comp=$( find -regex ".*_restart.*[0-9]\.nc"                      \
+	             | sed "s#^.*\(restart[a-z_]*\)_[0-9].*\.nc#\1#" | sort -u )
+	list_tmsp=$( find -regex ".*_restart.*[0-9]\.nc"                      \
+	             | sed "s#^.*\([0-9]\{8\}\)_restart.*#\1#"       | sort -u )
+
+	for tmsp in ${list_tmsp}; do
+	    for comp in ${list_comp}; do
+		file=${base_name}_${tmsp}_${comp}
+		nb_dom=$( find -name "${file}_[0-9]*.nc" | wc -l | awk '{ print $1 }' )
+
+		if   (( ${nb_dom} >  1 )); then
+		    ${NEMO_TRBD}/rebuild_nemo -t $NPROC $file ${nb_dom} > /dev/null
+		    [ $? -eq 0 ] && rm -f ${file}_[0-9]*.nc             > /dev/null
+		elif (( ${nb_dom} == 0 )); then
+		    export ST='FAILED' && get_out 8
+		fi
+
+		## Compare restart files at same time step
+		if (( $tmsp == ${TIME_STEP} )); then
+		    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'  )
+
+			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'
+			fi
+
+		    else
+			export ST='FAILED' && get_out 7
+		    fi
+
 		else
-		    echo 'identical'
+		    continue
 		fi
 
-	    else
-		export ST='FAILED' && get_out 7
-	    fi
-
+	    done
 	done
 
-	[ -n "${files_list}" ] && echo 'Restarts: '${files_list}$dif' record(s) differ<br>' >> temp_${FILE_COMM}
+	[ -n "${files_list}" ] && echo 'Restarts: '${files_list}$dift' record(s) differ<br>' \
+	    >> temp_${FILE_COMM}
     else
 	export ST='FAILED'
@@ -228,5 +244,6 @@
 mesg_make() {
     ## Format comments for web
-    [ -e temp_${FILE_COMM} ] && cat temp_${FILE_COMM} | tr -d '\n' | sed 's/<br>$//' >> ${FILE_COMM}
+    [ -e temp_${FILE_COMM} ] && cat temp_${FILE_COMM} | tr -d '\n' | sed 's/<br>$//' \
+	>> ${FILE_COMM}
 
     paste -d ';' mesg_*.txt | tee ${FILE_TRUS}
@@ -242,6 +259,6 @@
 	$cmd ${FILE_TRUS} >> ${REFE_DIR}/trusting_$PATTERNAME.txt
 
-  ## Send mail only when FAILED
-	if [[ ! -z $EMAIL && "$ST" == 'FAILED' ]]; then
+        ## Send mail only when FAILED
+	if [[ ! -z "$EMAIL" && "$ST" == 'FAILED' ]]; then
 	    cat << END_MAIL > trusting.mail
 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
@@ -256,6 +273,8 @@
 
 END_MAIL
-	    [ -e ${TEST_DIR}/${FILE_TRUS} ] && cat ${TEST_DIR}/${FILE_TRUS}                  >> trusting.mail
-	    mail -s "[NEMO Trusting ${NEMO_HPCC} ${REFE_CONF} ${NEMO_BRAN}] $ST $ERR" $EMAIL <  trusting.mail
+	    [ -e ${TEST_DIR}/${FILE_TRUS} ] && cat ${TEST_DIR}/${FILE_TRUS}                  \
+		>> trusting.mail
+	    mail -s "[NEMO Trusting ${NEMO_HPCC} ${REFE_CONF} ${NEMO_BRAN}] $ST $ERR" $EMAIL \
+		<  trusting.mail
 	fi
 
