From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by passt.top (Postfix, from userid 1000) id A8C2D5A026C; Mon, 31 Oct 2022 10:58:58 +0100 (CET) From: Stefano Brivio To: passt-dev@passt.top Subject: [PATCH 3/5] test/lib/perf_report: Use own flag to track initialisation Date: Mon, 31 Oct 2022 10:58:56 +0100 Message-Id: <20221031095858.117012-4-sbrivio@redhat.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221031095858.117012-1-sbrivio@redhat.com> References: <20221031095858.117012-1-sbrivio@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: 6DBNRXTT6VMNPDXCJ6T67OYQNUXGZXTO X-Message-ID-Hash: 6DBNRXTT6VMNPDXCJ6T67OYQNUXGZXTO X-MailFrom: sbrivio@passt.top X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: David Gibson X-Mailman-Version: 3.3.3 Precedence: list List-Id: Development discussion and patches for passt Archived-At: <> Archived-At: List-Archive: <> List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 --- test/lib/perf_report | 9 ++++++--- 1 file 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 +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 -- 2.35.1