Skip to content
Snippets Groups Projects
Commit fe3f5000 authored by Guillaume Samson's avatar Guillaume Samson :snowman2:
Browse files

Merge branch '117-repeatability-of-test-case-sette-tests' into 'main'

Resolve "Repeatability of test-case SETTE tests"

Closes #117 and #84

See merge request nemo/nemo!178
parents b4692d5d 81209e99
No related branches found
No related tags found
No related merge requests found
# configurations & testcases
# configurations, testcases & tools
*/work_cfgs.txt
cfgs/work_cfgs.txt
cfgs/*/BLD
cfgs/*/EXP00
cfgs/*/WORK
cfgs/*_ST
tests/work_cfgs.txt
tests/*/BLD
tests/*/EXP00
tests/*/WORK
tests/*_ST
tools/*/BLD
tools/*/*.exe
tools/tools.txt
# mk
mk/arch*
mk/cpp.*
mk/full_key_list.txt
......@@ -88,18 +88,17 @@ x_u=''; x_a=''; x_m=''; x_t=''; x_b='';
x_j='1'; x_e='none'; x_s='src'; x_v='1'
x_c_cfg=0
x_nocdf=0
x_name=''
##- Local variables ---
b_n=$(basename ${0})
OPTIND='1'
MAIN_DIR=$(cd $(dirname "$0"); pwd)
MAIN_DIR=${MAIN_DIR%/sette*}
MAIN_DIR=${MAIN_DIR%/tools*}
MAIN_DIR=${MAIN_DIR%/cfgs*}
MAIN_DIR=${MAIN_DIR%/tests*}
MAIN_DIR=${MAIN_DIR%/ext*}
MAIN_DIR=${MAIN_DIR%/arch*}
MAIN_DIR=${MAIN_DIR%/sette}
MAIN_DIR=${MAIN_DIR%/tools}
MAIN_DIR=${MAIN_DIR%/cfgs}
MAIN_DIR=${MAIN_DIR%/tests}
MAIN_DIR=${MAIN_DIR%/ext}
MAIN_DIR=${MAIN_DIR%/arch}
export MAIN_DIR
#
export CFGS_DIR=${MAIN_DIR}/cfgs
......@@ -195,7 +194,7 @@ EOF
-d|--dirs|--comp)
x_d=${2} ; shift ;;
-n|--name)
x_name=${2} ; shift ;;
x_n=${2} ; shift ;;
-r|--ref)
x_r=${2} ; shift ;;
-a|--academic|--test)
......@@ -229,34 +228,6 @@ EOF
shift
done
if [ -n "$x_name" ] # is the configuration existing in cfgs or tests? or is it a new conf?
then
incfg=$( find $CFGS_DIR -type d -name $x_name | wc -l ) # this configuration exists in CFGS_DIR
intst=$( find $TESTS_DIR -type d -name $x_name | wc -l ) # this configuration exists in TESTS_DIR
if [ $(( $incfg + $intst )) -eq 2 ] ; then
echo -e "\033[0;31m\nERROR: the $x_name directory is found twice: in $CFGS_DIR and in $TESTS_DIR\033[0m\n"
exit 4
fi
if [ $(( $incfg + $intst )) -gt 0 ] ; then
if [ $x_c_cfg -eq 1 ] ; then # if we just want to clean the config (do it here as it must exist)
x_n=$x_name # must define x_n as it is used in Fclean_config.sh
. ${COMPIL_DIR}/Fclean_config.sh
exit 0
fi
[ -n "$x_r" ] && echo -e "\nWARNING: $x_name configuration is already existing, we ignore \"-r $x_r\"\n"
[ -n "$x_a" ] && echo -e "\nWARNING: $x_name configuration is already existing, we ignore \"-a $x_a\"\n"
fi
if [ $incfg -eq 1 ] ; then
x_r=$x_name ; x_a='' # reference configuration existing -> define/overwrite x_r
elif [ $intst -eq 1 ] ; then
x_a=$x_name ; x_r='' # test configuration existing -> define/overwrite x_a
else
[ ${#x_c} -ne 0 ] && echo -e "\nWARNING: Compilation cleaning of a non-existing configuration, we ignore\n" && exit 0
[ $x_c_cfg -eq 1 ] && echo -e "\nWARNING: Configuration cleaning of a non-existing configuration, we ignore\n" && exit 0
x_n=$x_name # this is a new configuration -> define
fi
fi
export NEW_CONF=${x_n}
NBR_PRC=${x_j}
CMP_NAM=${x_m}
......@@ -268,21 +239,10 @@ NEMO_DBG=${x_b}
[ "${CMP_NAM}" == 'all' ] && . ${COMPIL_DIR}/Flist_archfile.sh all && exit
## No ref. cfg or demo selected
if [[ -z "${REF_CONF}" && -z "${DEMO_CONF}" ]]; then
echo -e "\033[0;31m\nAt least a reference configuration ('-r'), a test case ('-a'), "
echo -e "a remote configuration ('-u') has to be choosen to build a new configuration!!!\033[0m"
${COMPIL_DIR}/Flist_cfgs.sh
exit 2
fi
## At least one config has been requested
## 'all' arg: list all available configurations
if [[ "${REF_CONF}" == 'all' || "${DEMO_CONF}" == 'all' ]]; then
${COMPIL_DIR}/Flist_cfgs.sh
exit 2
## Probably useless but who knows?
elif [[ -n "${REF_CONF}" && -n "${DEMO_CONF}" ]]; then
echo -e "\033[0;31m\nYou have to choose whether you work with:"
echo -e " - LTS configurations in ./cfgs ('-r') or"
......@@ -292,29 +252,73 @@ elif [ -n "${REF_CONF}" ]; then
conf_file=ref_cfgs.txt ; export CONFIG_DIR=${CFGS_DIR} ; TML_CONF=${REF_CONF}
elif [ -n "${DEMO_CONF}" ]; then
conf_file=demo_cfgs.txt; export CONFIG_DIR=${TESTS_DIR}; TML_CONF=${DEMO_CONF}
fi
## Reuse a working cfg
grep -q "${TML_CONF} " ${CONFIG_DIR}/work_cfgs.txt 2>/dev/null && conf_file=work_cfgs.txt
## Test if ref. cfg or demo case does exist
if (! grep -q "${TML_CONF} " ${CONFIG_DIR}/$conf_file ); then
elif [ $( grep -l "^${NEW_CONF} " */work_cfgs.txt 2> /dev/null | wc -l ) -eq 1 ]; then
conf_file=$( grep -l "^${NEW_CONF} " ${CFGS_DIR}/work_cfgs.txt ${TESTS_DIR}/work_cfgs.txt )
export CONFIG_DIR=$( dirname $conf_file ); conf_file=$( basename $conf_file )
TML_CONF=${NEW_CONF}
elif [ $( grep -l "^${NEW_CONF} " */work_cfgs.txt 2> /dev/null | wc -l ) -eq 2 ]; then
echo -e "\033[0;31m\nUser configuration is present in both"
echo -e "cfgs/work_cfgs.txt and tests/work_cfgs.txt files"
echo -e "Please choose only one \033[0m"
exit 2
elif ! grep -q "^${NEW_CONF} " ${CFGS_DIR}/work_cfgs.txt ${TESTS_DIR}/work_cfgs.txt 2> /dev/null; then
echo -e "\033[0;31m\nThe reference configuration ('-r') or "
echo -e "demonstration case ('-a') selected is not available!!!"
echo -e "Check the option used and the available items in .txt files\033[0m"
${COMPIL_DIR}/Flist_cfgs.sh
exit 2
else
exit 2
fi
## If new cfg exists, work in it
if [ -n "${NEW_CONF}" ]
then
echo
printf "\nYou are installing a new configuration %s from %s " ${NEW_CONF} ${TML_CONF}
printf "with sub-components: %s\n" "${NEM_SUBDIR}"
echo
else
NEW_CONF=${TML_CONF}
if [ -z "${NEW_CONF}" ]; then NEW_CONF=$TML_CONF; fi
export NEMO_TDIR=${x_t:-$CONFIG_DIR}
# check configuration existence & clean it if asked
incfg=$( find $NEMO_TDIR -type d -maxdepth 1 -name ${NEW_CONF} 2>/dev/null | wc -l ) # this configuration exists in CFGS_DIR
if [ $incfg -eq 1 ] ; then
# CLEANING
if [ $x_c_cfg -eq 1 ] ; then
. ${COMPIL_DIR}/Fclean_config.sh
exit 0
elif [ ${#x_c} -ne 0 ]; then
read -p "Are you sure that you want to clean $NEW_CONF configuration ? " -n 1 -r; echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
# We coose the default light file
[ $x_nocdf -eq 1 ] && export USEBLD=bldxagxcdf.cfg || export USEBLD=bldxag.cfg
# We look after agrif
grep key_agrif ${NEMO_TDIR}/BLD/cpp.fcm 2>/dev/null && export AGRIFUSE=1 && export USEBLD=${USEBLD/xag/}
# fcm clean
fcm build ${x_c} --ignore-lock -v ${x_v} -j ${NBR_PRC} ${COMPIL_DIR}/$USEBLD || exit 1
# add remove for clean option
echo -e '\nCleaning '${NEW_CONF}' building directories and variables\n'
for dir in AGRIFLIB BLD LONG NEMOFILES REPRO_* SHORT WORK; do
rm -rf ${NEMO_TDIR}/${NEW_CONF}/$dir
done
for file in cpp.history cpp.fcm full_key_list.txt; do
rm -f ${NEMO_TDIR}/${NEW_CONF}/BLD/$file
done
exit 0
else
echo "cleaning cancelled"
exit 2
fi
fi
if [[ -n "$x_n" && -n "$REF_CONF" ]]; then echo -e "\nWARNING: $x_n configuration is already existing, we ignore \"-r $REF_CONF\"\n"; REF_CONF=""; fi
if [[ -n "$x_n" && -n "$DEMO_CONF" ]]; then echo -e "\nWARNING: $x_n configuration is already existing, we ignore \"-a $DEMO_CONF\"\n"; DEMO_CONF=""; fi
elif [ $incfg -eq 0 ]; then
[ $x_c_cfg -eq 1 ] && echo -e "\nWARNING: Configuration cleaning of a non-existing configuration, we ignore\n" && exit 0
[ ${#x_c} -ne 0 ] && echo -e "\nWARNING: Compilation cleaning of a non-existing configuration, we ignore\n" && exit 0
fi
## No ref. cfg or demo selected
if [[ -z "${REF_CONF}" && -z "${DEMO_CONF}" && $incfg -eq 0 ]]; then
echo -e "\033[0;31m\nAt least a reference configuration ('-r'), a test case ('-a'), "
echo -e "a remote configuration ('-u') has to be choosen to build a new configuration!!!\033[0m"
${COMPIL_DIR}/Flist_cfgs.sh
exit 2
fi
## Update sub-comps if needed
......@@ -322,20 +326,22 @@ if [ -z "${NEM_SUBDIR}" ]; then
NEM_SUBDIR=$( grep "${TML_CONF} " ${CONFIG_DIR}/${conf_file} | awk '{$1 = ""; print $0}' )
fi
export NEMO_TDIR=${x_t:-$CONFIG_DIR}
export NEM_SUBDIR="${NEM_SUBDIR}" NEW_CONF="${NEW_CONF}"
## If new cfg exists, work in it
if [ ${TML_CONF} != ${NEW_CONF} ]; then
echo
printf "\nYou are installing a new configuration %s from %s " ${NEW_CONF} ${TML_CONF}
if [ -n "${NEM_SUBDIR}" ]; then printf "with sub-components: %s\n" "${NEM_SUBDIR}"; fi
echo
fi
## Save new configuration with sub-components set in work_cfgs.txt
[ -f ${CONFIG_DIR}/work_cfgs.txt ] && sed -i "/${NEW_CONF} /d" ${CONFIG_DIR}/work_cfgs.txt
[ -f ${CONFIG_DIR}/work_cfgs.txt ] && sed -i "/^${NEW_CONF} /d" ${CONFIG_DIR}/work_cfgs.txt
echo ${NEW_CONF} "${NEM_SUBDIR}" >> ${CONFIG_DIR}/work_cfgs.txt
cd ${CONFIG_DIR}
## Create new config even in existing one (mkdir with -p option, cp with -n)
${COMPIL_DIR}/Fmake_config.sh ${NEW_CONF} ${TML_CONF}
## create EXP00 if needed
[ ! -d ${CONFIG_DIR}/${NEW_CONF}/EXP00 ] && \cp -R -n ${CONFIG_DIR}/${NEW_CONF}/EXPREF ${CONFIG_DIR}/${NEW_CONF}/EXP00
${COMPIL_DIR}/Fmake_config.sh ${NEMO_TDIR}/${NEW_CONF} ${CONFIG_DIR}/${TML_CONF}
#- Create the WORK ---
#- Clean links and librairies ---
......@@ -346,12 +352,12 @@ ${COMPIL_DIR}/Fmake_config.sh ${NEW_CONF} ${TML_CONF}
# build the complete list of the cpp keys of this configuration
if [[ ${chk_key} -eq 1 || ${list_key} -eq 1 ]] ; then
for i in $( grep "^ *#.* key_" ${NEW_CONF}/WORK/* ); do
for i in $( grep "^ *#.* key_" ${NEMO_TDIR}/${NEW_CONF}/WORK/* ); do
echo $i | grep key_ | sed -e "s/=.*//"
done \
| sort -d | uniq > ${COMPIL_DIR}/full_key_list.txt
| sort -d | uniq > ${NEMO_TDIR}/${NEW_CONF}/BLD/full_key_list.txt
[ ${list_key} -eq 1 ] && echo && cat ${COMPIL_DIR}/full_key_list.txt && exit 0
[ ${list_key} -eq 1 ] && echo && cat ${NEMO_TDIR}/${NEW_CONF}/BLD/full_key_list.txt && exit 0
fi
#- At this stage new configuration has been added, we add or remove keys
......@@ -361,12 +367,12 @@ fi
#- check that all keys are really existing...
if [ $chk_key -eq 1 ] ; then
for kk in $( cat ${NEW_CONF}/cpp_${NEW_CONF}.fcm ); do
for kk in $( cat ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm ); do
if [ "$( echo $kk | cut -c 1-4 )" == "key_" ]; then
kk=${kk/=*/}
if [ ! $( grep -w $kk ${COMPIL_DIR}/full_key_list.txt ) ]; then
if [ ! $( grep -w $kk ${NEMO_TDIR}/${NEW_CONF}/BLD/full_key_list.txt ) ]; then
echo
echo "E R R O R : key "$kk" is not found in ${NEW_CONF}/WORK routines..."
echo "E R R O R : key "$kk" is not found in ${NEMO_TDIR}/${NEW_CONF}/WORK routines..."
echo "we stop..."
echo
exit 1
......@@ -377,16 +383,7 @@ fi
#- At this stage cpp keys have been updated. we can check the arch file
#- When used for the first time, choose a compiler ---
. ${COMPIL_DIR}/Fcheck_archfile.sh arch_nemo.fcm cpp.fcm ${CMP_NAM} || exit 3
#- At this stage the configuration has beeen chosen
#- We coose the default light file
[ $x_nocdf -eq 1 ] && export USEBLD=bldxagxcdf.cfg || export USEBLD=bldxag.cfg
#- We look after agrif
grep key_agrif ${COMPIL_DIR}/cpp.fcm && export AGRIFUSE=1 && export USEBLD=${USEBLD/xag/}
. ${COMPIL_DIR}/Fprep_agrif.sh ${NEW_CONF} ${NEMO_TDIR} arch_nemo.fcm || exit 3
. ${COMPIL_DIR}/Fcheck_archfile.sh ${NEMO_TDIR}/${NEW_CONF}/BLD/arch_nemo.fcm ${NEMO_TDIR}/${NEW_CONF}/BLD/cpp.fcm ${CMP_NAM} || exit 3
#-
#_ END OF CONFIGURATION PHASE
#_
......@@ -395,40 +392,32 @@ grep key_agrif ${COMPIL_DIR}/cpp.fcm && export AGRIFUSE=1 && export USEBLD=${USE
#- Compile ---
if [ "${NBR_PRC}" -gt 0 ]; then
cd ${NEMO_TDIR}/${NEW_CONF} || cd -
# We coose the default light file
[ $x_nocdf -eq 1 ] && export USEBLD=bldxagxcdf.cfg || export USEBLD=bldxag.cfg
# We look after agrif
grep key_agrif ${NEMO_TDIR}/${NEW_CONF}/BLD/cpp.fcm 2>/dev/null && export AGRIFUSE=1 && export USEBLD=${USEBLD/xag/}
. ${COMPIL_DIR}/Fprep_agrif.sh ${NEW_CONF} ${NEMO_TDIR} arch_nemo.fcm || exit 3
## if AGRIF we do a first preprocessing
if [[ ${#x_c} -eq 0 && "$AGRIFUSE" -eq 1 ]]; then
fcm build --ignore-lock -j 1 ${COMPIL_DIR}/bld_preproagr.cfg ||{ cd - ; exit 1 ;}
fcm build --ignore-lock -j 1 ${COMPIL_DIR}/bld_preproagr.cfg || exit 1
echo ''
echo "---------------------------------"
echo "CONV preprocessing successfull !!"
echo "---------------------------------"
echo ''
fi
fcm build ${x_c} --ignore-lock -v ${x_v} -j ${NBR_PRC} ${COMPIL_DIR}/$USEBLD ||{ cd - ; exit 1 ;}
fcm build ${x_c} --ignore-lock -v ${x_v} -j ${NBR_PRC} ${COMPIL_DIR}/$USEBLD || exit 1
if [ -f ${NEMO_TDIR}/${NEW_CONF}/BLD/bin/nemo.exe ]; then
ln -sf ${NEMO_TDIR}/${NEW_CONF}/BLD/bin/nemo.exe ${CONFIG_DIR}/${NEW_CONF}/EXP00/nemo
ln -sf ${NEMO_TDIR}/${NEW_CONF}/BLD/bin/nemo.exe ${NEMO_TDIR}/${NEW_CONF}/EXP00/nemo
fi
## add remove for clean option
if [ ${#x_c} -ne 0 ]; then
echo -e '\nCleaning '${NEW_CONF}' building directories and variables\n'
for dir in AGRIFLIB BLD LONG NEMOFILES REPRO_* SHORT WORK; do
rm -rf ${NEMO_TDIR}/${NEW_CONF}/$dir
done
for file in cpp.history cpp.fcm full_key_list.txt; do
rm -f ${COMPIL_DIR}/$file
done
fi
fi
#- Come back to original directory ---
cd -
#-
#- Unset variables
${COMPIL_DIR}/Fclean_var.sh
......@@ -64,11 +64,11 @@ set -o posix
#-
echo "Adding keys in : ${NEW_CONF}"
for i in ${list_add_key} ; do
if [ "$(cat ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm | grep -c "\<$i\>" )" -ne 0 ] ; then
if [ "$(cat ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm | grep -c "\<$i\>" )" -ne 0 ] ; then
echo "key $i already present in cpp_${NEW_CONF}.fcm"
else
sed -e "s/$/ ${i}/" ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm > ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp
mv ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm
sed -e "s/$/ ${i}/" ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm > ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp
mv ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm
echo "added key $i in ${NEW_CONF}"
fi
done
......
......@@ -73,19 +73,20 @@ EOF
eval "echo \"$line\" >> $2"
done < $1
}
# cleaning related to the old version
rm -f $( find ${COMPIL_DIR} -type f -name $1 -print )
rm -f $( find $(dirname $1) -type f -name $(basename $1) -print )
#
if [ ${#3} -eq 0 ]; then # arch not specified
if [ ! -f ${COMPIL_DIR}/arch.history ]; then
if [ ! -f $(dirname $1)/arch.history ]; then
echo "Warning !!!"
echo "NO compiler chosen"
echo "Try makenemo -h for help"
echo "EXITING..."
exit 1
else # use the arch file defined in arch.history
myarch=$( cat ${COMPIL_DIR}/arch.history )
myarch=$( cat $(dirname $1)/arch.history )
if [ ! -f $myarch ]; then
echo "Warning !!!"
echo "previously used arch file no more found:"
......@@ -93,26 +94,26 @@ if [ ${#3} -eq 0 ]; then # arch not specified
echo "EXITING..."
exit 1
else
if [ -f ${COMPIL_DIR}/$1 ]; then
if [ "$2" != "nocpp" ]
if [ -f $1 ]; then
if [[ ! "$2" =~ "nocpp" ]]
then
# has the cpp keys file been changed since we copied the arch file in ${COMPIL_DIR}?
mycpp=$( ls -l ${COMPIL_DIR}/$2 | sed -e "s/.* -> //" )
if [ "$mycpp" != "$( cat ${COMPIL_DIR}/cpp.history )" ]; then
echo $mycpp > ${COMPIL_DIR}/cpp.history
cpeval ${myarch} ${COMPIL_DIR}/$1
mycpp=$( ls -l $2 | sed -e "s/.* -> //" )
if [ "$mycpp" != "$( cat $(dirname $2)/cpp.history )" ]; then
echo $mycpp > $(dirname $2)/cpp.history
cpeval ${myarch} $1
fi
# has the cpp keys file been updated since we copied the arch file in ${COMPIL_DIR}?
mycpp=$( find -L ${COMPIL_DIR} -cnewer ${COMPIL_DIR}/$1 -name $2 -print )
[ ${#mycpp} -ne 0 ] && cpeval ${myarch} ${COMPIL_DIR}/$1
mycpp=$( find -L $(dirname $2) -cnewer $(basename $1) -name $(basename $2) -print )
[ ${#mycpp} -ne 0 ] && cpeval ${myarch} $1
fi
# has myarch file been updated since we copied it in ${COMPIL_DIR}?
myarchdir=$( dirname ${myarch} )
myarchname=$( basename ${myarch} )
myarch=$( find -L $myarchdir -cnewer ${COMPIL_DIR}/$1 -name $myarchname -print )
[ ${#myarch} -ne 0 ] && cpeval ${myarch} ${COMPIL_DIR}/$1
myarch=$( find -L $myarchdir -cnewer $(basename $1) -name $myarchname -print )
[ ${#myarch} -ne 0 ] && cpeval ${myarch} $1
else
cpeval ${myarch} ${COMPIL_DIR}/$1
cpeval ${myarch} $1
fi
fi
fi
......@@ -135,68 +136,68 @@ else
fi
myarch=$( find ${MAIN_DIR}/arch -name arch-${3}.fcm -print )
# we were already using this arch file ?
if [ "$myarch" == "$( cat ${COMPIL_DIR}/arch.history )" ]; then
if [ -f ${COMPIL_DIR}/$1 ]; then
if [ "$2" != "nocpp" ]
if [ "$myarch" == "$( cat $(dirname $1)/arch.history 2>/dev/null)" ]; then
if [ -f $1 ]; then
if [[ ! "$2" =~ "nocpp" ]]
then
# has the cpp keys file been changed since we copied the arch file in ${COMPIL_DIR}?
mycpp=$( ls -l ${COMPIL_DIR}/$2 | sed -e "s/.* -> //" )
if [ "$mycpp" != "$( cat ${COMPIL_DIR}/cpp.history )" ]; then
echo $mycpp > ${COMPIL_DIR}/cpp.history
cpeval ${myarch} ${COMPIL_DIR}/$1
mycpp=$( ls -l $2 | sed -e "s/.* -> //" )
if [ "$mycpp" != "$( cat $(dirname $2)/cpp.history )" ]; then
echo $mycpp > $(dirname $2)/cpp.history
cpeval ${myarch} $1
fi
# has the cpp keys file been updated since we copied the arch file in ${COMPIL_DIR}?
mycpp=$( find -L ${COMPIL_DIR} -cnewer ${COMPIL_DIR}/$1 -name $2 -print )
[ ${#mycpp} -ne 0 ] && cpeval ${myarch} ${COMPIL_DIR}/$1
mycpp=$( find -L $(dirname $2) -cnewer $(basename $1) -name $(basename $2) -print )
[ ${#mycpp} -ne 0 ] && cpeval ${myarch} $1
fi
# has myarch file been updated since we copied it in ${COMPIL_DIR}?
myarch=$( find -L ${MAIN_DIR}/arch -cnewer ${COMPIL_DIR}/$1 -name arch-${3}.fcm -print )
[ ${#myarch} -ne 0 ] && cpeval ${myarch} ${COMPIL_DIR}/$1
myarch=$( find -L ${MAIN_DIR}/arch -cnewer $(basename $1) -name arch-${3}.fcm -print )
[ ${#myarch} -ne 0 ] && cpeval ${myarch} $1
else
cpeval ${myarch} ${COMPIL_DIR}/$1
cpeval ${myarch} $1
fi
else
if [ "$2" != "nocpp" ]
if [[ ! "$2" =~ "nocpp" ]]
then
ls -l ${COMPIL_DIR}/$2 | sed -e "s/.* -> //" > ${COMPIL_DIR}/cpp.history
ls -l $2 | sed -e "s/.* -> //" > $(dirname $2)/cpp.history
fi
echo ${myarch} > ${COMPIL_DIR}/arch.history
cpeval ${myarch} ${COMPIL_DIR}/$1
echo ${myarch} > $(dirname $1)/arch.history
cpeval ${myarch} $1
fi
fi
#- do we need xios library?
#- 2 cases:
#- in CONFIG directory looking for key_xios or key_iomput
if [ "$1" == "arch_nemo.fcm" ]
if [ "$(basename $1)" == "arch_nemo.fcm" ]
then
if [ "$2" != "nocpp" ]
if [[ ! "$2" =~ "nocpp" ]]
then
use_iom=$( sed -e "s/#.*$//" ${COMPIL_DIR}/$2 | grep -c "key_xios\|key_iomput" )
use_iom=$( sed -e "s/#.*$//" $2 | grep -c "key_xios\|key_iomput" )
else
use_iom=0
fi
have_lxios=$( sed -e "s/#.*$//" ${COMPIL_DIR}/$1 | grep -c "\-lxios" )
have_lxios=$( sed -e "s/#.*$//" $1 | grep -c "\-lxios" )
if [[ ( $use_iom -eq 0 ) && ( $have_lxios -ge 1 ) ]]
then
sed -e "s/-lxios//g" ${COMPIL_DIR}/$1 > ${COMPIL_DIR}/tmp$$
mv -f ${COMPIL_DIR}/tmp$$ ${COMPIL_DIR}/$1
sed -e "s/-lxios//g" $1 > $(dirname $1)/tmp$$
mv -f $(dirname $1)/tmp$$ $1
fi
#- in TOOLS directory looking for USE xios
else
use_iom=$( egrep --exclude-dir=.svn -r USE ${NEW_CONF}/src/* | grep -c xios )
have_lxios=$( sed -e "s/#.*$//" ${COMPIL_DIR}/$1 | grep -c "\-lxios" )
use_iom=$( egrep --exclude-dir=.svn -r USE ${MAIN_DIR}/src/* | grep -c xios )
have_lxios=$( sed -e "s/#.*$//" $1 | grep -c "\-lxios" )
if [[ ( $use_iom -eq 0 ) || ( $have_lxios != 1 ) ]]
then
sed -e "s/-lxios//g" ${COMPIL_DIR}/$1 > ${COMPIL_DIR}/tmp$$
mv -f ${COMPIL_DIR}/tmp$$ ${COMPIL_DIR}/$1
sed -e "s/-lxios//g" $1 > $(dirname $1)/tmp$$
mv -f $(dirname $1)/tmp$$ $1
fi
fi
#- do we need oasis libraries?
if [ "$2" != "nocpp" ]
if [[ ! "$2" =~ "nocpp" ]]
then
use_oasis=$( sed -e "s/#.*$//" ${COMPIL_DIR}/$2 | grep -c key_oasis3 )
use_oasis=$( sed -e "s/#.*$//" $2 | grep -c key_oasis3 )
else
use_oasis=0
fi
......@@ -206,26 +207,26 @@ if [[ ! -z "$XIOS_OASIS" ]]; then
fi
for liboa in psmile.MPI1 mct mpeu scrip mpp_io
do
have_liboa=$( sed -e "s/#.*$//" ${COMPIL_DIR}/$1 | grep -c "\-l${liboa}" )
have_liboa=$( sed -e "s/#.*$//" $1 | grep -c "\-l${liboa}" )
if [[ ( $use_oasis -eq 0 ) && ( $have_liboa -ge 1 ) ]]
then
sed -e "s/-l${liboa}//g" ${COMPIL_DIR}/$1 > ${COMPIL_DIR}/tmp$$
mv -f ${COMPIL_DIR}/tmp$$ ${COMPIL_DIR}/$1
sed -e "s/-l${liboa}//g" $1 > $(dirname $1)/tmp$$
mv -f $(dirname $1)/tmp$$ $1
fi
done
# Nemo debug ?
if [ -n "${NEMO_DBG}" ]; then
if (! grep -q "^%DEBUG_FCFLAGS" ${COMPIL_DIR}/$1 ); then
if (! grep -q "^%DEBUG_FCFLAGS" $1 ); then
echo "ERROR: You must defined '%DEBUG_FCFLAGS' in your arch file if you want to compile Nemo in debug mode using '-d' option"
exit 1
fi
# duplicate the lines starting with %DEBUG_XXX and replace, in the duplicated line, %DEBUG_XXX by %XXX
sed -i "/^%DEBUG_/{p;s/^%DEBUG_\([^ ]*\)/%\1/;}" ${COMPIL_DIR}/$1
sed -i "/^%DEBUG_/{p;s/^%DEBUG_\([^ ]*\)/%\1/;}" $1
else
if (! grep -q "^%PROD_FCFLAGS" ${COMPIL_DIR}/$1 ); then
if (! grep -q "^%PROD_FCFLAGS" $1 ); then
echo "WARNING: '%PROD_FCFLAGS' not defined in your arch file, makenemo will use '%FCFLAGS' instead"
fi
# duplicate the lines starting with %PROD_XXX and replace, in the duplicated line, %PROD_XXX by %XXX
sed -i "/^%PROD_/{p;s/^%PROD_\([^ ]*\)/%\1/;}" ${COMPIL_DIR}/$1
sed -i "/^%PROD_/{p;s/^%PROD_\([^ ]*\)/%\1/;}" $1
fi
......@@ -58,6 +58,6 @@ set -o posix
echo "Defining keys in : ${NEW_CONF}"
echo " bld::tool::fppkeys ${list_def_key}" > ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm
echo " bld::tool::fppkeys ${list_def_key}" > ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm
unset -v list_def_key
......@@ -65,14 +65,14 @@ echo "Removing keys in : ${NEW_CONF}"
for i in ${list_del_key} ; do
if [ "$(echo ${i} | grep -c key_nproc )" -ne 0 ]; then
sed -e "s/key_nproc[ij]=.* //" ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm \
> ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp
mv ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm
sed -e "s/key_nproc[ij]=.* //" ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm \
> ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp
mv ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm
echo " "
elif [ "$(cat ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm | grep -c "$i" )" -ne 0 ]; then
sed -e "s/\b${i}\b//" ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm \
> ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp
mv ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm
elif [ "$(cat ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm | grep -c "$i" )" -ne 0 ]; then
sed -e "s/\b${i}\b//" ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm \
> ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp
mv ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm
echo "deleted key $i in ${NEW_CONF}"
fi
......
......@@ -64,14 +64,14 @@ set -o posix
#
#-
declare ZSRC=${@}
ZCONF=${NEW_CONF}
ZCONF=${NEMO_TDIR}/${NEW_CONF}
ZTAB=${NEM_SUBDIR[@]}
declare NDIR=${#ZTAB[@]}
echo 'Creating '${ZCONF}'/WORK = '${ZTAB[*]}' for '${ZCONF}
echo 'Creating '${ZCONF}'/WORK = '${ZTAB[*]}' for '${ZCONF##*/}
[ ! -d ${ZCONF}/MY_SRC ] && \mkdir ${ZCONF}/MY_SRC
[ -d ${ZCONF}/WORK ] || \mkdir ${ZCONF}/WORK
[ ! -d ${ZCONF}/MY_SRC ] && \mkdir -p ${ZCONF}/MY_SRC
[ -d ${ZCONF}/WORK ] || \mkdir -p ${ZCONF}/WORK
for comp in ${ZTAB[*]}; do
find ${NEMO_DIR}/$comp -name *.[Ffh]90 -exec ln -sf {} ${ZCONF}/WORK \;
......
......@@ -57,8 +57,7 @@ set -o posix
# * creation
#
#-
[ ! -d ${3}/${2} ] && \mkdir ${3}/${2}
[ ! -d ${3}/${2}/BLD ] && \mkdir ${3}/${2}/BLD
[ ! -d ${1}/${2}/BLD ] && ln -sf ${3}/${2}/BLD ${1}/${2}/BLD
[ -f ${1}/${NEW_CONF}/cpp_${NEW_CONF}.fcm ] && ln -sf ${1}/${NEW_CONF}/cpp_${NEW_CONF}.fcm ${COMPIL_DIR}/cpp.fcm
rm -f ${1}/${NEW_CONF}/BLD/fcm.bld.lock
[ ! -d ${3}/${2} ] && \mkdir -p ${3}/${2}
[ ! -d ${3}/${2}/BLD ] && \mkdir -p ${3}/${2}/BLD
[ -f ${3}/${2}/cpp_${2}.fcm ] && ln -sf ${3}/${2}/cpp_${2}.fcm ${3}/${2}/BLD/cpp.fcm
rm -f ${1}/${2}/BLD/fcm.bld.lock
......@@ -59,8 +59,9 @@ set -o posix
\mkdir -p ${1}
\mkdir -p ${1}/EXP00
\mkdir -p ${1}/MY_SRC
\cp -R -n ${2}/cpp_${2}.fcm ${1}/cpp_${1}.fcm
\cp -R -n ${2}/EXPREF/*namelist* ${1}/EXP00/.
\cp -R -n ${2}/EXPREF/*.xml ${1}/EXP00/.
[ -f ${2}/EXPREF/AGRIF_FixedGrids.in ] && \cp -R -n ${2}/EXPREF/AGRIF_FixedGrids.in ${1}/EXP00/.
[ -d ${2}/MY_SRC ] && \cp -n ${2}/MY_SRC/* ${1}/MY_SRC/. 2> /dev/null
[ "${2}/cpp_${2##*/}.fcm" != "${1}/cpp_${1##*/}.fcm" ] && \cp -R -n ${2}/cpp_${2##*/}.fcm ${1}/cpp_${1##*/}.fcm
for f in ${2}/EXPREF/*.xml ${2}/EXPREF/*namelist*; do
if [ -L ${f} ]; then ln -sf $(readlink -f ${f}) ${1}/EXP00/$(basename ${f}); else cp -R -n ${f} ${1}/EXP00/.; fi
done
[ -f ${2}/EXPREF/AGRIF_FixedGrids.in ] && \cp -a -n ${2}/EXPREF/AGRIF_FixedGrids.in ${1}/EXP00/.
[ -d ${2}/MY_SRC ] && \cp -an ${2}/MY_SRC/* ${1}/MY_SRC/. 2> /dev/null
......@@ -62,5 +62,5 @@ set -o posix
[ ! -d ${1}/${2}/BLD ] && ln -sf ${3}/${2}/BLD ${1}/${2}/BLD
# enforce presence of cpp_tools.fcm (write a blank one if not present in the tools directory)
# cp instead of ln to avoid overwiting previous tool cpp_XXX.fcm file when compiling a file without cpp_YYY.fcm file.
[ -f ${1}/${NEW_CONF}/cpp_${NEW_CONF}.fcm ] && cp -f ${1}/${NEW_CONF}/cpp_${NEW_CONF}.fcm ${COMPIL_DIR}/cpp_tools.fcm || echo 'bld::tool::fppkeys ' > ${COMPIL_DIR}/cpp_tools.fcm
[ -f ${3}/${2}/cpp_${2}.fcm ] && ln -sf -f ${3}/${2}/cpp_${2}.fcm ${3}/${2}/BLD/cpp_tools.fcm || echo 'bld::tool::fppkeys ' > ${3}/${2}/BLD/cpp_tools.fcm
rm -f ${1}/${NEW_CONF}/BLD/fcm.bld.lock
......@@ -7,8 +7,8 @@ cfg::version 1.0
# Build information
# ------------------------------------------------------------------------------
inc $COMPIL_DIR/arch_nemo.fcm
inc $COMPIL_DIR/cpp.fcm
inc $NEMO_TDIR/$NEW_CONF/BLD/arch_nemo.fcm
inc $NEMO_TDIR/$NEW_CONF/BLD/cpp.fcm
search_src 1
......
......@@ -7,11 +7,11 @@ cfg::version 1.0
# Build information
# ------------------------------------------------------------------------------
inc $COMPIL_DIR/arch_nemo.fcm
inc $COMPIL_DIR/cpp.fcm
inc $NEMO_TDIR/$NEW_CONF/BLD/arch_nemo.fcm
inc $NEMO_TDIR/$NEW_CONF/BLD/cpp.fcm
search_src 1
src::nemo $CONFIG_DIR/$NEW_CONF/WORK
src::nemo $NEMO_TDIR/$NEW_CONF/WORK
bld::target lib_cray.f90 nemo.f90 agrif_user.f90 agrif2model.f90
......
......@@ -7,13 +7,13 @@ cfg::version 1.0
# Build information
# ------------------------------------------------------------------------------
inc $COMPIL_DIR/arch_nemo.fcm
inc $COMPIL_DIR/cpp.fcm
inc $NEMO_TDIR/$NEW_CONF/BLD/arch_nemo.fcm
inc $NEMO_TDIR/$NEW_CONF/BLD/cpp.fcm
search_src 1
src::ioipsl $MAIN_DIR/ext/IOIPSL/src
src::nemo $CONFIG_DIR/$NEW_CONF/WORK
src::nemo $NEMO_TDIR/$NEW_CONF/WORK
src::ppr_1d $MAIN_DIR/ext/PPR/src
bld::target nemo.exe
......
......@@ -7,8 +7,8 @@ cfg::version 1.0
# Build information
# ------------------------------------------------------------------------------
inc $COMPIL_DIR/arch_tools.fcm
inc $COMPIL_DIR/cpp_tools.fcm
inc $TOOLS_DIR/$NEW_CONF/BLD/arch_tools.fcm
inc $TOOLS_DIR/$NEW_CONF/BLD/cpp_tools.fcm
search_src 1
......
......@@ -7,8 +7,8 @@ cfg::version 1.0
# Build information
# ------------------------------------------------------------------------------
inc $COMPIL_DIR/arch_nemo.fcm
inc $COMPIL_DIR/cpp.fcm
inc $NEMO_TDIR/$NEW_CONF/BLD/arch_nemo.fcm
inc $NEMO_TDIR/$NEW_CONF/BLD/cpp.fcm
search_src 1
......
......@@ -7,8 +7,8 @@ cfg::version 1.0
# Build information
# ------------------------------------------------------------------------------
inc $COMPIL_DIR/arch_nemo.fcm
inc $COMPIL_DIR/cpp.fcm
inc $NEMO_TDIR/$NEW_CONF/BLD/arch_nemo.fcm
inc $NEMO_TDIR/$NEW_CONF/BLD/cpp.fcm
search_src 1
......
......@@ -7,7 +7,7 @@ cfg::version 1.0
# ------------------------------------------------------------------------------
# Build information
# ------------------------------------------------------------------------------
inc $COMPIL_DIR/$MYARCH
inc $NEMO_TDIR/$NEW_CONF/BLD/$MYARCH
bld::tool::cc %CC
bld::tool::cflags %CFLAGS
......
DOMAINcfg
......@@ -94,8 +94,8 @@ usage=" if value is a string ths is neede syntax : ./set_namelist namelist_name
sync_config() {
if [ ${SYNC_CONFIGS} == "yes" ]; then
lREF=$3/$1 # reference
lCFG=$3/$2 # target
lREF=$1 # reference
lCFG=$2 # target
echo '-------------------------------------------------------------------------------'
echo ' SOURCE AND CONFIG FILES SYNCHRONISATION '
......@@ -146,24 +146,16 @@ sync_config() {
# clean _STg config (input CFG CFG_STg TYPE (test or ref))
clean_config() {
if [ ${CLEAN_CONFIGS} == "yes" ]; then
lREF=$1
lCFG=$2
lTYP=$3
lCFG=$1
echo ''
echo '-------------------------------------------------------------------------------'
echo ' CLEANING CONFIGURATION '
echo ''
echo "./makenemo -n $lCFG -a/-r $lREF -t ${CMP_DIR:-${CONFIG_DIR0}} clean"
echo "./makenemo -n $(basename $lCFG) ${CUSTOM_DIR:+-t ${CMP_DIR}} clean"
echo ''
if [ ${lTYP} == 'tests' ]; then
./makenemo -n $lCFG -t ${CMP_DIR:-${CONFIG_DIR0}} -a $lREF clean
elif [ ${lTYP} == 'cfgs' ]; then
./makenemo -n $lCFG -t ${CMP_DIR:-${CONFIG_DIR0}} -r $lREF clean
else
echo 'ERROR in the cleaning process'; exit 42
fi
./makenemo -n $(basename $lCFG) ${CUSTOM_DIR:+-t ${CMP_DIR}} clean
echo ''
echo "$lCFG configuration has been cleaned"
echo "$(basename $lCFG) configuration has been cleaned"
echo ''
echo '-------------------------------------------------------------------------------'
fi
......
......@@ -67,23 +67,25 @@ set -o posix
# PREPARE EXEC_DIR
#==================
if [ -z "${CUSTOM_DIR}" ]; then
export EXE_DIR=${CONFIG_DIR}/${NEW_CONF}/${TEST_NAME}
EXE_DIR=${CONFIG_DIR}/${NEW_CONF}
else
CMP_NAM_L=$(echo ${CMP_NAM} | tr '[:upper:]' '[:lower:]')
if [[ -n "${NEMO_DEBUG}" || ${CMP_NAM_L} =~ ("debug"|"dbg") ]]; then
export EXE_DIR=${CUSTOM_DIR}/${SETTE_SUB_VAL}_${NEMO_REV}_DEBUG/${NEW_CONF}/${TEST_NAME}
else
export EXE_DIR=${CUSTOM_DIR}/${SETTE_SUB_VAL}_${NEMO_REV}/${NEW_CONF}/${TEST_NAME}
EXE_DIR=${CUSTOM_DIR}/${SETTE_SUB_VAL}_${NEMO_REV}/${NEW_CONF}
fi
fi
mkdir -p ${EXE_DIR}
mkdir -p ${EXE_DIR}/${TEST_NAME}
cp -RL ${CONFIG_DIR}/${NEW_CONF}/EXP00/* ${EXE_DIR}/.
#cat ${SETTE_DIR}/iodef_sette.xml | sed -e"s;DEF_SHARED;${CONFIG_DIR0}/SHARED;" > ${EXE_DIR}/iodef.xml
#cp -RL ${EXE_DIR:-${CONFIG_DIR}/${NEW_CONF}}/EXP00/* ${EXE_DIR}/${TEST_NAME}/.
cp -an ${EXE_DIR:-${CONFIG_DIR}/${NEW_CONF}}/EXP00/* ${EXE_DIR}/${TEST_NAME}/.
COMP_KEYS="`cat ${EXE_DIR}/cpp_${NEW_CONF}.fcm | sed -e 's/.*fppkeys *//'`"
export EXE_DIR=${EXE_DIR}/${TEST_NAME}
cd ${EXE_DIR}
#
# Add summary of the sette.sh set-up used and the current list of keys added or deleted
COMP_KEYS="`cat ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm | sed -e 's/.*fppkeys *//'`"
echo "Summary of sette environment" > ./sette_config
echo "----------------------------" >> ./sette_config
echo "requested by the command : "$cmd $cmdargs >> ./sette_config
......
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