Docker: Improve error messages and comply with shellcheck

This commit is contained in:
Ole Schütt 2020-07-10 15:12:23 +02:00 committed by Ole Schütt
parent 5eedb3c18e
commit 283c0c5360
10 changed files with 56 additions and 43 deletions

View file

@ -20,7 +20,7 @@ rm -rf /var/lib/apt/lists/*
# install dependencies of aiida-cp2k
cd /opt/
git clone --quiet https://github.com/aiidateam/aiida-cp2k.git
pip3 install --quiet ./aiida-cp2k/[test]
pip3 install --quiet './aiida-cp2k/[test]'
pip3 uninstall --quiet --yes aiida-cp2k
# create ubuntu user with sudo powers
@ -31,7 +31,8 @@ echo "ubuntu ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
source /opt/cp2k-toolchain/install/setup
# link mpi executables into path
for i in $(dirname "$(which mpirun)")/* ; do ln -sf "$i" /usr/bin/; done
MPI_INSTALL_DIR=$(dirname "$(command -v mpirun)")
for i in "${MPI_INSTALL_DIR}"/* ; do ln -sf "$i" /usr/bin/; done
# setup arch files
cd /workspace/cp2k/arch

View file

@ -11,20 +11,20 @@ ARCH=$1
VERSION=$2
# setup arch files
cd /workspace/cp2k/arch
cd /workspace/cp2k/arch || exit 1
ln -vs /opt/cp2k-toolchain/install/arch/local* .
# shellcheck disable=SC1091
source /opt/cp2k-toolchain/install/setup
# Make OpenMPI happy.
if which ompi_info &> /dev/null ; then
if command -v ompi_info &> /dev/null ; then
TESTOPTS="-mpiexec 'mpiexec --bind-to none --allow-run-as-root' ${TESTOPTS}"
export OMPI_MCA_plm_rsh_agent=/bin/false
fi
# pre-build cp2k
cd /workspace/cp2k
cd /workspace/cp2k || exit 1
echo -n "Warming cache by trying to compile... "
if make -j ARCH="${ARCH}" VERSION="${VERSION}" &> /dev/null ; then
echo "done."

View file

@ -8,19 +8,20 @@ source /opt/cp2k-toolchain/install/setup
echo -e "\n========== Compiling CP2K =========="
cd /workspace/cp2k
echo -n "Compiling cp2k... "
if make -j VERSION=pdbg &> /dev/null ; then
echo "done."
if make -j VERSION=pdbg &> make.out ; then
echo "done."
else
echo -e "failed.\n\n"
echo "Summary: Compilation failed."
echo "Status: FAILED"
exit
echo -e "failed.\n\n"
tail -n 100 make.out
echo -e "\nSummary: Compilation failed."
echo -e "Status: FAILED\n"
exit 0
fi
echo -e "\n========== Installing AiiDA-CP2K plugin =========="
cd /opt/aiida-cp2k/
git pull
pip3 install ./[test]
pip3 install './[test]'
echo -e "\n========== Configuring AiiDA =========="
AS_UBUNTU_USER="sudo -u ubuntu -H"

View file

@ -7,13 +7,14 @@ source /opt/cp2k-toolchain/install/setup
cd /workspace/cp2k
echo -n "Compiling cp2k... "
if make -j VERSION=pdbg &> /dev/null ; then
echo "done."
if make -j VERSION=pdbg &> make.out ; then
echo "done."
else
echo -e "failed.\n\n"
echo "Summary: Compilation failed."
echo "Status: FAILED"
exit
echo -e "failed.\n\n"
tail -n 100 make.out
echo -e "\nSummary: Compilation failed."
echo -e "Status: FAILED\n"
exit 0
fi
echo -e "\n========== Installing CP2K =========="

View file

@ -14,7 +14,7 @@ VERSION=$1
source /opt/cp2k-toolchain/install/setup
echo -e "\n========== Running Regtests =========="
cd /workspace/cp2k
cd /workspace/cp2k || exit 1
CP2K_REVISION=$(./tools/build_utils/get_revision_number ./src)
rm -rf "obj/${ARCH}/${VERSION}"/*.gcda # remove old gcov statistics
@ -24,9 +24,9 @@ make ARCH="${ARCH}" VERSION="${VERSION}" TESTOPTS="${TESTOPTS}" test
# Maybe related: https://bugs.launchpad.net/gcc-arm-embedded/+bug/1694644
# As a workaround we'll simply remove the offending files for now.
rm -f "/workspace/cp2k/obj/${ARCH}/${VERSION}"/exts/*/*.gcda
cd /tmp
cd /tmp || exit 1
GCOV_TIMEOUT="10s"
for fn in /workspace/cp2k/obj/${ARCH}/${VERSION}/*.gcda; do
for fn in "/workspace/cp2k/obj/${ARCH}/${VERSION}"/*.gcda ; do
if ! timeout "${GCOV_TIMEOUT}" gcov "$fn" &> /dev/null ; then
echo "Skipping ${fn} because gcov took longer than ${GCOV_TIMEOUT}."
rm "${fn}"
@ -35,7 +35,7 @@ done
# collect coverage stats
mkdir -p /workspace/artifacts/coverage
cd /workspace/artifacts/coverage
cd /workspace/artifacts/coverage || exit 1
lcov --directory "/workspace/cp2k/obj/${ARCH}/${VERSION}" --capture --output-file coverage.info > lcov.log
lcov --summary coverage.info

View file

@ -8,13 +8,14 @@ source /opt/cp2k-toolchain/install/setup
echo -e "\n========== Compiling CP2K =========="
cd /workspace/cp2k
echo -n "Compiling cp2k... "
if make -j VERSION=pdbg &> /dev/null ; then
echo "done."
if make -j VERSION=pdbg &> make.out ; then
echo "done."
else
echo -e "failed.\n\n"
echo "Summary: Compilation failed."
echo "Status: FAILED"
exit
echo -e "failed.\n\n"
tail -n 100 make.out
echo -e "\nSummary: Compilation failed."
echo -e "Status: FAILED\n"
exit 0
fi
echo -e "\n========== Installing i-Pi =========="

View file

@ -8,7 +8,16 @@ source /opt/cp2k-toolchain/install/setup
echo -e "\n========== Compiling CP2K =========="
cd /workspace/cp2k
touch src/cp2k_info.F # ensure latest REVISION is picked up.
make -j VERSION="psmp" cp2k
echo -n "Compiling cp2k... "
if make -j VERSION=psmp &> make.out ; then
echo "done."
else
echo -e "failed.\n\n"
tail -n 100 make.out
echo -e "\nSummary: Compilation failed."
echo -e "Status: FAILED\n"
exit 0
fi
echo -e "\n========== Generating Manual =========="

View file

@ -40,7 +40,6 @@ cd /workspace/cp2k
# find executable python scripts
ALL_TEST_SCRIPTS=$(find ./src/ ./tools/ -name "*_test.py" -executable)
ESSENTIAL_TEST_SCRIPTS=$(find ./tools/build_utils -name "*_test.py" -executable)
# python 3.x
run_tests python3 "${ALL_TEST_SCRIPTS}"

View file

@ -14,18 +14,18 @@ VERSION=$2
source /opt/cp2k-toolchain/install/setup
# Make OpenMPI happy.
if which ompi_info &> /dev/null ; then
if command -v ompi_info &> /dev/null ; then
TESTOPTS="-mpiexec 'mpiexec --bind-to none --allow-run-as-root' ${TESTOPTS}"
export OMPI_MCA_plm_rsh_agent=/bin/false
fi
echo -en "\nCompiling cp2k... "
cd /workspace/cp2k
cd /workspace/cp2k || exit 1
if make -j ARCH="${ARCH}" VERSION="${VERSION}" &> make.out ; then
echo "done."
else
echo "failed."
cat make.out
echo -e "failed.\n\n"
tail -n 100 make.out
echo -e "\nSummary: Compilation failed."
echo -e "Status: FAILED\n"
exit 0

View file

@ -8,15 +8,16 @@ source /opt/cp2k-toolchain/install/setup
echo -e '\n========== Compiling CP2K =========='
cd /workspace/cp2k
for VERSION in 'psmp' 'ssmp' ; do
echo -n "Compiling cp2k.${VERSION}... "
if make -j VERSION="${VERSION}" &> /dev/null ; then
echo 'done.'
else
echo -e 'failed.\n\n'
echo 'Summary: Compilation failed.'
echo 'Status: FAILED'
exit
fi
echo -n "Compiling cp2k.${VERSION}... "
if make -j VERSION="${VERSION}" &> make.out ; then
echo "done."
else
echo -e "failed.\n\n"
tail -n 100 make.out
echo -e "\nSummary: Compilation failed."
echo -e "Status: FAILED\n"
exit 0
fi
done
echo -e '\n========== Running Scaling Test =========='