Skip to content
Snippets Groups Projects
Commit 1c68aa93 authored by RIETTE Sébastien's avatar RIETTE Sébastien
Browse files

S. Riette 19 Dec 2023: add the documentation generation in the testing procedure

parent d65642ba
No related branches found
No related tags found
No related merge requests found
......@@ -867,7 +867,7 @@ WARN_LOGFILE =
INPUT = ../../src/
INPUT += mainpage.md
INPUT += ..
INPUT += ../../tools/INSTALL.md ../../tools/INSTALL_mnh_expand.md ../../tools/INSTALL_pack_ial.md ../../tools/INSTALL_pack_mesonh.md ../../tools/INSTALL_testprogs.md
INPUT += ../../tools/INSTALL.md ../../tools/INSTALL_pack_ial.md ../../tools/INSTALL_pack_mesonh.md ../../tools/INSTALL_testprogs.md
INPUT += ../../build/with_fcm/README.md
# This tag can be used to specify the character encoding of the source files
......
#!/bin/bash
set -e
set -o pipefail #abort if left command on a pipe fails
function usage {
echo "Usage: $0 [-h] output"
echo "output output file with .pdf or .html extension"
......
......@@ -7,6 +7,7 @@ This script plots the data contained in the performance files obtained with the
import matplotlib.pyplot as plt
import numpy
import pandas
import re
class Perf():
def __init__(self, perffile):
......@@ -15,6 +16,7 @@ class Perf():
"""
self._df = df = pandas.read_csv(perffile, sep=' ',
names=['commit', 'model', 'case', 'time'])
def plotPerf(self, outfile, model=None, title=None, num=None):
"""
:param outfile: output file
......@@ -34,6 +36,7 @@ class Perf():
commits.append(commit)
if num is not None:
commits = commits[-num:]
shortCommits = [self.shortenCommit(c) for c in commits]
df = self._df.groupby('model')
for igrpM, grpM in enumerate(models):
......@@ -44,7 +47,7 @@ class Perf():
ax[igrpM].set_title('Mean elapsed computational time for ' + grpM)
else:
ax[igrpM].set_title(title.replace('%M', grpM))
ax[igrpM].set_ylabel('time (ms/gp)')
ax[igrpM].set_ylabel('time')
ax[igrpM].set_yscale('log')
dfp = df.get_group(grpM).groupby('case')
......@@ -57,14 +60,22 @@ class Perf():
l = [numpy.nan if t < 0. else t for t in dfp.get_group(grp)[f]['time']]
time.append(numpy.nan if len(l) == 0 else numpy.ma.array(l).mean())
ax[igrpM].plot(range(len(commits)), numpy.ma.array(time), 'o-', label=grp)
if igrpM == len(df.groups) - 1:
if igrpM == len(models) - 1:
ax[igrpM].set_xlabel('PHYEX version')
ax[igrpM].set_xticks(range(len(commits)))
ax[igrpM].set_xticklabels(commits, rotation=45, ha='right')
ax[igrpM].set_xticklabels(shortCommits, rotation=45, ha='right')
ax[igrpM].legend()
fig.tight_layout()
fig.savefig(outfile)
@staticmethod
def shortenCommit(commit):
"""
:param commit: full commit SHA
:return: shorten version of commit SHA
"""
return commit[:7] if re.match(r'^[0-9a-f]{40}$', commit) else commit
def listModels(self):
"""
:result: list of models present in the file
......
......@@ -7,7 +7,7 @@ set -o pipefail #abort if left command on a pipe fails
function usage {
echo "Usage: $0 [-h] [--repo-user USER] [--repo-protocol PROTOCOL] [--repo-repo REPO] [--no-update] [--no-compil]"
echo " [--no-exec] [--no-comp] [--no-remove] [--force] [--commit SHA] [--ref REF]"
echo " [--only-model MODEL] [--no-enable-gh-pages] [--perf PERF] [MAIL]"
echo " [--only-model MODEL] [--no-enable-gh-pages] [--perf PERF] [--no-doc-gen] [MAIL]"
echo "--repo-user USER"
echo " user hosting the PHYEX repository on github,"
echo " defaults to the env variable PHYEXREPOuser (=$PHYEXREPOuser)"
......@@ -29,6 +29,7 @@ function usage {
echo "--no-enable-gh-pages"
echo " dont't try to enable the project pages on github"
echo "--perf FILE add performance statistics in file FILE"
echo "--no-doc-gen do not test the documentation generation"
echo "MAIL comma-separated list of e-mail addresses (no spaces); if not provided, mail is not sent"
echo ""
echo "This script provides functionality for automated tests."
......@@ -43,7 +44,9 @@ function usage {
echo "(for arome and/or mesonh) or with data (testprogs)."
echo ""
echo "The script compare the results against reference simulations. These reference simulations must"
echo "be available in the different subdirectories in \${WORKDIR}."
echo "be available in the different subdirectories in \${PHYEXWORKDIR}."
echo ""
echo "The documentation generation is also tested."
}
MAIL=""
......@@ -63,6 +66,7 @@ force=0
models=""
enableghpages=1
perfopt=""
docgen=1
while [ -n "$1" ]; do
case "$1" in
......@@ -81,6 +85,7 @@ while [ -n "$1" ]; do
'--only-model') models="${models} $2"; shift;;
'--no-enable-gh-pages') enableghpages=0;;
'--perf') perfopt="--perf $2"; shift;;
'--no-doc-gen') docgen=0;;
#--) shift; break ;;
*) if [ -z "${MAIL-}" ]; then
MAIL="$1"
......@@ -243,7 +248,7 @@ if [ "${SHA}" -eq 0 ]; then
log 1 "Commit hash is ${SHA}"
fi
if [ ${force} -eq 1 -o $(get_statuses "${SHA}" | grep "${context}" | wc -l) -eq 0 ]; then
log 1 "This commit has not been tested (or --force id provided)"
log 1 "This commit has not been tested (or --force is provided)"
ret=0
#Checkout tools, set PATH and use the last version of the testing script
......@@ -262,7 +267,6 @@ if [ ${force} -eq 1 -o $(get_statuses "${SHA}" | grep "${context}" | wc -l) -eq
git fetch "${PHYEXREPOgiturl}"
git checkout "${SHA}"
cd "${currentdir}"
. "${WORKDIR}/PHYEX/tools/env.sh"
if [ -f "${WORKDIR}/PHYEX/tools/testing.sh" ]; then
if [ "${currentMD5}" != $(md5sum "${WORKDIR}/PHYEX/tools/testing.sh" | cut -d\ -f1) ]; then
log 1 "Script has changed, running the new version" #This log and the preivous ones are lost
......@@ -270,6 +274,7 @@ if [ ${force} -eq 1 -o $(get_statuses "${SHA}" | grep "${context}" | wc -l) -eq
fi
fi
fi
. "${WORKDIR}/PHYEX/tools/env.sh"
#Enable the gihub project pages
if [ $enableghpages -eq 1 ]; then
......@@ -407,6 +412,47 @@ if [ ${force} -eq 1 -o $(get_statuses "${SHA}" | grep "${context}" | wc -l) -eq
fi
done
if [ $docgen -eq 1 ]; then
retdoc=0
log 0 "Test doc generation"
doccmd="generate_standalone_doc.sh ${WORKDIR}/documentation.html"
log 1 "Doc generation with ${doccmd}"
set +e
${doccmd}
result=$?
set -e
if [ ${result} -ne 0 ]; then
retdoc=1
log 0 " doc generarion with generate_standalone_doc.sh: error"
else
log 0 " doc generarion with generate_standalone_doc.sh: OK"
fi
doccmd="doxygen doxygen_config"
log 1 "Doc generation with ${doccmd}"
cwd=$PWD
cd ${WORKDIR}/PHYEX/docs/doxygen
set +e
${doccmd}
result=$?
set -e
cd $cwd
if [ ${result} -ne 0 ]; then
retdoc=1
log 0 " doc generarion with doxygen: error"
else
log 0 " doc generarion with doxygen: OK"
fi
if [ $retdoc -eq 0 ]; then
log 0 "..... global result for doc generation: OK"
else
ret=1
log 0 "XXXXX global result for doc generation: ERROR"
fi
fi
#Report result
report 0 ${ret}
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment