[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220609032842.1257761-1-irogers@google.com>
Date: Wed, 8 Jun 2022 20:28:42 -0700
From: Ian Rogers <irogers@...gle.com>
To: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Thomas Richter <tmricht@...ux.ibm.com>,
linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Stephane Eranian <eranian@...gle.com>,
Ian Rogers <irogers@...gle.com>
Subject: [PATCH] perf test: Add flake tolerance to record test
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@...gle.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
Powered by blists - more mailing lists