Fix remaining shellcheck errors

This commit is contained in:
Ole Schütt 2021-03-10 13:24:42 +01:00 committed by Ole Schütt
parent 1f7f0365bf
commit 16d1cb426a
7 changed files with 29 additions and 75 deletions

View file

@ -4,7 +4,7 @@ rm -rf autom4te.cache
rm -f aclocal.m4 ltmain.sh
echo "Running aclocal..."
aclocal $ACLOCAL_FLAGS -I m4 || exit 1
aclocal "$ACLOCAL_FLAGS" -I m4 || exit 1
echo "Running autoheader..."
autoheader || exit 1
echo "Running autoconf..."

View file

@ -17,20 +17,20 @@ date --utc --rfc-3339=seconds
)
MAKE_EXIT_CODE=$?
if (($MAKE_EXIT_CODE)); then
if ((MAKE_EXIT_CODE)); then
cd ../../obj/local_warn/psmp/
echo ""
grep -B 2 Error *.warn
grep -B 2 Error ./*.warn
echo ""
echo "Summary: Compilation failed."
echo "Status: FAILED"
else
rm -f *.issues
rm -f ./*.issues
set -o errexit
./analyze_gfortran_ast.py ../../obj/Linux-x86-64-gfortran/dumpast/*.ast > ast.issues
./analyze_gfortran_warnings.py ../../obj/local_warn/psmp/*.warn > warn.issues
./analyze_src.py -b ../../ > src.issues
./summarize_issues.py --suppressions=conventions.supp *.issues
./summarize_issues.py --suppressions=conventions.supp ./*.issues
fi

View file

@ -2,9 +2,8 @@
set -eo pipefail
ARGS=${ARGS:-} # Set to "-v" for debugging
SCRIPTDIR=$(
cd $(dirname "$0")
cd "$(dirname "$0")"
pwd
) # Pick up full path to scripts from wherever doxify.sh lives
@ -20,8 +19,8 @@ for file in "$@"; do
# definitions that don't have any and checks that existing comments are complete,
# fixing these if required.
# * After adding comments, remove any double comment header lines
"${SCRIPTDIR}/fixcomments.pl" ${ARGS} "${file}" |
"${SCRIPTDIR}/remove_extra_comments.pl" ${ARGS} > "${tmp_file}"
"${SCRIPTDIR}/fixcomments.pl" "${file}" |
"${SCRIPTDIR}/remove_extra_comments.pl" > "${tmp_file}"
# Copy the final modified source file on top of the original file
if ! cmp -s "${file}" "${tmp_file}"; then

View file

@ -4,16 +4,16 @@
DOXYGENDIR="./doxygen"
for SRC_FN in $(find ./src/ -type f); do
while IFS= read -r -d '' SRC_FN; do
echo "Preprocessing ${SRC_FN}"
DEST_FN="${DOXYGENDIR}/${SRC_FN}"
mkdir -p $(dirname "${DEST_FN}")
mkdir -p "$(dirname "${DEST_FN}")"
if [[ "${SRC_FN}" == *.F ]]; then
./tools/build_utils/fypp "${SRC_FN}" "${DEST_FN}" &> /dev/null
else
cp "${SRC_FN}" "${DEST_FN}"
fi
done
done < <(find ./src/ -type f -print0)
cp tools/logo/cp2k_logo_100.png ${DOXYGENDIR}/cp2k_logo.png
@ -26,6 +26,6 @@ doxygen ./Doxyfile
# Remove CP2K from header bars because we already have the logo.
cd html
sed -i 's/"projectname">CP2K/"projectname">/' *.html ./*/*.html ./*/*/*.html
sed -i 's/"projectname">CP2K/"projectname">/' ./*.html ./*/*.html ./*/*/*.html
#EOF

View file

