diff options
author | Peter Mikus <pmikus@cisco.com> | 2017-07-28 13:06:56 +0200 |
---|---|---|
committer | Peter Mikus <pmikus@cisco.com> | 2017-07-31 18:13:02 +0000 |
commit | 196ed0599148d6c8ed0e2ca82ad03e129e26428a (patch) | |
tree | 0bf5e622c46eb78e2732d877a54c6a79c21ecd3d /resources/tools/report_gen/run_report.sh | |
parent | 63026fb66d761b13c4b44f4935ee30010f8856de (diff) |
CSIT-618 Add LaTeX support to release report
- Add option to generate PDF from release report.
- Conditional content
- Static plot conversion
Change-Id: I7c4f0b41898791d1cab446d0fc3b07220380e1b8
Signed-off-by: Peter Mikus <pmikus@cisco.com>
Diffstat (limited to 'resources/tools/report_gen/run_report.sh')
-rwxr-xr-x | resources/tools/report_gen/run_report.sh | 108 |
1 files changed, 80 insertions, 28 deletions
diff --git a/resources/tools/report_gen/run_report.sh b/resources/tools/report_gen/run_report.sh index a40d91dac7..bf6d5844dd 100755 --- a/resources/tools/report_gen/run_report.sh +++ b/resources/tools/report_gen/run_report.sh @@ -2,12 +2,32 @@ set -x -# Build locally without jenkins integrations +# Process parameters +# Debugging DEBUG=0 +# Latex Builder +LATEX=0 + +for i in "$@"; do +case $i in + --debug) + DEBUG=1 + ;; + --latex) + LATEX=1 + ;; + *) + # unknown option + ;; +esac +done # Script directory SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +# Get actual date +DATE=$(date -u '+%d-%b-%Y') + # Load configuration source ${SCRIPT_DIR}/run_report.cfg @@ -15,6 +35,12 @@ source ${SCRIPT_DIR}/run_report.cfg sudo apt-get -y update sudo apt-get -y install libxml2 libxml2-dev libxslt-dev build-essential \ zlib1g-dev unzip +if [[ ${LATEX} -eq 1 ]] ; +then + sudo apt-get -y install librsvg2-bin texlive-latex-recommended \ + texlive-fonts-recommended texlive-fonts-extra texlive-latex-extra latexmk wkhtmltopdf + sudo sed -i.bak 's/^\(main_memory\s=\s\).*/\110000000/' /usr/share/texlive/texmf-dist/web2c/texmf.cnf +fi # Clean-up when finished trap 'rm -rf ${DIR[WORKING]}; exit' EXIT @@ -22,6 +48,7 @@ trap 'rm -rf ${DIR[WORKING]}; exit' ERR # Remove the old build rm -rf ${DIR[BUILD]} || true +rm -rf ${DIR[BUILD,LATEX]} || true rm -rf ${DIR[WORKING]} || true # Create working directories @@ -55,14 +82,17 @@ blds=${JOB[PERF,VPP,BLD]} for i in ${blds[@]}; do curl --silent ${URL[JENKINS,CSIT]}/${JOB[PERF,VPP]}/${i}/robot/report/output_perf_data.xml \ --output ${DIR[PLOT,VPP]}/${JOB[PERF,VPP]}-${i}.xml - #curl --silent ${URL[JENKINS,CSIT]}/${JOB[PERF,VPP]}/${i}/robot/report/output_perf_data.json \ - # --output ${DIR[PLOT,VPP]}/${JOB[PERF,VPP]}-${i}.json if [[ ${DEBUG} -eq 0 ]] ; then curl --fail --silent ${URL[JENKINS,CSIT]}/${JOB[PERF,VPP]}/${i}/robot/report/\*zip\*/robot-plugin.zip \ --output ${DIR[STATIC,ARCH]}/${JOB[PERF,VPP]}-${i}.zip fi done +if [[ ${DEBUG} -eq 0 ]] ; +then + curl --fail --silent ${URL[JENKINS,CSIT]}/${JOB[PERF,VPP]}/${JOB[PERF,VPP,FBLD]}/robot/report/\*zip\*/robot-plugin.zip \ + --output ${DIR[STATIC,ARCH]}/${JOB[PERF,VPP]}-${JOB[PERF,VPP,FBLD]}.zip +fi # Archive trending cp ${DIR[PLOT,VPP]}/* ${DIR[STATIC,TREND]} blds=${JOB[1704,VPP,BLD]} @@ -81,8 +111,6 @@ blds=${JOB[PERF,DPDK,BLD]} for i in ${blds[@]}; do curl --silent ${URL[JENKINS,CSIT]}/${JOB[PERF,DPDK]}/${i}/robot/report/output_perf_data.xml \ --output ${DIR[PLOT,DPDK]}/${JOB[PERF,DPDK]}-${i}.xml - #curl --silent ${URL[JENKINS,CSIT]}/${JOB[PERF,DPDK]}/${i}/robot/report/output_perf_data.json \ - # --output ${DIR[PLOT,DPDK]}/${JOB[PERF,DPDK]}-${i}.json if [[ ${DEBUG} -eq 0 ]] ; then curl --fail --silent ${URL[JENKINS,CSIT]}/${JOB[PERF,DPDK]}/${i}/robot/report/\*zip\*/robot-plugin.zip \ @@ -206,29 +234,6 @@ fi # Delete temporary json files find ${DIR[RST]} -name "*.json" -type f -delete -# Generate the documentation -DATE=$(date -u '+%d-%b-%Y') -sphinx-build -v -c . -a -b html -E \ - -D release=$1 -D version="$1 report - $DATE" \ - ${DIR[RST]} ${DIR[BUILD]}/ - -# Patch the CSS for tables layout -cat - > ${DIR[CSS_PATCH_FILE]} <<"_EOF" -/* override table width restrictions */ -@media screen and (min-width: 767px) { - .wy-table-responsive table td, .wy-table-responsive table th { - white-space: normal !important; - } - - .wy-table-responsive { - font-size: small; - margin-bottom: 24px; - max-width: 100%; - overflow: visible !important; - } -} -_EOF - # Plot packets per second # VPP L2 sel1 @@ -237,6 +242,7 @@ python run_plot.py --input ${DIR[PLOT,VPP]} \ --output ${DIR[STATIC,VPP]}/64B-1t1c-l2-sel1-ndrdisc \ --title "64B-1t1c-(eth|dot1q|dot1ad)-(l2xcbase|l2bdbasemaclrn)-ndrdisc" \ --xpath '//*[@framesize="64B" and contains(@tags,"BASE") and contains(@tags,"NDRDISC") and contains(@tags,"1T1C") and (contains(@tags,"L2BDMACSTAT") or contains(@tags,"L2BDMACLRN") or contains(@tags,"L2XCFWD")) and not(contains(@tags,"VHOST"))]' + python run_plot.py --input ${DIR[PLOT,VPP]} \ --output ${DIR[STATIC,VPP]}/64B-2t2c-l2-sel1-ndrdisc \ --title "64B-2t2c-(eth|dot1q|dot1ad)-(l2xcbase|l2bdbasemaclrn)-ndrdisc" \ @@ -571,6 +577,52 @@ python run_plot.py --input ${DIR[PLOT,DPDK]} \ --title "64B-2t2c-ethip4-ip4base-l3fwd-ndrdisc" \ --xpath '//*[@framesize="64B" and contains(@tags,"BASE") and contains(@tags,"NDRDISC") and contains(@tags,"2T2C") and contains(@tags,"IP4FWD")]' --latency lat_50 +# HTML BUILDER +sphinx-build -v -c . -a -b html -E \ + -D release=$1 -D version="$1 report - $DATE" \ + ${DIR[RST]} ${DIR[BUILD]}/ + +# Patch the CSS for tables layout +cat - > ${DIR[CSS_PATCH_FILE]} <<"_EOF" +/* override table width restrictions */ +@media screen and (min-width: 767px) { + .wy-table-responsive table td, .wy-table-responsive table th { + white-space: normal !important; + } + + .wy-table-responsive { + font-size: small; + margin-bottom: 24px; + max-width: 100%; + overflow: visible !important; + } +} +_EOF + +# LATEX BUILDER +if [[ ${LATEX} -eq 1 ]] ; +then + # Convert PyPLOT graphs in HTML format to PDF. + for f in ${DIR[STATIC,VPP]}/*; do + wkhtmltopdf ${f} ${f%.html}.pdf + done + for f in ${DIR[STATIC,DPDK]}/*; do + wkhtmltopdf ${f} ${f%.html}.pdf + done + rsvg-convert -z 10 -f pdf -o fdio.pdf fdio.svg + + # Generate the LaTeX documentation + sphinx-build -v -c . -a -b latex -E \ + -D release=$1 -D version="$1 report - $DATE" \ + ${DIR[RST]} ${DIR[BUILD,LATEX]} + cd ${DIR[BUILD,LATEX]} + pdflatex -shell-escape -interaction nonstopmode csit.tex || true + pdflatex -interaction nonstopmode csit.tex || true + cp csit.pdf ../${DIR[STATIC,ARCH]}/csit_$1.pdf + cd ${SCRIPT_DIR} + rm -f fdio.pdf +fi + # Create archive echo Creating csit.report.tar.gz ... tar -czvf ./csit.report.tar.gz ${DIR[BUILD]} |