cp2k/tools/docker/scripts/test_aiida.sh

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

94 lines
2.3 KiB
Bash
Raw Permalink Normal View History

2018-11-08 13:56:15 +01:00
#!/bin/bash -e
# author: Ole Schuett
echo -e "\n========== Installing Dependencies =========="
apt-get update -qq
export DEBIAN_FRONTEND=noninteractive
export DEBCONF_NONINTERACTIVE_SEEN=true
apt-get install -qq --no-install-recommends \
python3-setuptools \
python3-wheel \
python3-pip \
2024-04-30 21:46:47 +02:00
python3-venv \
python3-dev \
postgresql \
libpq-dev \
rabbitmq-server \
2024-11-05 23:48:20 +01:00
locales \
plocate \
sudo \
git \
2025-02-18 10:28:13 +01:00
ssh \
mpich
2025-02-17 15:09:21 +01:00
rm -rf /var/lib/apt/lists/*
2024-04-30 21:46:47 +02:00
# Create and activate a virtual environment for Python packages.
python3 -m venv /opt/venv
export PATH="/opt/venv/bin:$PATH"
2022-02-04 23:57:50 +01:00
# Some buggy Python packages open utf8 files in text mode.
# As a workaround we set locale.getpreferredencoding() to utf8.
export LANG="en_US.UTF-8" LANGUAGE="en_US:en" LC_ALL="en_US.UTF-8"
locale-gen ${LANG}
2022-02-04 23:57:50 +01:00
# Pick a compiler (needed to build some Python packages)
export CC=gcc
2019-09-08 22:08:33 +02:00
echo -e "\n========== Installing AiiDA-CP2K plugin =========="
git clone --quiet https://github.com/aiidateam/aiida-cp2k.git /opt/aiida-cp2k/
2019-09-08 22:08:33 +02:00
cd /opt/aiida-cp2k/
# For compatibility of Python 3.14
# pip3 install './[dev]'
pip3 install .
pip3 install 'pytest>=8.4' 'pgtest~=1.3'
2019-09-08 22:08:33 +02:00
echo -e "\n========== Configuring AiiDA =========="
AS_UBUNTU_USER="sudo -u ubuntu -H"
# start RabbitMQ
service rabbitmq-server start
# start and configure PostgreSQL
service postgresql start
2024-11-05 23:48:20 +01:00
# create aiida profile
$AS_UBUNTU_USER /opt/venv/bin/verdi presto
# fake the presents of conda
ln -s /bin/true /usr/bin/conda
2025-02-02 13:19:26 +01:00
# fake the presents of aiida-pseudo
ln -s /bin/true /usr/bin/aiida-pseudo
2019-09-08 22:08:33 +02:00
# setup code
2024-11-05 23:48:20 +01:00
mkdir -p /opt/conda/envs/cp2k/bin/
cat > /opt/conda/envs/cp2k/bin/cp2k.psmp << EndOfMessage
2018-11-08 13:56:15 +01:00
#!/bin/bash -e
export OMP_NUM_THREADS=2
source /opt/cp2k-toolchain/install/setup
/opt/cp2k/build/bin/cp2k.ssmp "\$@"
2018-11-08 13:56:15 +01:00
EndOfMessage
chmod +x /opt/conda/envs/cp2k/bin/cp2k.psmp
2018-11-08 13:56:15 +01:00
echo -e "\n========== Running AiiDA-CP2K Tests =========="
set +e # disable error trapping for remainder of script
(
2021-02-17 17:02:43 +01:00
set -e # abort on error
ulimit -t 1800 # abort after 30 minutes
2025-02-02 13:19:26 +01:00
$AS_UBUNTU_USER /opt/venv/bin/py.test -k "not example_sirius"
2018-11-08 13:56:15 +01:00
)
EXIT_CODE=$?
AIIDA_COMMIT=$(git rev-parse --short HEAD)
2021-02-17 17:02:43 +01:00
if ((EXIT_CODE)); then
echo -e "\nSummary: Something is wrong with aiida-cp2k commit ${AIIDA_COMMIT}."
echo -e "Status: FAILED\n"
2018-11-08 13:56:15 +01:00
else
echo -e "\nSummary: aiida-cp2k commit ${AIIDA_COMMIT} works fine."
echo -e "Status: OK\n"
2018-11-08 13:56:15 +01:00
fi
#EOF