Skip to content
Snippets Groups Projects
Commit 2fb70cb7 authored by Andrew Coward's avatar Andrew Coward
Browse files

Modified sette scripts to use the branch name as the default sub-directory for...

Modified sette scripts to use the branch name as the default sub-directory for SETTE records (instead of MAIN). Also corrected a few minor issues and added a -u option to sette.sh, sette_rpt.sh and sette_eval.sh which will avoid asking for user input (at least the looped input that is problematic in CI applications)
parent 0235f282
No related branches found
No related tags found
No related merge requests found
......@@ -186,7 +186,7 @@ set_valid_dir () {
echo "value of revision number of NEMOGCM: ${REVISION_NB}"
fi
localchanges=`git status --short -uno | wc -l`
if [ $localchanges > 0 ] ; then
if [[ $localchanges > 0 ]] ; then
REVISION_NB=${REVISION_NB}+
fi
# remove last _ST followed by zero or more alphanumeric characters
......
......@@ -80,6 +80,7 @@ COMP_KEYS="`cat ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm | sed -e 's/.*fppk
echo "Summary of sette environment" > ./sette_config
echo "----------------------------" >> ./sette_config
echo "requested by the command : "$cmd $cmdargs >> ./sette_config
echo "on branch : "$SETTE_THIS_BRANCH >> ./sette_config
printf "%-33s : %s\n" USING_TIMING $USING_TIMING >> ./sette_config
printf "%-33s : %s\n" USING_ICEBERGS $USING_ICEBERGS >> ./sette_config
printf "%-33s : %s\n" USING_EXTRA_HALO $USING_EXTRA_HALO >> ./sette_config
......@@ -90,6 +91,7 @@ printf "%-33s : %s\n" USING_LOOP_FUSION $USING_LOOP_FUSION >> ./sette_con
printf "%-33s : %s\n" USING_XIOS $USING_XIOS >> ./sette_config
printf "%-33s : %s\n" USING_MPMD $USING_MPMD >> ./sette_config
printf "%-33s : %s\n" USING_RK3 $USING_RK3 >> ./sette_config
printf "%-33s : %s\n" USER_INPUT $USER_INPUT >> ./sette_config
printf "%-33s : %s\n" "Common compile keys added" "$ADD_KEYS" >> ./sette_config
printf "%-33s : %s\n" "Common compile keys deleted" "$DEL_KEYS" >> ./sette_config
printf "%-33s : %s\n" "Compile keys actually used" "${COMP_KEYS}" >> ./sette_config
......
......@@ -30,11 +30,26 @@ export USING_XIOS='yes' # Default: yes => add key_xios ; use -X
#
export USING_MPMD='yes' # Default: yes => run with detached XIOS servers ; use -A to run in attached (SPMD) mode
# Note: yes also ensures key_xios but -A will not remove it
export SETTE_SUB_VAL="MAIN" # Default subdirectory below NEMO_VALIDATION_DIR
export USER_INPUT='yes' # Default: yes => request user input on decisions. For example:
# 1. regarding mismatched options
# 2. regardin incompatible options
# 3. regarding creation of directories
#
# Check that git branch is usable
git branch --show-current >&/dev/null
if [[ $? == 0 ]] ; then
# subdirectory below NEMO_VALIDATION_DIR defaults to branchname
export SETTE_SUB_VAL="$(git branch --show-current)"
export SETTE_THIS_BRANCH=$SETTE_SUB_VAL
else
# subdirectory below NEMO_VALIDATION_DIR defaults to "MAIN"
export SETTE_SUB_VAL="MAIN"
export SETTE_THIS_BRANCH="Unknown"
fi
# Parse command-line arguments
if [ $# -gt 0 ]; then
while getopts n:x:v:g:cdrshTqQteiACFNX option; do
while getopts n:x:v:g:cdrshTqQteiACFNXu option; do
case $option in
c) export SETTE_CLEAN_CONFIGS='yes'
export SETTE_SYNC_CONFIGS='yes'
......@@ -104,6 +119,9 @@ if [ $# -gt 0 ]; then
A) export USING_MPMD='no'
echo "-A: Tasks will be run in attached (SPMD) mode"
echo "";;
u) export USER_INPUT='no'
echo "-u: sette.sh will not expect any user interaction == no safety net!"
echo "";;
h | *) echo 'sette.sh with no arguments (in this case all configuration will be tested with default options)'
echo '-T to set ln_timing false for all non-AGRIF configurations (default: true)'
echo '-t set ln_tile false in all tests that support it (default: true)'
......@@ -125,7 +143,9 @@ if [ $# -gt 0 ]; then
echo '-r to execute without waiting to run sette_rpt.sh at the end (useful for chaining sette.sh invocations)'
echo '-d to perform a dryrun to simply report what settings will be used'
echo '-c to clean each configuration'
echo '-s to synchronise the sette MY_SRC and EXP00 with the reference MY_SRC and EXPREF'; exit 42 ;;
echo '-s to synchronise the sette MY_SRC and EXP00 with the reference MY_SRC and EXPREF'
echo '-u to run sette.sh without any user interaction. This means no checks on creating'
echo ' directories etc. i.e. no safety net!' ; exit 42 ;;
esac
done
shift $((OPTIND - 1))
......@@ -135,26 +155,38 @@ fi
#
if [ ${USING_TILING} == "yes" ] ; then
if [ ${USING_EXTRA_HALO} == "no" ] ; then
while true; do
read -p "Tiling requires the extra halo but you have used -e to deselect it. Would you like to reselect it? (y/n)?: " yn
case $yn in
[Yy]* ) echo "Ok, ignoring the -e option"; USING_EXTRA_HALO="yes"; break;;
[Nn]* ) echo "Ok, exiting instead"; exit 42;;
* ) echo "Please answer yes or no.";;
esac
done
if [ ${USER_INPUT} == "yes" ] ; then
while true; do
read -p "Tiling requires the extra halo but you have used -e to deselect it. Would you like to reselect it? (y/n)?: " yn
case $yn in
[Yy]* ) echo "Ok, ignoring the -e option"; USING_EXTRA_HALO="yes"; break;;
[Nn]* ) echo "Ok, exiting instead"; exit 42;;
* ) echo "Please answer yes or no.";;
esac
done
else
# Without user input, the best option is to disable tiling
echo "Tiling requires the extra halo but you have used -e to deselect it. Tiling will not be used."
USING_TILING="no"
fi
fi
fi
if [ ${USING_LOOP_FUSION} == "yes" ] ; then
if [ ${USING_EXTRA_HALO} == "no" ] ; then
while true; do
read -p "Loop fusion requires the extra halo but you have used -e to deselect it. Would you like to reselect it? (y/n)?: " yn
case $yn in
[Yy]* ) echo "Ok, ignoring the -e option"; USING_EXTRA_HALO="yes"; break;;
[Nn]* ) echo "Ok, exiting instead"; exit 42;;
* ) echo "Please answer yes or no.";;
esac
done
if [ ${USER_INPUT} == "yes" ] ; then
while true; do
read -p "Loop fusion requires the extra halo but you have used -e to deselect it. Would you like to reselect it? (y/n)?: " yn
case $yn in
[Yy]* ) echo "Ok, ignoring the -e option"; USING_EXTRA_HALO="yes"; break;;
[Nn]* ) echo "Ok, exiting instead"; exit 42;;
* ) echo "Please answer yes or no.";;
esac
done
else
# Without user input, the best option is to disable loop fusion
echo "Loop fusion requires the extra halo but you have used -e to deselect it. Loop fusion will not be used."
USING_LOOP_FUSION="no"
fi
fi
fi
#
......@@ -182,14 +214,20 @@ if [ ${USING_RK3} == "no" ] ; then export DEL_KEYS="${DEL_KEYS}key_RK3 " ; fi
#
if [ ! -d $NEMO_VALIDATION_DIR ] ; then
if [ ${dry_run} -eq 0 ] ; then
while true; do
read -p "$NEMO_VALIDATION_DIR does not exist. Do you wish to create it? " yn
case $yn in
[Yy]* ) echo "Ok, creating $NEMO_VALIDATION_DIR"; mkdir $NEMO_VALIDATION_DIR; break;;
[Nn]* ) echo "Ok, exiting instead"; exit 42;;
* ) echo "Please answer yes or no.";;
esac
done
if [ ${USER_INPUT} == "yes" ] ; then
while true; do
read -p "$NEMO_VALIDATION_DIR does not exist. Do you wish to create it? " yn
case $yn in
[Yy]* ) echo "Ok, creating $NEMO_VALIDATION_DIR"; mkdir $NEMO_VALIDATION_DIR; break;;
[Nn]* ) echo "Ok, exiting instead"; exit 42;;
* ) echo "Please answer yes or no.";;
esac
done
else
# Without user input, carry on regardless
echo "$NEMO_VALIDATION_DIR does not exist. It will be created"
mkdir $NEMO_VALIDATION_DIR
fi
else
echo "$NEMO_VALIDATION_DIR does not exist"
echo "but this is a dry run so it will not be created"
......@@ -206,6 +244,7 @@ if [ ${#SETTE_TEST_CONFIGS[@]} -eq 0 ]; then
fi
echo "Carrying out the following tests : ${TEST_TYPES[@]}"
echo "requested by the command : "$cmd $cmdargs
echo "on branch : "$SETTE_THIS_BRANCH
printf "%-33s : %s\n" USING_TIMING $USING_TIMING
printf "%-33s : %s\n" USING_ICEBERGS $USING_ICEBERGS
printf "%-33s : %s\n" USING_EXTRA_HALO $USING_EXTRA_HALO
......@@ -217,6 +256,7 @@ printf "%-33s : %s\n" USING_LOOP_FUSION $USING_LOOP_FUSION
printf "%-33s : %s\n" USING_XIOS $USING_XIOS
printf "%-33s : %s\n" USING_MPMD $USING_MPMD
printf "%-33s : %s\n" USING_RK3 $USING_RK3
printf "%-33s : %s\n" USER_INPUT $USER_INPUT
printf "%-33s : %s\n" "Common compile keys to be added" "$ADD_KEYS"
printf "%-33s : %s\n" "Common compile keys to be deleted" "$DEL_KEYS"
echo "Validation records to appear under: "$NEMO_VALIDATION_DIR
......
......@@ -155,11 +155,12 @@ function runcmpres(){
MAIN_DIR=$(dirname $SETTE_DIR)
quiet=0
. ./param.cfg
USER_INPUT='yes' # Default: yes => request user input on decisions.
mach=${COMPILER}
# overwrite revision (later) or compiler
if [ $# -gt 0 ]; then
while getopts r:R:c:v:V:T:qh option; do
while getopts r:R:c:v:V:T:quh option; do
case $option in
c) mach=$OPTARG;;
r) rev=$OPTARG;;
......@@ -174,6 +175,7 @@ function runcmpres(){
fi
;;
T) TESTD_ROOT=$OPTARG;;
u) USER_INPUT='no';;
h | *) echo ''
echo 'sette_eval.sh : '
echo ' display result for the latest change'
......@@ -190,6 +192,7 @@ function runcmpres(){
echo ' -V sub_dir2 :'
echo ' 2nd validation sub-directory below NEMO_VALIDATION_DIR'
echo ' if set the comparison is between two subdirectory trees beneath NEMO_VALIDATION_DIR'
echo ' -u to run sette_eval.sh without any user interaction'
echo ' -q : Activate quiet mode - only the number of differing results is returned'
echo ''
exit 42;;
......@@ -200,24 +203,41 @@ function runcmpres(){
# if $1 (remaining arguments)
if [[ ! -z $1 ]] ; then rev=$1 ; fi
# Check that git branch is usable
git branch --show-current >&/dev/null
if [[ $? == 0 ]] ; then
# subdirectory below NEMO_VALIDATION_DIR defaults to branchname
NAM_MAIN="$(git branch --show-current)"
else
# subdirectory below NEMO_VALIDATION_DIR defaults to "MAIN"
NAM_MAIN="MAIN"
fi
if [ ! -z $SETTE_SUB_VAL ] ; then
export NEMO_VALIDATION_DIR=$NEMO_VALIDATION_DIR/$SETTE_SUB_VAL
if [ -d $NEMO_VALIDATION_REF/$SETTE_SUB_VAL ] && [ -z $SETTE_SUB_VAL2 ] && [ ${quiet} -eq 0 ] ; then
if [ -d $NEMO_VALIDATION_REF/$SETTE_SUB_VAL ] && [ -z $SETTE_SUB_VAL2 ] && [ ${USER_INPUT} == "yes" ] ; then
while true; do
read -p "$NEMO_VALIDATION_REF/$SETTE_SUB_VAL exists. Do you wish to use it as a reference? " yn
case $yn in
[Yy]* ) export $NEMO_VALIDATION_REF/$SETTE_SUB_VAL; break;;
[Nn]* ) echo "Ok, continuing with ${NEMO_VALIDATION_REF}/MAIN as the reference directory"
export NEMO_VALIDATION_REF=${NEMO_VALIDATION_REF}/MAIN
[Yy]* ) export NEMO_VALIDATION_REF=$NEMO_VALIDATION_REF/$SETTE_SUB_VAL; break;;
[Nn]* ) echo "Ok, continuing with ${NEMO_VALIDATION_REF}/${NAM_MAIN} as the reference directory"
export NEMO_VALIDATION_REF=${NEMO_VALIDATION_REF}/${NAM_MAIN}
break
;;
* ) echo "Please answer yes or no.";;
esac
done
elif [ -d $NEMO_VALIDATION_REF/$SETTE_SUB_VAL ] && [ -z $SETTE_SUB_VAL2 ] ; then
# No user input: make a best guess as to intent
export NEMO_VALIDATION_REF=$NEMO_VALIDATION_REF/$SETTE_SUB_VAL
elif [ -z $SETTE_SUB_VAL2 ] ; then
# No user input: default to branchname or MAIN
export NEMO_VALIDATION_REF=$NEMO_VALIDATION_REF/${NAM_MAIN}
fi
else
export NEMO_VALIDATION_DIR=${NEMO_VALIDATION_DIR}/MAIN
export NEMO_VALIDATION_REF=${NEMO_VALIDATION_REF}/MAIN
export NEMO_VALIDATION_DIR=${NEMO_VALIDATION_DIR}/${NAM_MAIN}
if [ -z $SETTE_SUB_VAL2 ] ; then
export NEMO_VALIDATION_REF=$NEMO_VALIDATION_REF/${NAM_MAIN}
fi
fi
NEMO_VALID=${NEMO_VALIDATION_DIR}
NEMO_VALID_REF=${NEMO_VALIDATION_REF}
......@@ -240,14 +260,12 @@ rev_date0=`git log -1 | grep Date | sed -e 's/.*Date: *//' -e's/ +.*$//'`
rev_date=`${DATE_CONV}"${rev_date0}" +"%y%j"`
revision=${rev_date}_${revision}
branchname=`git branch --show-current`
if [ ${quiet} -eq 0 ] ; then
if [ $localchanges > 0 ] ; then
echo "Current code is : $branchname @ $revision ( with local changes )"
lastchange=${revision}+
else
echo "Current code is : $branchname @ $revision"
lastchange=$revision
fi
if [[ $localchanges > 0 ]] ; then
if [ ${quiet} -eq 0 ] ; then echo "Current code is : $branchname @ $revision ( with local changes )" ; fi
lastchange=${revision}+
else
if [ ${quiet} -eq 0 ] ; then echo "Current code is : $branchname @ $revision" ; fi
lastchange=$revision
fi
# by default use the current lastchanged revision
......@@ -257,7 +275,7 @@ if [ ${quiet} -eq 0 ] ; then
echo ""
echo "SETTE evaluation for : "
echo ""
if [ $localchanges > 0 ] ; then
if [[ $localchanges > 0 ]] ; then
echo " $branchname @ $revision (with local changes)"
else
echo " $branchname @ $revision"
......
......@@ -48,9 +48,9 @@ lst_rev () {
for rev in $ALLLST
do
if [ -d ${VALSUB}/$rev/${CONFIG} ] ; then
printf "%-6s " $rev
printf "%-14s " $rev
else
printf "%-5s " "----- "
printf "%-14s " "------------ "
fi
done
}
......@@ -71,7 +71,7 @@ lst_rev () {
echo ""
printf " List of all avail. rev. in :"${NEMO_VALID}"\n"
printf " is : "
for dir in `echo $DIRLIST`; do printf "%-6s " $dir ; done
for dir in `echo $DIRLIST`; do printf "%-14s " $dir ; done
printf "\n"
# start checking configuration revision
......
......@@ -429,11 +429,12 @@ function identictest(){
#
get_dorv
#
rep=`ls -1rt $vdir/$mach/$dorv/$nam/ | tail -1l`
f1s=${vdir}/${mach}/${dorv}/${nam}/${rep}/run.stat
f2s=${vdir}/${mach}/${dorv2}/${nam2}/${rep}/run.stat
if [ -d $vdir/$mach/$dorv/$nam ] ; then
rep=`ls -1rt $vdir/$mach/$dorv/$nam/ | tail -1l`
f1s=${vdir}/${mach}/${dorv}/${nam}/${rep}/run.stat
f2s=${vdir}/${mach}/${dorv2}/${nam2}/${rep}/run.stat
#
if [ -f $f1s ] && [ -f $f2s ] ; then
if [ -f $f1s ] && [ -f $f2s ] ; then
cmp -s $f1s $f2s
if [ $? == 0 ]; then
if [ $pass == 0 ]; then
......@@ -453,8 +454,11 @@ function identictest(){
read y
fi
fi
else
else
printf "%-27s %-27s %s\n" $nam $nam2 " incomplete test"
fi
else
printf "%-27s %-27s %s\n" " " " " " non-existent test directory"
fi
}
########################### END of function definitions #################################
......@@ -467,11 +471,13 @@ function identictest(){
SETTE_DIR=$(cd $(dirname "$0"); pwd)
MAIN_DIR=$(dirname $SETTE_DIR)
. ./param.cfg
if [ -z $USER_INPUT ] ; then USER_INPUT='yes' ; fi # Default: yes => request user input on decisions.
# (but may br inherited/imported from sette.sh)
mach=${COMPILER}
# overwrite revision (later) or compiler
if [ $# -gt 0 ]; then
while getopts r:R:c:v:V:h option; do
while getopts r:R:c:v:V:uh option; do
case $option in
c) mach=$OPTARG;;
r) rev=$OPTARG;;
......@@ -484,6 +490,7 @@ function identictest(){
echo "Requested comparison subdirectory: ${NEMO_VALIDATION_DIR}/${SETTE_SUB_VAL2} does not exist"
fi
;;
u) USER_INPUT='no';;
h | *) echo ''
echo 'sette_rpt.sh : '
echo ' display result for the latest change'
......@@ -498,6 +505,7 @@ function identictest(){
echo ' -V sub_dir2 :'
echo ' 2nd validation sub-directory below NEMO_VALIDATION_DIR'
echo ' if set the comparison is between two subdirectory trees beneath NEMO_VALIDATION_DIR'
echo ' -u to run sette_rpt.sh without any user interaction'
echo ''
exit 42;;
esac
......@@ -507,24 +515,41 @@ function identictest(){
# if $1 (remaining arguments)
if [[ ! -z $1 ]] ; then rev=$1 ; fi
# Check that git branch is usable
git branch --show-current >&/dev/null
if [[ $? == 0 ]] ; then
# subdirectory below NEMO_VALIDATION_DIR defaults to branchname
NAM_MAIN="$(git branch --show-current)"
else
# subdirectory below NEMO_VALIDATION_DIR defaults to "MAIN"
NAM_MAIN="MAIN"
fi
if [ ! -z $SETTE_SUB_VAL ] ; then
export NEMO_VALIDATION_DIR=$NEMO_VALIDATION_DIR/$SETTE_SUB_VAL
if [ -d $NEMO_VALIDATION_REF/$SETTE_SUB_VAL ] && [ -z $SETTE_SUB_VAL2 ] ; then
if [ -d $NEMO_VALIDATION_REF/$SETTE_SUB_VAL ] && [ -z $SETTE_SUB_VAL2 ] && [ ${USER_INPUT} == "yes" ] ; then
while true; do
read -p "$NEMO_VALIDATION_REF/$SETTE_SUB_VAL exists. Do you wish to use it as a reference? " yn
case $yn in
[Yy]* ) export $NEMO_VALIDATION_REF/$SETTE_SUB_VAL; break;;
[Nn]* ) echo "Ok, continuing with ${NEMO_VALIDATION_REF}/MAIN as the reference directory"
export NEMO_VALIDATION_REF=${NEMO_VALIDATION_REF}/MAIN
[Yy]* ) export NEMO_VALIDATION_REF=$NEMO_VALIDATION_REF/$SETTE_SUB_VAL; break;;
[Nn]* ) echo "Ok, continuing with ${NEMO_VALIDATION_REF}/${NAM_MAIN} as the reference directory"
export NEMO_VALIDATION_REF=${NEMO_VALIDATION_REF}/${NAM_MAIN}
break
;;
* ) echo "Please answer yes or no.";;
esac
done
elif [ -d $NEMO_VALIDATION_REF/$SETTE_SUB_VAL ] && [ -z $SETTE_SUB_VAL2 ] ; then
# No user input: make a best guess as to intent
export NEMO_VALIDATION_REF=$NEMO_VALIDATION_REF/$SETTE_SUB_VAL
elif [ -z $SETTE_SUB_VAL2 ] ; then
# No user input: default to branchname or MAIN
export NEMO_VALIDATION_REF=$NEMO_VALIDATION_REF/${NAM_MAIN}
fi
else
export NEMO_VALIDATION_DIR=${NEMO_VALIDATION_DIR}/MAIN
export NEMO_VALIDATION_REF=${NEMO_VALIDATION_REF}/MAIN
export NEMO_VALIDATION_DIR=${NEMO_VALIDATION_DIR}/${NAM_MAIN}
if [ -z $SETTE_SUB_VAL2 ] ; then
export NEMO_VALIDATION_REF=$NEMO_VALIDATION_REF/${NAM_MAIN}
fi
fi
NEMO_VALID=${NEMO_VALIDATION_DIR}
NEMO_VALID_REF=${NEMO_VALIDATION_REF}
......@@ -547,7 +572,7 @@ rev_date0=`git log -1 | grep Date | sed -e 's/.*Date: *//' -e's/ +.*$//'`
rev_date=`${DATE_CONV}"${rev_date0}" +"%y%j"`
revision=${rev_date}_${revision}
branchname=`git branch --show-current`
if [ $localchanges > 0 ] ; then
if [[ $localchanges > 0 ]] ; then
echo "Current code is : $branchname @ $revision ( with local changes )"
lastchange=${revision}+
else
......@@ -561,7 +586,7 @@ lastchange=${rev:-$lastchange}
echo ""
echo "SETTE validation report generated for : "
echo ""
if [ $localchanges > 0 ] ; then
if [[ $localchanges > 0 ]] ; then
echo " $branchname @ $revision (with local changes)"
else
echo " $branchname @ $revision"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment