Docker: Major refactoring (#87)

This commit is contained in:
Ole Schütt 2018-11-08 13:56:15 +01:00 committed by GitHub
parent 30e41bb77a
commit 4a97bb7342
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
77 changed files with 1031 additions and 1051 deletions

View file

@ -0,0 +1,60 @@
#!/bin/bash -e
# author: Ole Schuett
function run_selftests {
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
if [[ $(head -n1 "$i") =~ "python3" && "$PYTHON" != "python3" ]]; then
echo "Skipping $i - it's Python3 only."
continue
fi
echo "Selftesting $i"
cd "$(dirname "$i")"
SCRIPT=$(basename "$i")
if ! $PYTHON -B "./${SCRIPT}" --selftest ; then
echo "Selftest of $i failed"
ERRORS=$((ERRORS+1))
fi
set -e #re-enable error trapping
cd "$BASEDIR"
done
}
#===============================================================================
ERRORS=0
cd /workspace/cp2k
# find executable python scripts
ALL_SCRIPTS=$(find ./src/ ./tools/ -name "*.py" -executable)
ESSENTIAL_SCRIPTS=$(find ./tools/build_utils -name "*.py" -executable)
ESSENTIAL_SCRIPTS="$ESSENTIAL_SCRIPTS ./src/dbcsr/libsmm_acc/libcusmm/generate.py"
# python 2.6
run_selftests python2.6 "${ESSENTIAL_SCRIPTS}"
# python 2.7
run_selftests python2.7 "${ALL_SCRIPTS}"
# python 3.x
run_selftests python3 "${ALL_SCRIPTS}"
# print report
NUM_SCRIPTS=$(echo "${ALL_SCRIPTS}" | wc -w)
echo ""
echo "Summary: Checked ${NUM_SCRIPTS} Python scripts, found ${ERRORS} errors."
if [ $ERRORS == 0 ]; then
echo "Status: OK"
else
echo "Status: FAILED"
fi
#EOF