Skip to content

Commit

Permalink
Docker: Fix ASE test (was false positive for a while)
Browse files Browse the repository at this point in the history
  • Loading branch information
oschuett committed Jul 6, 2020
1 parent 3b6ef3b commit 9176043
Showing 1 changed file with 18 additions and 24 deletions.
42 changes: 18 additions & 24 deletions tools/docker/scripts/test_ase.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,48 +17,42 @@ else
fi

echo -e "\n========== Installing CP2K =========="
cat > /usr/bin/cp2k_shell << EndOfMessage
#!/bin/bash -e
source /opt/cp2k-toolchain/install/setup
export OMP_NUM_THREADS=1
mpiexec -np 2 /workspace/cp2k/exe/local/cp2k_shell.pdbg "\$@"
EndOfMessage
chmod +x /usr/bin/cp2k_shell

# The cp2k main binary is used by ase/test/cp2k/cp2k_dcd.py.
# https://gitlab.com/ase/ase/merge_requests/1109
cat > /usr/bin/cp2k << EndOfMessage
#!/bin/bash -e
source /opt/cp2k-toolchain/install/setup
export OMP_NUM_THREADS=1
mpiexec -np 2 /workspace/cp2k/exe/local/cp2k.pdbg "\$@"
EndOfMessage
chmod +x /usr/bin/cp2k

mkdir -p ~/.ase
echo '{"cp2k": "/usr/bin/cp2k_shell"}' > ~/.ase/executables.json

echo -e "\n========== Installing ASE =========="
cd /opt/ase/
git pull
pip3 install .
pip3 install ".[test]"

echo -e "\n========== Running ASE Tests =========="
cd /opt/ase/
export ASE_CP2K_COMMAND="mpiexec -np 2 /workspace/cp2k/exe/local/cp2k_shell.pdbg"

set +e # disable error trapping for remainder of script
(
set -e # abort if error is encountered
for i in ./ase/test/cp2k/cp2k_*.py
do
echo "Running $i ..."
python3 "$i" |& tee "/tmp/test_ase.out"
if grep "Exception ignored" "/tmp/test_ase.out" ; then
exit 1 # Found unraisable exception, e.g. in __del__.
fi
done
)

EXIT_CODE=$?

echo ""

ASE_REVISION=$(git rev-parse --short HEAD)
if (( EXIT_CODE )); then
echo "Summary: Something is wrong with ASE commit ${ASE_REVISION}."
echo "Status: FAILED"
else

if ase test -j 0 -c cp2k 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"
fi

#EOF

0 comments on commit 9176043

Please sign in to comment.