#!/bin/bash cd $( dirname $0 ) ##-------------------------------------------------------------------------------- ## Set flags & defaults ##-------------------------------------------------------------------------------- TRUST_MAIN_DIR=$PWD TRUST_FLAG_DEBUG='false' ; TRUST_FLAG_HELP='false' ; TRUST_FLAG_PROD='false' rev=$( svn info | awk '/Last Changed Rev/ {print $NF}' ) ##-------------------------------------------------------------------------------- ## Get arguments from command line ##-------------------------------------------------------------------------------- while getopts a:b:de:f:j:hm:n:r:t:pu:v:w: arg; do case $arg in a) TRUST_IO_FORC_TAR=$OPTARG;; b) TRUST_SVN_BRANCH=$OPTARG;; d) TRUST_FLAG_DEBUG='true' ;; e) TRUST_TEST_MAILING=$OPTARG;; f) TRUST_IO_FORC_PATH=$OPTARG;; j) TRUST_COMPILE_NPROC=$OPTARG;; h) TRUST_FLAG_HELP='true' ;; m) TRUST_MAIN_HPCC=$OPTARG;; n) TRUST_CFG_NEW=$OPTARG;; r) TRUST_CFG_REF=$OPTARG;; t) TRUST_JOB_TIMEOUT=$OPTARG;; p) TRUST_FLAG_PROD='true' ;; u) TRUST_MAIN_USER=$OPTARG;; v) TRUST_SVN_REV=$OPTARG;; w) TRUST_DIR_WORK=$OPTARG;; :) echo 'Arg. needed for '$OPTARG && TRUST_FLAG_HELP='true' ;; *) TRUST_FLAG_HELP='true' ;; esac done ##-------------------------------------------------------------------------------- ## Initialization (user & HPC environment) ##-------------------------------------------------------------------------------- if [[ ! -e cfg/${TRUST_MAIN_USER}.cfg || ! -e cfg/${TRUST_MAIN_HPCC}.cfg \ || ${TRUST_FLAG_HELP} == 'true' ]]; then cat ./inc/trusting_help.txt if [ ${TRUST_FLAG_HELP} == 'false' ]; then printf "\n\n\033[0;33m" printf "At least one configuration (arch or user) file is missing or misspelled:" printf "\t'%s'.cfg\t'%s'.cfg" ${TRUST_MAIN_USER} ${TRUST_MAIN_HPCC} printf "\033[0m" fi printf "\n\nContent of 'config' folder:" find config -name *.cfg | cut -d/ -f2 \ | xargs -n 4 printf "%-25s\t%-25s\t%-25s\n" exit 1 else ## Verbose output on debug mode [ ${TRUST_FLAG_DEBUG} == 'true' ] && set -vx . ./inc/trusting.env . ./inc/trusting_func.sh fi ##-------------------------------------------------------------------------------- ## Trusting workflow ##-------------------------------------------------------------------------------- ## Test summary ##------------- echo if [ -t 0 ]; then cat ./inc/banner.txt; else cat ./inc/banner.html; fi echo echo '****************************************************************************************************' echo '* *' echo '* NEMO Trusting (Continuous Integration Tool) *' echo "* ver.$rev *" echo '* *' echo '****************************************************************************************************' echo printf "\t§ Testing configuration\t\t%s on branch %s\n" \ ${TRUST_CFG_REF} ${TRUST_SVN_BRANCH} printf "\t§ (Super)Computer\t\t%s\n" ${TRUST_MAIN_HPCC} printf "\t§ User installation\t\t%s\n\n" ${TRUST_MAIN_USER} echo if [ ${TRUST_TEST_BENCHMARK} ]; then printf "\t§ Benchmark folder\n\t\t\t%s\n" ${TRUST_TEST_BENCHMARK} fi ## Testing directory ##------------------ print_step 'Timestamped testing directory' init ## Local working copy ##------------------- print_step 'SVN action on NEMO directories' printf "${TRUST_SVN_ACTION} on ${TRUST_SVN_NEMOGCM}:\n\n" get_nemo_rev ## Environment ##------------ print_step 'Get testing environment' get_soft_rel ## Compilation(s) ##--------------- print_step 'Compile XIOS' compile_xios print_step "Compile ${TRUST_CFG_NEW} cfg from ${TRUST_CFG_REF}" compile_nemo ## Inputs ##------- print_step 'Set job (copying or extracting inputs)' get_inputs print_step 'Compare inputs' diff_inputs ## Job ##---- print_step 'Submit job' job_submit print_step 'Pending job' job_pending print_step 'Job finished' print_step 'Test job state' job_state print_step 'Get job performances' job_perfs ## Outputs ##-------- print_step 'Compare outputs' diff_results print_step 'Compare restarts' diff_restarts ## End, at least nothing major has changed ;-) ##-------------------------------------------- get_out 0