Format all shell scripts

This commit is contained in:
Ole Schütt 2021-02-17 17:02:43 +01:00 committed by Ole Schütt
parent 2e2218d9a9
commit d59a3ad777
78 changed files with 4489 additions and 4475 deletions

View file

@ -3,63 +3,63 @@
# author: Ole Schuett
set -eo pipefail
ulimit -c 0 # Disable core dumps as they can take a very long time to write.
ulimit -c 0 # Disable core dumps as they can take a very long time to write.
# Calculate checksums of critical files.
CHECKSUMS=/workspace/checksums.md5
shopt -s nullglob # ignore missing files
shopt -s nullglob # ignore missing files
md5sum /workspace/cp2k/Makefile \
/workspace/cp2k/tools/build_utils/* \
/workspace/cp2k/arch/local* \
> $CHECKSUMS
/workspace/cp2k/tools/build_utils/* \
/workspace/cp2k/arch/local* \
> $CHECKSUMS
shopt -u nullglob
# Get cp2k sources.
if [ -n "${GIT_REF}" ]; then
echo -e "\n========== Fetching Git Commit =========="
cd /workspace/cp2k
git fetch --quiet origin "${GIT_BRANCH}"
git reset --quiet --hard "${GIT_REF}"
git submodule update --init --recursive
git --no-pager log -1 --pretty='%nCommitSHA: %H%nCommitTime: %ci%nCommitAuthor: %an%nCommitSubject: %s%n'
echo -e "\n========== Fetching Git Commit =========="
cd /workspace/cp2k
git fetch --quiet origin "${GIT_BRANCH}"
git reset --quiet --hard "${GIT_REF}"
git submodule update --init --recursive
git --no-pager log -1 --pretty='%nCommitSHA: %H%nCommitTime: %ci%nCommitAuthor: %an%nCommitSubject: %s%n'
elif [ -d /mnt/cp2k ]; then
echo -e "\n========== Copying Changed Files =========="
# We can't rely on timestamps as they depend on the git checkout time.
# Hence, we use checksums despite the IO because a full rebuild would be even more costly.
rsync --checksum \
--delete \
--executability \
--verbose \
--recursive \
--exclude="*~" \
--exclude=".*/" \
--exclude="*.py[cod]" \
--exclude="__pycache__" \
--exclude="/obj/" \
--exclude="/lib/" \
--exclude="/exe/" \
--exclude="/regtesting/" \
--exclude="/arch/local*" \
--exclude="/tools/toolchain/build/" \
--exclude="/tools/toolchain/install/" \
/mnt/cp2k/ /workspace/cp2k/
elif [ -d /mnt/cp2k ]; then
echo -e "\n========== Copying Changed Files =========="
# We can't rely on timestamps as they depend on the git checkout time.
# Hence, we use checksums despite the IO because a full rebuild would be even more costly.
rsync --checksum \
--delete \
--executability \
--verbose \
--recursive \
--exclude="*~" \
--exclude=".*/" \
--exclude="*.py[cod]" \
--exclude="__pycache__" \
--exclude="/obj/" \
--exclude="/lib/" \
--exclude="/exe/" \
--exclude="/regtesting/" \
--exclude="/arch/local*" \
--exclude="/tools/toolchain/build/" \
--exclude="/tools/toolchain/install/" \
/mnt/cp2k/ /workspace/cp2k/
else
echo "Neither GIT_REF nor /mnt/cp2k found - aborting."
exit 255
echo "Neither GIT_REF nor /mnt/cp2k found - aborting."
exit 255
fi
if ! md5sum --status --check ${CHECKSUMS}; then
echo -e "\n========== Cleaning Build Cache =========="
cd /workspace/cp2k
make distclean
echo -e "\n========== Cleaning Build Cache =========="
cd /workspace/cp2k
make distclean
fi
# Run actual test.
echo -e "\n========== Running Test =========="
cd /workspace
if ! "$@" ; then
echo -e "\nSummary: Test had non-zero exit status.\nStatus: FAILED"
if ! "$@"; then
echo -e "\nSummary: Test had non-zero exit status.\nStatus: FAILED"
fi
#EOF

View file

