1#!/bin/bash
2
3# author: Ole Schuett
4
5if (( $# != 2 )) ; then
6    echo "Usage: install_regtest.sh <ARCH> <VERSION>"
7    exit 1
8fi
9
10ARCH=$1
11VERSION=$2
12
13# setup arch files
14cd /workspace/cp2k/arch
15ln -vs /opt/cp2k-toolchain/install/arch/local* .
16
17# shellcheck disable=SC1091
18source /opt/cp2k-toolchain/install/setup
19
20# Make OpenMPI happy.
21if which ompi_info &> /dev/null ; then
22    TESTOPTS="-mpiexec 'mpiexec --bind-to none --allow-run-as-root' ${TESTOPTS}"
23    export OMPI_MCA_plm_rsh_agent=/bin/false
24fi
25
26# pre-build cp2k
27cd /workspace/cp2k
28echo -n "Warming cache by trying to compile... "
29if make -j ARCH="${ARCH}" VERSION="${VERSION}" &> /dev/null ; then
30    echo "done."
31else
32    echo "failed."
33fi
34
35# run regtests which lack fixed reference value
36# Disable LeakSanitizer during docker build as it requires ptrace capabilities.
37export LSAN_OPTIONS="detect_leaks=0"
38
39echo -n "Trying to run regtests which lack reference values... "
40if make test ARCH="${ARCH}" VERSION="${VERSION}" TESTOPTS="${TESTOPTS} -restrictdir QS/regtest-almo-md -restrictdir QS/regtest-almo-1 -restrictdir SE/regtest-3-4 -restrictdir QS/regtest-ot-1-vib -restrictdir Fist/regtest-5-vib -restrictdir QS/regtest-optbas -restrictdir TMC/regtest_ana_post_proc" &> /dev/null ; then
41   echo "done."
42else
43   echo "failed."
44fi
45
46# remove binaries to reduce image size
47rm -rf lib exe "regtesting/${ARCH}/${VERSION}"/TEST-*
48
49#EOF
50