Message ID | 20240614172742.56976-2-atrajeev@linux.vnet.ibm.com (mailing list archive) |
---|---|
State | Handled Elsewhere, archived |
Headers | show |
Series | [1/2] tools/perf: Fix the string match for "/tmp/perf-$PID.map" files in dso__load | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/github-powerpc_perf | success | Successfully ran 6 jobs. |
snowpatch_ozlabs/github-powerpc_sparse | success | Successfully ran 4 jobs. |
snowpatch_ozlabs/github-powerpc_clang | success | Successfully ran 6 jobs. |
snowpatch_ozlabs/github-powerpc_kernel_qemu | success | Successfully ran 23 jobs. |
On 14/06/24 20:27, Athira Rajeev wrote: > perf test "perf script tests" fails as below in systems > with python 3.6 > > File "/home/athira/linux/tools/perf/tests/shell/../../scripts/python/parallel-perf.py", line 442 > if line := p.stdout.readline(): > ^ > SyntaxError: invalid syntax > --- Cleaning up --- > ---- end(-1) ---- > 92: perf script tests: FAILED! > > This happens because ":=" is a new syntax that assigns values > to variables as part of a larger expression. This is introduced > from python 3.8 and hence fails in setup with python 3.6 According to below python 3.6 is end-of-life https://devguide.python.org/versions/ What was still using python 3.6? > Address this by splitting the large expression and check the > value in two steps: > Previous line: if line := p.stdout.readline(): > Current change: > line = p.stdout.readline() > if line: > > With patch > > ./perf test "perf script tests" > 93: perf script tests: Ok > > Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> > --- > tools/perf/scripts/python/parallel-perf.py | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/tools/perf/scripts/python/parallel-perf.py b/tools/perf/scripts/python/parallel-perf.py > index 21f32ec5ed46..be85fd7f6632 100755 > --- a/tools/perf/scripts/python/parallel-perf.py > +++ b/tools/perf/scripts/python/parallel-perf.py > @@ -439,7 +439,8 @@ def ProcessCommandOutputLines(cmd, per_cpu, fn, *x): > pat = re.compile(r"\s*\[[0-9]+\]") > p = subprocess.Popen(cmd, stdout=subprocess.PIPE) > while True: > - if line := p.stdout.readline(): > + line = p.stdout.readline() > + if line: > line = line.decode("utf-8") > if pat.match(line): > line = line.split()
> On 16 Jun 2024, at 8:33 PM, Adrian Hunter <adrian.hunter@intel.com> wrote: > > On 14/06/24 20:27, Athira Rajeev wrote: >> perf test "perf script tests" fails as below in systems >> with python 3.6 >> >> File "/home/athira/linux/tools/perf/tests/shell/../../scripts/python/parallel-perf.py", line 442 >> if line := p.stdout.readline(): >> ^ >> SyntaxError: invalid syntax >> --- Cleaning up --- >> ---- end(-1) ---- >> 92: perf script tests: FAILED! >> >> This happens because ":=" is a new syntax that assigns values >> to variables as part of a larger expression. This is introduced >> from python 3.8 and hence fails in setup with python 3.6 > > According to below python 3.6 is end-of-life > > https://devguide.python.org/versions/ > > What was still using python 3.6? > >> Address this by splitting the large expression and check the >> value in two steps: >> Previous line: if line := p.stdout.readline(): >> Current change: >> line = p.stdout.readline() >> if line: >> >> With patch >> >> ./perf test "perf script tests" >> 93: perf script tests: Ok >> >> Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com> > > Acked-by: Adrian Hunter <adrian.hunter@intel.com> Observed this on SLES 15 SP5 Thanks for the Acked-by Adrian I will be posting a V2 adding this Acked-by for this Patch 2 and addressing changes suggested in handling "/tmp/perf-%d.map” files in Patch 1 Thanks Athira > >> --- >> tools/perf/scripts/python/parallel-perf.py | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/tools/perf/scripts/python/parallel-perf.py b/tools/perf/scripts/python/parallel-perf.py >> index 21f32ec5ed46..be85fd7f6632 100755 >> --- a/tools/perf/scripts/python/parallel-perf.py >> +++ b/tools/perf/scripts/python/parallel-perf.py >> @@ -439,7 +439,8 @@ def ProcessCommandOutputLines(cmd, per_cpu, fn, *x): >> pat = re.compile(r"\s*\[[0-9]+\]") >> p = subprocess.Popen(cmd, stdout=subprocess.PIPE) >> while True: >> - if line := p.stdout.readline(): >> + line = p.stdout.readline() >> + if line: >> line = line.decode("utf-8") >> if pat.match(line): >> line = line.split()
diff --git a/tools/perf/scripts/python/parallel-perf.py b/tools/perf/scripts/python/parallel-perf.py index 21f32ec5ed46..be85fd7f6632 100755 --- a/tools/perf/scripts/python/parallel-perf.py +++ b/tools/perf/scripts/python/parallel-perf.py @@ -439,7 +439,8 @@ def ProcessCommandOutputLines(cmd, per_cpu, fn, *x): pat = re.compile(r"\s*\[[0-9]+\]") p = subprocess.Popen(cmd, stdout=subprocess.PIPE) while True: - if line := p.stdout.readline(): + line = p.stdout.readline() + if line: line = line.decode("utf-8") if pat.match(line): line = line.split()
perf test "perf script tests" fails as below in systems with python 3.6 File "/home/athira/linux/tools/perf/tests/shell/../../scripts/python/parallel-perf.py", line 442 if line := p.stdout.readline(): ^ SyntaxError: invalid syntax --- Cleaning up --- ---- end(-1) ---- 92: perf script tests: FAILED! This happens because ":=" is a new syntax that assigns values to variables as part of a larger expression. This is introduced from python 3.8 and hence fails in setup with python 3.6 Address this by splitting the large expression and check the value in two steps: Previous line: if line := p.stdout.readline(): Current change: line = p.stdout.readline() if line: With patch ./perf test "perf script tests" 93: perf script tests: Ok Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com> --- tools/perf/scripts/python/parallel-perf.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)