@ -7,14 +7,14 @@ 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 \
python3-dev \
postgresql \
rabbitmq-server \
sudo \
ssh
python3-setuptools \
python3-wheel \
python3-pip \
python3-dev \
postgresql \
rabbitmq-server \
sudo \
ssh
rm -rf /var/lib/apt/lists/*
# install dependencies of aiida-cp2k
@ -25,14 +25,14 @@ pip3 uninstall --quiet --yes aiida-cp2k
# create ubuntu user with sudo powers
adduser --disabled-password --gecos "" ubuntu
echo "ubuntu ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
echo "ubuntu ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
# shellcheck disable=SC1091
source /opt/cp2k-toolchain/install/setup
# link mpi executables into path
MPI_INSTALL_DIR=$(dirname "$(command -v mpirun)")
for i in "${MPI_INSTALL_DIR}"/* ; do ln -sf "$i" /usr/bin/; done
for i in "${MPI_INSTALL_DIR}"/*; do ln -sf "$i" /usr/bin/; done
# setup arch files
cd /workspace/cp2k/arch
@ -41,10 +41,10 @@ ln -vs /opt/cp2k-toolchain/install/arch/local* .
# pre-build cp2k
cd /workspace/cp2k
echo -n "Warming cache by trying to compile... "
if make -j VERSION=pdbg &> /dev/null ; then
echo "done."
if make -j VERSION=pdbg &> /dev/null; then
echo "done."
else
echo "failed."
echo "failed."
fi
rm -rf lib exe

View file

@ -5,12 +5,12 @@
# install python packages
apt-get update -qq
apt-get install -qq --no-install-recommends \
python3 \
python3-dev \
python3-pip \
python3-wheel \
python3-setuptools \
build-essential
python3 \
python3-dev \
python3-pip \
python3-wheel \
python3-setuptools \
build-essential
rm -rf /var/lib/apt/lists/*
# install python packages
@ -29,10 +29,10 @@ ln -vs /opt/cp2k-toolchain/install/arch/local* .
# pre-build cp2k
cd /workspace/cp2k
echo -n "Warming cache by trying to compile... "
if make -j VERSION=pdbg &> /dev/null ; then
echo "done."
if make -j VERSION=pdbg &> /dev/null; then
echo "done."
else
echo "failed."
echo "failed."
fi
rm -rf lib exe

View file

@ -2,36 +2,36 @@
# author: Ole Schuett
if grep -q -e "Ubuntu" -e "Debian" /etc/os-release ; then
echo -n "Installing Ubuntu packages... "
apt-get update -qq
apt-get install -qq --no-install-recommends \
ca-certificates \
git \
less \
nano \
python3 \
rsync \
wget
rm -rf /var/lib/apt/lists/*
echo "done."
if grep -q -e "Ubuntu" -e "Debian" /etc/os-release; then
echo -n "Installing Ubuntu packages... "
apt-get update -qq
apt-get install -qq --no-install-recommends \
ca-certificates \
git \
less \
nano \
python3 \
rsync \
wget
rm -rf /var/lib/apt/lists/*
echo "done."
elif grep -q "Fedora" /etc/os-release ; then
echo -n "Installing Fedora packages... "
dnf -qy install \
ca-certificates \
git \
less \
nano \
python3 \
rsync \
wget
dnf -q clean all
echo "done."
elif grep -q "Fedora" /etc/os-release; then
echo -n "Installing Fedora packages... "
dnf -qy install \
ca-certificates \
git \
less \
nano \
python3 \
rsync \
wget
dnf -q clean all
echo "done."
else
echo "Unknown Linux distribution."
exit 1
echo "Unknown Linux distribution."
exit 1
fi

View file

@ -12,10 +12,10 @@ ln -vs /opt/cp2k-toolchain/install/arch/local* .
# pre-build cp2k
cd /workspace/cp2k/tools/conventions
echo -n "Warming cache by trying to run test_conventions.sh... "
if ./test_conventions.sh &> /dev/null ; then
echo "done."
if ./test_conventions.sh &> /dev/null; then
echo "done."
else
echo "failed."
echo "failed."
fi
rm -rf ../lib/ ../exe/

View file

@ -8,8 +8,8 @@ lcov_sha256="c1cda2fa33bec9aa2c2c73c87226cfe97de0831887176b45ee523c5e30f8053a"
# LCOV dependencies
apt-get update -qq
apt-get install -qq --no-install-recommends \
libperlio-gzip-perl \
libjson-perl
libperlio-gzip-perl \
libjson-perl
rm -rf /var/lib/apt/lists/*
cd /tmp

View file

@ -5,13 +5,13 @@
# install Ubuntu packages
apt-get update -qq
apt-get install -qq --no-install-recommends \
libfindbin-libs-perl \
build-essential \
make \
perl \
python3-{pip,setuptools,wheel,dev} \
nodejs \
clang-format
libfindbin-libs-perl \
build-essential \
make \
perl \
python3-{pip,setuptools,wheel,dev} \
nodejs \
clang-format
rm -rf /var/lib/apt/lists/*

View file

@ -5,10 +5,10 @@
# install Ubuntu packages
apt-get update -qq
apt-get install -qq --no-install-recommends \
python3 \
python3-pip \
python3-wheel \
python3-setuptools
python3 \
python3-pip \
python3-wheel \
python3-setuptools
rm -rf /var/lib/apt/lists/*
# install python packages
@ -27,10 +27,10 @@ ln -vs /opt/cp2k-toolchain/install/arch/local* .
# pre-build cp2k
cd /workspace/cp2k
echo -n "Warming cache by trying to compile... "
if make -j VERSION=pdbg &> /dev/null ; then
echo "done."
if make -j VERSION=pdbg &> /dev/null; then
echo "done."
else
echo "failed."
echo "failed."
fi
rm -rf lib exe

View file

@ -4,9 +4,9 @@
# install Ubuntu packages
apt-get update -qq
apt-get install -qq --no-install-recommends \
default-jre-headless \
libsaxonhe-java
apt-get install -qq --no-install-recommends \
default-jre-headless \
libsaxonhe-java
rm -rf /var/lib/apt/lists/*
# shellcheck disable=SC1091
@ -19,10 +19,10 @@ ln -vs /opt/cp2k-toolchain/install/arch/local* .
# pre-build cp2k
cd /workspace/cp2k
echo -n "Warming cache by trying to compile... "
if make -j VERSION=psmp &> /dev/null ; then
echo "done."
if make -j VERSION=psmp &> /dev/null; then
echo "done."
else
echo "failed."
echo "failed."
fi
rm -rf lib exe

View file

@ -5,13 +5,13 @@
# install Ubuntu packages
apt-get update -qq
apt-get install -qq --no-install-recommends \
libpython3-stdlib \
python3 \
python3-pip \
python3-wheel \
python3-setuptools \
python3-dev \
build-essential
libpython3-stdlib \
python3 \
python3-pip \
python3-wheel \
python3-setuptools \
python3-dev \
build-essential
rm -rf /var/lib/apt/lists/*
# install python packages

View file

@ -2,9 +2,9 @@
# author: Ole Schuett
if (( $# != 2 )) ; then
echo "Usage: install_regtest.sh <ARCH> <VERSION>"
exit 1
if (($# != 2)); then
echo "Usage: install_regtest.sh <ARCH> <VERSION>"
exit 1
fi
ARCH=$1
@ -18,18 +18,18 @@ ln -vs /opt/cp2k-toolchain/install/arch/local* .
source /opt/cp2k-toolchain/install/setup
# Make OpenMPI happy.
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
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 || exit 1
echo -n "Warming cache by trying to compile... "
if make -j ARCH="${ARCH}" VERSION="${VERSION}" &> /dev/null ; then
echo "done."
if make -j ARCH="${ARCH}" VERSION="${VERSION}" &> /dev/null; then
echo "done."
else
echo "failed."
echo "failed."
fi
# remove binaries to reduce image size

View file

@ -17,12 +17,12 @@ source /opt/cp2k-toolchain/install/setup
# pre-build cp2k
cd /workspace/cp2k
for VERSION in 'psmp' 'ssmp'; do
echo -n "Warming cache by trying to compile cp2k.${VERSION}... "
if make -j VERSION="${VERSION}" &> /dev/null ; then
echo 'done.'
else
echo 'failed.'
fi
echo -n "Warming cache by trying to compile cp2k.${VERSION}... "
if make -j VERSION="${VERSION}" &> /dev/null; then
echo 'done.'
else
echo 'failed.'
fi
done
rm -rf lib exe

View file

@ -8,14 +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 &> make.out ; then
echo "done."
if make -j VERSION=pdbg &> 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
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 =========="
@ -44,13 +44,13 @@ EndOfMessage
chmod +x /usr/bin/cp2k
echo -e "\n========== Running AiiDA-CP2K Tests =========="
cd /opt/aiida-cp2k/
cd /opt/aiida-cp2k/
set +e # disable error trapping for remainder of script
(
set -e # abort on error
ulimit -t 1800 # abort after 30 minutes
$AS_UBUNTU_USER py.test
set -e # abort on error
ulimit -t 1800 # abort after 30 minutes
$AS_UBUNTU_USER py.test
)
EXIT_CODE=$?
@ -58,12 +58,12 @@ EXIT_CODE=$?
echo ""
AIIDA_COMMIT=$(git rev-parse --short HEAD)
if (( EXIT_CODE )); then
echo "Summary: Something is wrong with aiida-cp2k commit ${AIIDA_COMMIT}."
echo "Status: FAILED"
if ((EXIT_CODE)); then
echo "Summary: Something is wrong with aiida-cp2k commit ${AIIDA_COMMIT}."
echo "Status: FAILED"
else
echo "Summary: aiida-cp2k commit ${AIIDA_COMMIT} works fine."
echo "Status: OK"
echo "Summary: aiida-cp2k commit ${AIIDA_COMMIT} works fine."
echo "Status: OK"
fi
#EOF

View file

@ -7,14 +7,14 @@ source /opt/cp2k-toolchain/install/setup
cd /workspace/cp2k
echo -n "Compiling cp2k... "
if make -j VERSION=pdbg &> make.out ; then
echo "done."
if make -j VERSION=pdbg &> 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
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 =========="
@ -48,12 +48,12 @@ echo -e "\n========== Running ASE Tests =========="
cd /opt/ase/
ASE_REVISION=$(git rev-parse --short HEAD)
if ase test -j 0 -c cp2k calculator/cp2k ; then
echo "Summary: ASE commit ${ASE_REVISION} works fine."
echo "Status: OK"
if ase test -j 0 -c cp2k calculator/cp2k; then
echo "Summary: ASE commit ${ASE_REVISION} works fine."
echo "Status: OK"
else
echo "Summary: Something is wrong with ASE commit ${ASE_REVISION}."
echo "Status: FAILED"
echo "Summary: Something is wrong with ASE commit ${ASE_REVISION}."
echo "Status: FAILED"
fi
#EOF

View file

@ -7,6 +7,6 @@ source /opt/cp2k-toolchain/install/setup
echo -e "\n========== Running Conventions Test =========="
cd /workspace/cp2k/tools/conventions
./test_conventions.sh #TODO port to Python3
./test_conventions.sh #TODO port to Python3
#EOF

View file

@ -2,9 +2,9 @@
# author: Ole Schuett
if (( $# != 1 )) ; then
echo "Usage: test_coverage.sh <VERSION>"
exit 1
if (($# != 1)); then
echo "Usage: test_coverage.sh <VERSION>"
exit 1
fi
ARCH=local_coverage
@ -16,7 +16,7 @@ source /opt/cp2k-toolchain/install/setup
echo -e "\n========== Running Regtests =========="
cd /workspace/cp2k || exit 1
CP2K_REVISION=$(./tools/build_utils/get_revision_number ./src)
rm -rf "obj/${ARCH}/${VERSION}"/*.gcda # remove old gcov statistics
rm -rf "obj/${ARCH}/${VERSION}"/*.gcda # remove old gcov statistics
make ARCH="${ARCH}" VERSION="${VERSION}" TESTOPTS="${TESTOPTS}" test
@ -26,11 +26,11 @@ make ARCH="${ARCH}" VERSION="${VERSION}" TESTOPTS="${TESTOPTS}" test
rm -f "/workspace/cp2k/obj/${ARCH}/${VERSION}"/exts/*/*.gcda
cd /tmp || exit 1
GCOV_TIMEOUT="10s"
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}"
fi
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}"
fi
done
# collect coverage stats

