lkml.org 
[lkml]   [2022]   [Jun]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
Subject[PATCH] perf test: Add flake tolerance to record test
From
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
\
 
 \ /
  Last update: 2022-06-09 05:30    [W:0.061 / U:0.224 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site