aboutgitcodebugslistschat
path: root/test/lib
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2022-10-31 10:36:24 +0100
committerStefano Brivio <sbrivio@redhat.com>2022-11-04 12:01:17 +0100
commitbfd311aec786ce0b7d3b8bbaf37147aa1ba9ec08 (patch)
tree7c88946ddbb73a3519980c10ebf83132b4c02e13 /test/lib
parent2d4468ebb72242a2d1d5345941df2db14584f14c (diff)
downloadpasst-bfd311aec786ce0b7d3b8bbaf37147aa1ba9ec08.tar
passt-bfd311aec786ce0b7d3b8bbaf37147aa1ba9ec08.tar.gz
passt-bfd311aec786ce0b7d3b8bbaf37147aa1ba9ec08.tar.bz2
passt-bfd311aec786ce0b7d3b8bbaf37147aa1ba9ec08.tar.lz
passt-bfd311aec786ce0b7d3b8bbaf37147aa1ba9ec08.tar.xz
passt-bfd311aec786ce0b7d3b8bbaf37147aa1ba9ec08.tar.zst
passt-bfd311aec786ce0b7d3b8bbaf37147aa1ba9ec08.zip
test/lib/perf_report: Use own flag to track initialisation
Instead of just disabling performance reports if running in demo mode. This allows us to use table functions outside of performance reports. Signed-off-by: Stefano Brivio <sbrivio@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'test/lib')
-rwxr-xr-xtest/lib/perf_report9
1 files changed, 6 insertions, 3 deletions
diff --git a/test/lib/perf_report b/test/lib/perf_report
index ed71ef9..4ffb14b 100755
--- a/test/lib/perf_report
+++ b/test/lib/perf_report
@@ -13,6 +13,7 @@
# Copyright (c) 2021 Red Hat GmbH
# Author: Stefano Brivio <sbrivio@redhat.com>
+PERF_INIT=0
PERF_LINK_COUNT=0
PERF_JS="${LOGDIR}/web/perf.js"
@@ -129,6 +130,7 @@ perf_init() {
mkdir -p "$(dirname "${PERF_JS}")"
echo "${PERF_TEMPLATE_HTML}" > "${PERF_JS}"
perf_report_sub commit "$(echo ${COMMIT} | sed "s/'/\\\'/g")"
+ PERF_INIT=1
}
# perf_fill_lines() - Fill multiple "LINE" directives in template, matching rows
@@ -178,6 +180,7 @@ perf_fill_lines() {
# perf_finish() - Add trailing backslashes and process ending templates
perf_finish() {
+ PERF_INIT=0
perf_fill_lines
sed -i 's/^.*$/&\\/g' "${PERF_JS}"
echo "${PERF_TEMPLATE_JS}" >> "${PERF_JS}"
@@ -215,7 +218,7 @@ perf_report() {
# perf_th() - Table header for a set of tests
perf_th() {
- [ ${DEMO} -eq 1 ] && return
+ [ ${PERF_INIT} -eq 0 ] && return
shift
@@ -231,7 +234,7 @@ perf_th() {
# perf_tr() - Main table row
perf_tr() {
- [ ${DEMO} -eq 1 ] && return
+ [ ${PERF_INIT} -eq 0 ] && return
__line_no=0
shift
@@ -244,7 +247,7 @@ perf_tr() {
# perf_td() - Single cell with test result
perf_td() {
- [ ${DEMO} -eq 1 ] && return
+ [ ${PERF_INIT} -eq 0 ] && return
__rewind="${1}"
shift