#!/bin/bash cd $( dirname $0 ) ## Set defaults ##--------------------------------------------------- NEMO_TRUS=$PWD DEBUG=0; PUBLISH=0 IMOD=0; ST='FAILED' ## No modules system & 'FAILED' status SVN_CMD='svn status' ## No update on directories trus_help='trusting_help.txt' ## Get options for replacing initials settings ##--------------------------------------------------- while [ $# -ne 0 ]; do case $1 in '-a'|'--archive') NEMO_TARF=$2 ; shift 2;; '-b'|'--branch ') NEMO_BRAN=$2 ; shift 2;; '-d'|'--debug ') set -vx; DEBUG=1; shift ;; '-e'|'--email ') EMAIL=$2 ; shift 2;; '-j'|'--job ') NPROC=$2 ; shift 2;; '-h'|'--help ') cat ${help_file}; exit 1;; '-m'|'--machine') NEMO_HPCC=$2 ; shift 2;; '-n'|'--newconf') TEST_CONF=$2 ; shift 2;; '-r'|'--refconf') REFE_CONF=$2 ; shift 2;; '-t'|'--time ') TIME_LIMI=$2 ; shift 2;; '-p'|'--publish') PUBLISH=1 ; shift ;; '-u'|'--user ') NEMO_USER=$2 ; shift 2;; '-v'|'--version') NEMO_VERS=$2 ; shift 2;; "*" ) cat ${help_file}; exit 1;; esac done ## DEBUG options to speed up & expand verbosity of compilation xios_full='--full'; stderr_redir='>&' [ $DEBUG -eq 1 ] && { xios_full=''; stderr_redir='>'; } ## If -v|--version option has been set, modify default SVN action on directories if [ $( echo ${NEMO_VERS} | grep "HEAD\|up\|update" ) ]; then SVN_CMD='svn update -r HEAD' elif [ $( echo ${NEMO_VERS} | grep -o '{[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}}' ) ]; then SVN_CMD='svn update -r '$( echo ${NEMO_VERS} | grep -o '{[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}}' ) elif [ $( echo ${NEMO_VERS} | grep -o '[0-9]*' ) ]; then SVN_CMD='svn update -r '$( echo ${NEMO_VERS} | grep -o '[0-9]*' ) fi ## Initialization (super-computer & user environment) ##--------------------------------------------------- if [[ ! -z "${NEMO_HPCC}" && ! -z "${NEMO_USER}" ]]; then if [ ! $( find ${NEMO_TRUS}/config -name ${NEMO_USER}'.cfg' ) ]; then echo 'No configuration file (.cfg) in '${NEMO_TRUS}'/config for '${NEMO_USER} exit 1 elif [ ! $( find ${NEMO_TRUS}/config -name ${NEMO_HPCC}'.cfg' ) ]; then echo 'No configuration file (.cfg) in '${NEMO_TRUS}'/config for '${NEMO_HPCC} exit 1 else . ${NEMO_TRUS}/trusting.env fi else cat ${NEMO_TRUS}/${trus_help} exit 1 fi . ./trusting_func.sh ## Display contextual summary of trusting test ##--------------------------------------------------- echo 'NEMO Trusting test:' echo '-------------------' echo 'Testing '${TEST_CONF}' based on '${REFE_CONF}' from '${NEMO_BRAN} echo 'NEMO installation: '${NEMO_USER} echo 'Computing architecture: '${NEMO_HPCC} echo 'Trusting SVN version: '$( svn info | awk '(NR == 9) {print $NF}' ) ## Make timestamped directory with messenger files ##--------------------------------------------------- print_step 'Timestamped testing directory' mkdir -p ${TEST_DIR} ${REFE_DIR} cd ${TEST_DIR} && echo ${TEST_DIR} init_files get_date ## Get SVN revision on XIOS & NEMO essentials directories ##--------------------------------------------------- print_step "SVN action on NEMO directories: ${SVN_CMD}" get_nemo_rev ## Check softwares versions (after sourced arch environment) ##--------------------------------------------------- print_step 'Get softwares releases' [ -e ${ARCH_ENV} ] && . ${ARCH_ENV} > /dev/null [ $? -eq 0 ] && export IMOD=1 get_soft_rel cat model.log ## XIOS compilation from scratch ##--------------------------------------------------- print_step 'Compile XIOS' cd ${DIR_XIOS} eval ./make_xios ${xios_full} --arch ${NEMO_HPCC} --job $NPROC \ ${stderr_redir} /dev/null [ ! -e lib/libxios.a ] && get_out 1 || echo 'Success' ## NEMO compilation from scratch ##--------------------------------------------------- print_step "Compile ${REFE_CONF} configuration" cd ${NEMO_CONF} [[ -d ${TEST_CONF} && $DEBUG -eq 0 ]] && ./makenemo -n ${TEST_CONF} clean_config \ > /dev/null <