@ -1,45 +0,0 @@
#!/bin/bash
# Test if prettify was run
# author: Ole Schuett
set -e
rm -rf preprettify
find ./src/ -type f -not -path "*/preprettify/*" -not -path "*/.git/*" -print0 | xargs -0 md5sum > checksums.md5
md5sum ./data/POTENTIAL >> checksums.md5
make -j 16 pretty
make -j 16 pretty # run twice to ensure consistency with doxify
cd data
cat GTH_POTENTIALS HF_POTENTIALS NLCC_POTENTIALS ALL_POTENTIALS > POTENTIAL
cd ..
nfiles=$(wc -l checksums.md5 | cut -f 1 -d " ")
summary="Checked $nfiles files."
status="OK"
echo "Searching for doxify warnings ..."
if grep -r -e "UNMATCHED_PROCEDURE_ARGUMENT" \
-e "UNKNOWN_DOXYGEN_COMMENT" \
-e "UNKNOWN_COMMENT" \
--exclude-dir=".git" \
--exclude-dir="preprettify" \
./src/*; then
summary="Found doxify warnings"
status="FAILED"
fi
echo "Comparing MD5-sums ..."
if ! md5sum --quiet --check checksums.md5; then
summary='Code not invariant under "make pretty"'
status="FAILED"
fi
rm checksums.md5
echo "Summary:" $summary
echo "Status:" $status
#EOF

View file

@ -34,7 +34,7 @@ if [ "" != "${HOME}" ]; then
CONFIGFILE=${HOME}/.xconfigure-cp2k-plan
else
HERE=$(
cd $(dirname $0)
cd "$(dirname "$0")" || exit
pwd -P
)
CONFIGFILE=${HERE}/.xconfigure-cp2k-plan
@ -80,8 +80,8 @@ if [ "" != "${GREP}" ] && [ "" != "${SORT}" ] && [ "" != "${HEAD}" ] &&
fi
OUTPUT=0
if [ "" = "$1" ]; then
if [ -e ${CONFIGFILE} ]; then # remind configuration
NCORESPERNODE=$(${CUT} -d" " -f1 ${CONFIGFILE})
if [ -e "${CONFIGFILE}" ]; then # remind configuration
NCORESPERNODE=$(${CUT} -d" " -f1 "${CONFIGFILE}")
elif [ "" != "${NC}" ]; then
NCORESPERNODE=${NC}
fi
@ -91,8 +91,8 @@ if [ "" != "${GREP}" ] && [ "" != "${SORT}" ] && [ "" != "${HEAD}" ] &&
shift
fi
if [ "" = "$1" ]; then
if [ -e ${CONFIGFILE} ]; then # remind configuration
NTHREADSPERCORE=$(${CUT} -d" " -f2 ${CONFIGFILE})
if [ -e "${CONFIGFILE}" ]; then # remind configuration
NTHREADSPERCORE=$(${CUT} -d" " -f2 "${CONFIGFILE}")
elif [ "" != "${HT}" ]; then
NTHREADSPERCORE=${HT}
fi
@ -102,8 +102,8 @@ if [ "" != "${GREP}" ] && [ "" != "${SORT}" ] && [ "" != "${HEAD}" ] &&
shift
fi
if [ "" = "$1" ]; then
if [ -e ${CONFIGFILE} ]; then # remind configuration
NPROCSPERNODE=$(${CUT} -d" " -f3 ${CONFIGFILE})
if [ -e "${CONFIGFILE}" ]; then # remind configuration
NPROCSPERNODE=$(${CUT} -d" " -f3 "${CONFIGFILE}")
elif [ "" != "${NS}" ]; then
NPROCSPERNODE=${NS}
fi
@ -128,7 +128,7 @@ if [ "" != "${GREP}" ] && [ "" != "${SORT}" ] && [ "" != "${HEAD}" ] &&
MIN_NRANKS=$((PENALTY_MIN * NPROCSPERNODE))
# remember system configuration
if [ "0" != "${OUTPUT}" ]; then
echo "${NCORESPERNODE} ${NTHREADSPERCORE} ${NPROCSPERNODE}" > ${CONFIGFILE} 2> /dev/null
echo "${NCORESPERNODE} ${NTHREADSPERCORE} ${NPROCSPERNODE}" > "${CONFIGFILE}" 2> /dev/null
fi
NCORESTOTAL=$((TOTALNUMNODES * NCORESPERNODE))
NCORESOCKET=$((NCORESPERNODE / NPROCSPERNODE))
@ -138,7 +138,7 @@ if [ "" != "${GREP}" ] && [ "" != "${SORT}" ] && [ "" != "${HEAD}" ] &&
NRANKSMIN=$((TOTALNUMNODES * NPROCSPERNODE))
NSQRT_MIN=$(isqrt ${NRANKSMIN})
NSQRT_MAX=$(isqrt ${NCORESTOTAL})
for NSQRT in $(${SEQ} ${NSQRT_MIN} ${NSQRT_MAX}); do
for NSQRT in $(${SEQ} "${NSQRT_MIN}" "${NSQRT_MAX}"); do
NSQR=$((NSQRT * NSQRT))
NRANKSPERNODE=$((NSQR / TOTALNUMNODES))
if [ "${NSQR}" = "$((TOTALNUMNODES * NRANKSPERNODE))" ]; then
@ -191,8 +191,8 @@ if [ "" != "${GREP}" ] && [ "" != "${SORT}" ] && [ "" != "${HEAD}" ] &&
NRANKSPERNODE=$(echo "${RESULT}" | ${CUT} -d";" -f1)
NTHREADSPERRANK=$((NTHREADSPERNODE / NRANKSPERNODE))
PENALTY=$(echo "${RESULT}" | ${CUT} -d";" -f2)
if [ "0" != "$((OUTPUT_SQR < OUTPUT_POT))" ] ||
[ "0" != "$((PENALTY <= PENALTY_TOP))" ]; then
if [ "$((OUTPUT_SQR < OUTPUT_POT))" != "0" ] ||
[ "$((PENALTY <= PENALTY_TOP))" != "0" ]; then
NSQRT=$(echo "${RESULT}" | ${CUT} -d";" -f3)
echo "[${NRANKSPERNODE}x${NTHREADSPERRANK}]: ${NRANKSPERNODE} ranks per node with ${NTHREADSPERRANK} thread(s) per rank (${PENALTY}% penalty) -> ${NSQRT}x${NSQRT}"
OUTPUT_SQR=$((OUTPUT_SQR + 1))
@ -201,7 +201,7 @@ if [ "" != "${GREP}" ] && [ "" != "${SORT}" ] && [ "" != "${HEAD}" ] &&
if [ "0" != "${OUTPUT_SQR}" ]; then
echo "--------------------------------------------------------------------------------"
fi
for NRANKSPERNODE in $(${SEQ} ${MIN_NRANKS} ${NCORESPERNODE}); do
for NRANKSPERNODE in $(${SEQ} "${MIN_NRANKS}" "${NCORESPERNODE}"); do
REST=$((NCORESPERNODE % NRANKSPERNODE))
PENALTY=$(((100 * REST + NCORESPERNODE - 1) / NCORESPERNODE))
# criterion to add penalty in case of unbalanced load

10
tools/precommit/deploy.sh Executable file → Normal file
View file

@ -7,12 +7,12 @@ set -x
SHORT_SHA=$(git rev-parse --short HEAD)
docker build --build-arg "REVISION=${SHORT_SHA}" -t cp2k-precommit .
docker tag cp2k-precommit gcr.io/cp2k-org-project/img_cp2kprecommit:${SHORT_SHA}
docker tag cp2k-precommit gcr.io/cp2k-org-project/img_cp2kprecommit:latest
docker push gcr.io/cp2k-org-project/img_cp2kprecommit:${SHORT_SHA}
docker push gcr.io/cp2k-org-project/img_cp2kprecommit:latest
docker tag "cp2k-precommit gcr.io/cp2k-org-project/img_cp2kprecommit:${SHORT_SHA}"
docker tag "cp2k-precommit gcr.io/cp2k-org-project/img_cp2kprecommit:latest"
docker push "gcr.io/cp2k-org-project/img_cp2kprecommit:${SHORT_SHA}"
docker push "gcr.io/cp2k-org-project/img_cp2kprecommit:latest"
gcloud run deploy cp2k-precommit --platform=managed --region=us-central1 \
--image=gcr.io/cp2k-org-project/img_cp2kprecommit:${SHORT_SHA}
--image="gcr.io/cp2k-org-project/img_cp2kprecommit:${SHORT_SHA}"
#EOF