View file

@ -4,12 +4,12 @@
echo -e "\n========== Generating Doxygen =========="
cd /workspace/cp2k
if ! make doxygen &> make.out ; then
echo -e "failed.\n\n"
tail -n 100 make.out
echo -e "\nSummary: Doxygen generation failed."
echo -e "Status: FAILED\n"
exit 0
if ! make doxygen &> make.out; then
echo -e "failed.\n\n"
tail -n 100 make.out
echo -e "\nSummary: Doxygen generation failed."
echo -e "Status: FAILED\n"
exit 0
fi
mkdir -p /workspace/artifacts

View file

@ -8,14 +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 &> make.out ; then
echo "done."
if make -j VERSION=pdbg &> 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
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 =========="
@ -25,11 +25,11 @@ pip3 install --quiet .
echo -e "\n========== Running i-Pi Tests =========="
cd /opt/i-pi/examples/cp2k/nvt-cl
cd /opt/i-pi/examples/cp2k/nvt-cl
set +e # disable error trapping for remainder of script
TIMEOUT_SEC="300"
ulimit -t ${TIMEOUT_SEC} # Limit cpu time.
ulimit -t ${TIMEOUT_SEC} # Limit cpu time.
# launch cp2k
(
@ -56,12 +56,12 @@ echo "CP2K exit code: ${CP2K_EXIT_CODE}"
echo "i-Pi exit code: ${IPI_EXIT_CODE}"
IPI_REVISION=$(git rev-parse --short HEAD)
if (( IPI_EXIT_CODE )) || (( CP2K_EXIT_CODE )) ; then
echo "Summary: Something is wrong with i-Pi commit ${IPI_REVISION}."
echo "Status: FAILED"
if ((IPI_EXIT_CODE)) || ((CP2K_EXIT_CODE)); then
echo "Summary: Something is wrong with i-Pi commit ${IPI_REVISION}."
echo "Status: FAILED"
else
echo "Summary: i-Pi commit ${IPI_REVISION} works fine."
echo "Status: OK"
echo "Summary: i-Pi commit ${IPI_REVISION} works fine."
echo "Status: OK"
fi
#EOF

View file

@ -7,16 +7,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.
touch src/cp2k_info.F # ensure latest REVISION is picked up.
echo -n "Compiling cp2k... "
if make -j VERSION=psmp &> make.out ; then
echo "done."
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
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 =========="
@ -33,21 +33,21 @@ cp ${TOOLS}/manual/toggle_folding.js .
set +e # disable error trapping for remainder of script
(
set -e # abort if error is encountered
sed -i 's/\x0/?/g' cp2k_input.xml # replace null bytes which would crash saxon
SAXON="java -jar /usr/share/java/Saxon-HE.jar"
$SAXON -o:index.html ./cp2k_input.xml ${TOOLS}/manual/cp2k_input.xsl add_edit_links=yes
$SAXON -o:cp2k.vim ./cp2k_input.xml ${TOOLS}/input_editing/vim/vim.xsl
set -e # abort if error is encountered
sed -i 's/\x0/?/g' cp2k_input.xml # replace null bytes which would crash saxon
SAXON="java -jar /usr/share/java/Saxon-HE.jar"
$SAXON -o:index.html ./cp2k_input.xml ${TOOLS}/manual/cp2k_input.xsl add_edit_links=yes
$SAXON -o:cp2k.vim ./cp2k_input.xml ${TOOLS}/input_editing/vim/vim.xsl
)
EXIT_CODE=$?
echo ""
if (( EXIT_CODE )); then
echo "Summary: Something is wrong."
echo "Status: FAILED"
if ((EXIT_CODE)); then
echo "Summary: Something is wrong."
echo "Status: FAILED"
else
echo "Summary: Manual generation works fine."
echo "Status: OK"
echo "Summary: Manual generation works fine."
echo "Status: OK"
fi
#EOF

View file

@ -3,34 +3,34 @@
# author: Ole Schuett
function run_tests {
PYTHON=$1
SCRIPTS=$2
BASEDIR=$(pwd)
VERSION=$(${PYTHON} -V 2>&1 | tr -d '\n')
echo ""
echo "========== Running ${VERSION} Tests =========="
#find ./src/ ./tools/ -name "*.pyc" -exec rm {} \;
for i in $SCRIPTS ; do
set +e #disable error trapping
echo "Running $i"
cd "$(dirname "$i")"
SCRIPT=$(basename "$i")
if ! $PYTHON -B "./${SCRIPT}" ; then
echo "Test $i failed"
ERRORS=$((ERRORS+1))
fi
set -e #re-enable error trapping
cd "$BASEDIR"
done
PYTHON=$1
SCRIPTS=$2
BASEDIR=$(pwd)
VERSION=$(${PYTHON} -V 2>&1 | tr -d '\n')
echo ""
echo "========== Running ${VERSION} Tests =========="
#find ./src/ ./tools/ -name "*.pyc" -exec rm {} \;
for i in $SCRIPTS; do
set +e #disable error trapping
echo "Running $i"
cd "$(dirname "$i")"
SCRIPT=$(basename "$i")
if ! $PYTHON -B "./${SCRIPT}"; then
echo "Test $i failed"
ERRORS=$((ERRORS + 1))
fi
set -e #re-enable error trapping
cd "$BASEDIR"
done
}
function run_pre_commit {
set +e #disable error trapping
if ! pre-commit run --all-files --hook-stage manual check-ast ; then
echo "Syntax check failed."
ERRORS=$((ERRORS+1))
fi
set -e #re-enable error trapping
set +e #disable error trapping
if ! pre-commit run --all-files --hook-stage manual check-ast; then
echo "Syntax check failed."
ERRORS=$((ERRORS + 1))
fi
set -e #re-enable error trapping
}
#===============================================================================
@ -39,7 +39,7 @@ ERRORS=0
cd /workspace/cp2k
# find executable python scripts
ALL_TEST_SCRIPTS=$(find ./src/ ./tools/ -name "*_test.py" -executable)
ALL_TEST_SCRIPTS=$(find ./src/ ./tools/ -name "*_test.py" -executable)
# python 3.x
run_tests python3 "${ALL_TEST_SCRIPTS}"
@ -48,11 +48,11 @@ run_tests python3 "${ALL_TEST_SCRIPTS}"
run_pre_commit
# print report
NUM_TEST_SCRIPTS=$(( $(wc -w <<< "${ALL_TEST_SCRIPTS}") + 1 ))
NUM_TEST_SCRIPTS=$(($(wc -w <<< "${ALL_TEST_SCRIPTS}") + 1))
echo ""
echo "Summary: Run ${NUM_TEST_SCRIPTS} Python test scripts, found ${ERRORS} errors."
if [ $ERRORS == 0 ]; then
echo "Status: OK"
echo "Status: OK"
else
echo "Status: FAILED"
echo "Status: FAILED"
fi

View file

@ -2,9 +2,9 @@
# author: Ole Schuett
if (( $# != 2 )) ; then
echo "Usage: test_regtest.sh <ARCH> <VERSION>"
exit 1
if (($# != 2)); then
echo "Usage: test_regtest.sh <ARCH> <VERSION>"
exit 1
fi
ARCH=$1
@ -14,43 +14,43 @@ VERSION=$2
source /opt/cp2k-toolchain/install/setup
# Make OpenMPI happy.
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
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
# Switch to stable DBCSR version if requested.
if [ -n "${USE_STABLE_DBCSR}" ] ; then
echo "Switching to stable DBCSR version..."
if ! git -C cp2k/exts/dbcsr checkout v2.1.0-rc16 ; then
echo -e "\nSummary: Could not checkout stable DBCSR version."
echo -e "Status: FAILED\n"
exit 0
fi
ln -fs python3 /usr/bin/python # DBCSR v2.1.0-rc16 needs the python binary.
if [ -n "${USE_STABLE_DBCSR}" ]; then
echo "Switching to stable DBCSR version..."
if ! git -C cp2k/exts/dbcsr checkout v2.1.0-rc16; then
echo -e "\nSummary: Could not checkout stable DBCSR version."
echo -e "Status: FAILED\n"
exit 0
fi
ln -fs python3 /usr/bin/python # DBCSR v2.1.0-rc16 needs the python binary.
fi
# Compile cp2k.
echo -en "\nCompiling cp2k... "
cd /workspace/cp2k || exit 1
if make -j ARCH="${ARCH}" VERSION="${VERSION}" &> make.out ; then
echo "done."
if make -j ARCH="${ARCH}" 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
echo -e "failed.\n\n"
tail -n 100 make.out
echo -e "\nSummary: Compilation failed."
echo -e "Status: FAILED\n"
exit 0
fi
# Check benchmark files for input errors.
if [[ "${ARCH}" == "local" ]] ; then
echo -en "\nChecking benchmarks... "
if ! ./tools/regtesting/check_inputs.py "./exe/${ARCH}/cp2k.${VERSION}" "./benchmarks/" ; then
echo -e "\nSummary: Some benchmark inputs could not be parsed."
echo -e "Status: FAILED\n"
exit 0
fi
if [[ "${ARCH}" == "local" ]]; then
echo -en "\nChecking benchmarks... "
if ! ./tools/regtesting/check_inputs.py "./exe/${ARCH}/cp2k.${VERSION}" "./benchmarks/"; then
echo -e "\nSummary: Some benchmark inputs could not be parsed."
echo -e "Status: FAILED\n"
exit 0
fi
fi
# Run regtests.

View file

@ -7,17 +7,17 @@ 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}" &> 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
for VERSION in 'psmp' 'ssmp'; do
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 =========='