public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Stefano Brivio <sbrivio@redhat.com>
To: passt-dev@passt.top
Cc: David Gibson <david@gibson.dropbear.id.au>
Subject: [PATCH 3/5] test/lib/perf_report: Use own flag to track initialisation
Date: Mon, 31 Oct 2022 10:58:56 +0100	[thread overview]
Message-ID: <20221031095858.117012-4-sbrivio@redhat.com> (raw)
In-Reply-To: <20221031095858.117012-1-sbrivio@redhat.com>

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>
---
 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 <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
-- 
@@ -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
-- 
2.35.1


  parent reply	other threads:[~2022-10-31  9:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-31  9:58 [PATCH 0/5] Test cases to display memory usage in kernel and userspace Stefano Brivio
2022-10-31  9:58 ` [PATCH 1/5] test/lib: Move screen-scraping setup and layout functions to _ugly files Stefano Brivio
2022-10-31  9:58 ` [PATCH 2/5] tap: Support for detection of existing sockets on ramfs Stefano Brivio
2022-10-31  9:58 ` Stefano Brivio [this message]
2022-10-31  9:58 ` [PATCH 4/5] test/lib: Add "td" directive, handled by table_value() Stefano Brivio
2022-10-31  9:58 ` [PATCH 5/5] test: Add memory/passt test cases Stefano Brivio
2022-10-31 11:10   ` Stefano Brivio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221031095858.117012-4-sbrivio@redhat.com \
    --to=sbrivio@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=passt-dev@passt.top \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).