mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ian Rogers <irogers@google.com>
To: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
	Thomas Richter <tmricht@linux.ibm.com>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Stephane Eranian <eranian@google.com>, Ian Rogers <irogers@google.com>
Subject: [PATCH] perf test: Add flake tolerance to record test
Date: Wed,  8 Jun 2022 20:28:42 -0700	[thread overview]
Message-ID: <20220609032842.1257761-1-irogers@google.com> (raw)

Testing at scale exposes record tests failing with no samples. Retry the
test a bounded number of times to eliminate this.

Signed-off-by: Ian Rogers <irogers@google.com>
---
 tools/perf/tests/shell/record.sh | 70 +++++++++++++++++++++-----------
 1 file changed, 47 insertions(+), 23 deletions(-)

diff --git a/tools/perf/tests/shell/record.sh b/tools/perf/tests/shell/record.sh
index 00c7285ce1ac..aeed364e834a 100755
--- a/tools/perf/tests/shell/record.sh
+++ b/tools/perf/tests/shell/record.sh
@@ -30,19 +30,29 @@ test_per_thread() {
     fi
     return
   fi
-  if ! perf record -e instructions:u --per-thread -o ${perfdata} true 2> /dev/null
-  then
-    echo "Per-thread record of instructions:u [Failed]"
-    err=1
-    return
-  fi
-  if ! perf report -i ${perfdata} -q | egrep -q true
-  then
-    echo "Per-thread record [Failed missing output]"
-    err=1
-    return
-  fi
-  echo "Basic --per-thread mode test [Success]"
+  flake_count=0
+  while true
+  do
+    if ! perf record -e instructions:u --per-thread -o ${perfdata} true 2> /dev/null
+    then
+      echo "Per-thread record of instructions:u [Failed]"
+      err=1
+      return
+    fi
+    if perf report -i ${perfdata} -q | egrep -q true
+    then
+      echo "Basic --per-thread mode test [Success]"
+      return
+    else
+      flake_count=$(($flake_count + 1))
+      if [ $flake_count -ge 30 ]
+      then
+        echo "Per-thread record attempted 30 times [Failed missing output]"
+        err=1
+        return
+      fi
+    fi
+  done
 }
 
 test_register_capture() {
@@ -61,16 +71,30 @@ test_register_capture() {
     echo "Register capture test [Skipped missing registers]"
     return
   fi
-  if ! perf record -o - --intr-regs=di,r8,dx,cx -e cpu/br_inst_retired.near_call/p \
-    -c 1000 --per-thread true 2> /dev/null \
-    | perf script -F ip,sym,iregs -i - 2> /dev/null \
-    | egrep -q "DI:"
-  then
-    echo "Register capture test [Failed missing output]"
-    err=1
-    return
-  fi
-  echo "Register capture test [Success]"
+  flake_count=0
+  while true
+  do
+    if ! perf record -o ${perfdata} --intr-regs=di,r8,dx,cx -e cpu/br_inst_retired.near_call/p \
+      -c 1000 --per-thread true 2> /dev/null
+    then
+      echo "Register capture test of cpu/br_inst_retired.near_call/p with --intr-regs [Failed]"
+      err=1
+      return
+    fi
+    if perf script -F ip,sym,iregs -i ${perfdata} 2> /dev/null | egrep -q "DI:"
+    then
+      echo "Register capture test [Success]"
+      return
+    else
+      flake_count=$(($flake_count + 1))
+      if [ $flake_count -ge 30 ]
+      then
+        echo "Register capture test attempted 30 times [Failed missing output]"
+        err=1
+        return
+      fi
+    fi
+  done
 }
 
 test_per_thread
-- 
2.36.1.255.ge46751e96f-goog


                 reply	other threads:[~2022-06-09  3:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220609032842.1257761-1-irogers@google.com \
    --to=irogers@google.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=eranian@google.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tmricht@linux.ibm.com \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®