1#!/bin/bash
2
3# author: Ole Schuett
4
5if (( $# != 2 )) ; then
6    echo "Usage: test_regtest.sh <ARCH> <VERSION>"
7    exit 1
8fi
9
10ARCH=$1
11VERSION=$2
12
13# shellcheck disable=SC1091
14source /opt/cp2k-toolchain/install/setup
15
16# Make OpenMPI happy.
17if which ompi_info &> /dev/null ; then
18    TESTOPTS="-mpiexec 'mpiexec --bind-to none --allow-run-as-root' ${TESTOPTS}"
19    export OMPI_MCA_plm_rsh_agent=/bin/false
20fi
21
22echo -en "\nCompiling cp2k... "
23cd /workspace/cp2k
24if make -j ARCH="${ARCH}" VERSION="${VERSION}" &> make.out ; then
25    echo "done."
26else
27    echo "failed."
28    cat make.out
29    echo -e "\nSummary: Compilation failed."
30    echo -e "Status: FAILED\n"
31    exit 0
32fi
33
34
35if [[ "${ARCH}" == "local" ]] ; then
36    echo -en "\nChecking benchmarks... "
37    if ! ./tools/regtesting/check_inputs.py "./exe/${ARCH}/cp2k.${VERSION}" "./benchmarks/" ; then
38        echo -e "\nSummary: Some benchmark inputs could not be parsed."
39        echo -e "Status: FAILED\n"
40        exit 0
41    fi
42fi
43
44
45echo -e "\n========== Running Regtests =========="
46make ARCH="${ARCH}" VERSION="${VERSION}" TESTOPTS="${TESTOPTS}" test
47
48exit 0 # Prevent CI from overwriting do_regtest's summary message.
49
50#EOF
51