Commit 15c6152b authored by gsell's avatar gsell

Merge branch 'master' of gitlab.psi.ch:OPAL/regression-tests

parents 20dd1458 649bca81
MASK1.h5
MSLIT1.h5
MSLIT2.h5
Mask-1.h5
module load git/2.3.3
module load cmake/3.6.3
module load gcc/5.4.0
module load openmpi/1.10.4
module load boost/1.62.0
module load hdf5/1.8.18
module load H5hut/2.0.0rc3
module load gsl/2.2.1
module load trilinos/12.10.1
module load OpenBLAS/0.2.19
#!/bin/bash
declare -rx OPAL_VERSION=1.5
declare -r PRINCIPAL_NAME='svcusr-amas_regr'
declare -rx REGTEST_WWW="/afs/psi.ch/project/amas/webhosting/opal/regressionTests/${OPAL_VERSION}"
declare tests=''
tests+="BeamLine-1,"
tests+="BeamLine-2,"
tests+="CSRBendDrift,"
tests+="DCGun-Cornell-1,"
tests+="DCGun-Cornell-2,"
tests+="Degrader-1,"
tests+="Distribution-Binomial-1,"
tests+="Distribution-Gauss-1,"
tests+="Distribution-Gauss-2,"
tests+="EGunCTF3-1,"
tests+="EGunCTF3-2,"
tests+="Envelope-Tracker-Phase1,"
tests+="ExternalFieldTest,"
tests+="HKick-Test-1,"
tests+="Kick-Test-1,"
tests+="OpalRingTest,"
tests+="PROSCAN-1,"
tests+="PROSCAN-2,"
tests+="PSIGUN-1,"
tests+="PerfectDiode,"
tests+="Quad-Simple-Test-1,"
tests+="RBend-Simple-Test-1,"
tests+="RBend-Simple-Test-2,"
tests+="RBend-Simple-Test-3,"
tests+="RBend-Simple-Test-4,"
tests+="RestartTest-1,"
tests+="RestartTest-2,"
tests+="RestartTest-3,"
tests+="RestartTest-4,"
tests+="RestartTest-5,"
tests+="RestartTest-6,"
tests+="RestartTest-7,"
tests+="RestartTest-8,"
tests+="RingCyclotron,"
tests+="RingCyclotronMTS,"
tests+="RingCyclotronMatched,"
tests+="SAAMG-Test-1,"
tests+="SBend-Simple-Test-1,"
tests+="SBend-Simple-Test-2,"
tests+="SBend-Simple-Test-3,"
tests+="SBend-Simple-Test-4,"
tests+="Scan-1,"
tests+="VKick-Test-1,"
tests+="opalimpact-1"
#!/bin/bash
# for Macports
# :FIXME: do we need this?
# YES: as long as readlink(1) shipped with Mac OS X does not
# support the option '-f'
PATH+=":/opt/local/bin:/usr/local/bin"
# for Mac OS
declare -rx MACOSX_DEPLOYMENT_TARGET=10.9
#exec 1> $0.stdout
#exec 2> $0.stderr
declare -r abs_scriptname=$(readlink -f "$0")
declare -r bindir="${abs_scriptname%/*}"
declare -r basedir="${bindir%/*/*}"
declare -r builddir="${basedir}/build"
declare -r opalbin="${builddir}/src/opal"
declare -r srcdir="${basedir}/src"
declare -r testsdir="${basedir}/tests"
declare -r keytab="${HOME}/.keytab"
# read configuration and tests to run
source "${bindir}/regression_tests.conf"
# these shell variable must be set for the tests
declare -rx OPAL_EXE_PATH="${basedir}/build/src"
declare -r run_tests="${basedir}/tests/RegressionTests/run/run-reg-tests.py"
#
declare force_run='no'
declare new_opal_binary='no'
declare use_afs='yes'
declare do_publish='yes'
declare opts=''
while (( $# > 0 )); do
case $1 in
--do-publish )
do_publish=='yes'
;;
--dont-publish )
publish=='no'
;;
--publish-dir )
REGTEST_WWW="$2"
shift 1
;;
--publish-dir=* )
REGTEST_WWW="${1#*=}"
;;
--use-afs )
use_afs='yes'
;;
-f | --force )
force_run='yes'
;;
-* )
echo "Unknown option: $1" 1>&2
exit
;;
* )
echo "No arguments allowed" 1>&2
exit 1
;;
esac
shift 1
done
[[ ${do_publish} == 'yes' ]] && opts+=" --do-publish"
load_modules() {
source /opt/psi/config/profile.bash
module purge
module use unstable
source "${bindir}/modules.conf"
}
update_repo() {
local -r repodir="$1"
if [[ -z "${repodir}" ]]; then
echo "$0: Missing argument!" 1>&2
exit 1
fi
if [[ ! -d "${repodir}" ]]; then
echo "${repodir}: does not exist or is not a directory!" 1>&2
exit 1
fi
cd "${repodir}"
if ! git rev-parse --is-inside-work-tree 1>/dev/null 2>&1 ; then
echo "${repodir}: is not a Git working directory!" 1>&2
exit 1
fi
local -r branch=$(git rev-parse --abbrev-ref HEAD)
git fetch || { echo "git fetch failed!" 1>&2; exit 10; }
local -i num_changed_files=$(git diff --name-only "origin/${branch}" | wc -l | awk '{print $1}')
if (( $num_changed_files == 0 )); then
echo "Working directory '${repodir}' is up to date!"
return 1
fi
git merge || { echo "git merge failed!" 1>&2; exit 11; };
return 0
}
compile_opal() {
cd "${basedir}" || exit 1
rm -rf "${builddir}" || exit 1
mkdir "${builddir}" || exit 1
cd "${builddir}" || exit 1
cmake -DCMAKE_BUILD_TYPE=RELEASE -DENABLE_SAAMG_SOLVER=TRUE "${srcdir}"
make -j10 || exit 1
}
run_regressiontests() {
if [[ ${use_afs} == 'yes' ]]; then
declare -rx KRB5CCNAME=$(mktemp /tmp/krb5cc_$(id -u)_XXXXXX)
/usr/bin/kinit -t "${keytab}" -k "${PRINCIPAL_NAME}" || exit 2
/usr/bin/aklog || exit 2
fi
"${run_tests}" --user --run-local --tests="${tests}"
if [[ ${use_afs} == 'yes' ]]; then
/usr/bin/unlog
/usr/bin/kdestroy
fi
}
main() {
echo "Updating OPAL source repository..."
update_repo "${srcdir}"
if [[ $? == 0 ]] || [[ ! -e "${opalbin}" ]]; then
echo "Compiling OPAL ..."
compile_opal || exit 1
new_opal_binary='yes'
fi
echo "Updating test repository..."
update_repo "${testsdir}"
if [[ $? == 0 ]] || [[ ${new_opal_binary} == 'yes' ]] || [[ ${force_run} == 'yes' ]] ; then
echo "Running regression tests..."
run_regressiontests || exit 1
fi
}
load_modules
main
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment