Skip to contentSkip to conversation

perf/tests: Fix test case 83 on s390

PATCH Applied Thomas Richter 2 participants 2 messages Jul 20, 2022 1 message not in the archive perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf/tests: Fix test case 83 on s390

Perf test case 83: perf stat CSV output linter might fail on s390.
The reason for this is the output of the command

./perf stat -x, -A -a --no-merge true

which depends on a .config file setting. When CONFIG_SCHED_TOPOLOGY is set, the output of above perf command is

CPU0,1.50,msec,cpu-clock,1502781,100.00,1.052,CPUs utilized

When CONFIG_SCHED_TOPOLOGY is *NOT* set the output of above perf command is

0.95,msec,cpu-clock,949800,100.00,1.060,CPUs utilized

Fix the test case to accept both output formats.

Output before:

 # perf test 83
 83: perf stat CSV output linter       : FAILED!
 #

Output after:

 # ./perf test 83
 83: perf stat CSV output linter       : Ok
 #
Fixes ec906102e5b7 ("perf test: Fix "perf stat CSV output linter" test on s390")
---
 tools/perf/tests/shell/stat+csv_output.sh | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
tools/perf/tests/shell/stat+csv_output.sh +4 -3
index 38c26f3ef4c1..eb5196f58190 100755
@@ -8,7 +8,8 @@ set -e
 
 function commachecker()
 {
-	local -i cnt=0 exp=0
+	local -i cnt=0
+	local exp=0
 
 	case "$1"
 	in "--no-args")		exp=6
@@ -17,7 +18,7 @@ function commachecker()
 	;; "--interval")	exp=7
 	;; "--per-thread")	exp=7
 	;; "--system-wide-no-aggr")	exp=7
-				[ $(uname -m) = "s390x" ] && exp=6
+				[ $(uname -m) = "s390x" ] && exp='^[6-7]$'
 	;; "--per-core")	exp=8
 	;; "--per-socket")	exp=8
 	;; "--per-node")	exp=8
@@ -34,7 +35,7 @@ function commachecker()
 		x=$(echo $line | tr -d -c ',')
 		cnt="${#x}"
 		# echo $line $cnt
-		[ "$cnt" -ne "$exp" ] && {
+		[[ ! "$cnt" =~ $exp ]] && {
 			echo "wrong number of fields. expected $exp in $line" 1>&2
 			exit 1;
 		}
Signature · 1 line
2.36.1

A message that is not in the archive (sent off-list or not yet received): CAP-5=fWeUh2hyGAqc4XidJZ7X06f4=MojyQwuOtbL3cs3u+T=w@mail.gmail.com

maintainer Applied
#2 lore raw

Em Wed, Jul 20, 2022 at 06:16:44AM -0700, Ian Rogers escreveu:

Quoted 30 lines · Thomas Richter
Quoted 29 lines

Perf test case 83: perf stat CSV output linter might fail on s390.
The reason for this is the output of the command

./perf stat -x, -A -a --no-merge true

which depends on a .config file setting. When CONFIG_SCHED_TOPOLOGY is set, the output of above perf command is

   CPU0,1.50,msec,cpu-clock,1502781,100.00,1.052,CPUs utilized

When CONFIG_SCHED_TOPOLOGY is *NOT* set the output of above perf command is

   0.95,msec,cpu-clock,949800,100.00,1.060,CPUs utilized

Fix the test case to accept both output formats.

Output before:

 # perf test 83
 83: perf stat CSV output linter       : FAILED!
 #

Output after:

 # ./perf test 83
 83: perf stat CSV output linter       : Ok
 #
Quoted 8 lines
Quoted 6 lines
Fixes ec906102e5b7 ("perf test: Fix "perf stat CSV output linter" test on

s390")

Thanks, applied.

- Arnaldo

Quoted 45 lines

Thanks,
Ian

---

Quoted 41 lines
 tools/perf/tests/shell/stat+csv_output.sh | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
tools/perf/tests/shell/stat+csv_output.sh +4 -3
index 38c26f3ef4c1..eb5196f58190 100755
@@ -8,7 +8,8 @@ set -e
 
 function commachecker()
 {
-       local -i cnt=0 exp=0
+       local -i cnt=0
+       local exp=0
 
        case "$1"
        in "--no-args")         exp=6
@@ -17,7 +18,7 @@ function commachecker()
        ;; "--interval")        exp=7
        ;; "--per-thread")      exp=7
        ;; "--system-wide-no-aggr")     exp=7
-                               [ $(uname -m) = "s390x" ] && exp=6
+                               [ $(uname -m) = "s390x" ] && exp='^[6-7]$'
        ;; "--per-core")        exp=8
        ;; "--per-socket")      exp=8
        ;; "--per-node")        exp=8
@@ -34,7 +35,7 @@ function commachecker()
                x=$(echo $line | tr -d -c ',')
                cnt="${#x}"
                # echo $line $cnt
-               [ "$cnt" -ne "$exp" ] && {
+               [[ ! "$cnt" =~ $exp ]] && {
                        echo "wrong number of fields. expected $exp in

$line" 1>&2

                        exit 1;
                }

--
2.36.1

Signature · 1 line
- Arnaldo