Skip to contentSkip to conversation

perf: python3 + tests attr.py failing

DISCUSSION Arnaldo Carvalho de Melo 2 participants 7 messages Feb 4, 2019 – Feb 5, 2019

lore
Share & tools
lore
#0 lore raw

Noticed this now when building with PYTHON=python3, can you take a look? For now I'm reinstalling python2-devel and building with it, i.e. removing that PYTHON=python3 make command line variable.

[root@quaco ~]# perf test -v perf_event_attr
16: Setup struct perf_event_attr :
--- start ---
test child forked, pid 23937
File "/home/acme/libexec/perf-core/tests/attr.py", line 325
except Unsup, obj:
^
SyntaxError: invalid syntax
test child finished with -1
---- end ----
Setup struct perf_event_attr: FAILED!
[root@quaco ~]# find

Reverting back to building with python2-devel makes it work:

make O=/tmp/build/perf -C tools/perf install-bin

[acme@quaco perf]$ ldd ~/bin/perf | grep python

	libpython2.7.so.1.0 => /lib64/libpython2.7.so.1.0 (0x00007fe283792000)

[acme@quaco perf]$

[root@quaco ~]# perf test perf_event_attr
16: Setup struct perf_event_attr : Ok
[root@quaco ~]#

- Arnaldo

#1 lore raw
Quoted 4 lines · Arnaldo Carvalho de Melo

Noticed this now when building with PYTHON=python3, can you take a look? For now I'm reinstalling python2-devel and building with it, i.e. removing that PYTHON=python3 make command line variable.

Quoted 11 lines

[root@quaco ~]# perf test -v perf_event_attr
16: Setup struct perf_event_attr :
--- start ---
test child forked, pid 23937
File "/home/acme/libexec/perf-core/tests/attr.py", line 325
except Unsup, obj:
^
SyntaxError: invalid syntax
test child finished with -1
---- end ----
Setup struct perf_event_attr: FAILED!

hum, I built the same way like you 'make PYTHON=python3' [root@krava perf]# ldd ./perf | grep python

        libpython3.6m.so.1.0 => /lib64/libpython3.6m.so.1.0 (0x00007f4ca7cc4000)

and get 'Ok result'

[root@krava perf]# ./perf test attr
16: Setup struct perf_event_attr : Ok
48: Synthesize attr update : Ok

[root@krava perf]# python3 --version
Python 3.6.8
[root@krava perf]# rpm -qa | grep python3-devel
python3-devel-3.6.8-1.fc28.x86_64

which Fedora are you on 29? I'm on 28

jirka

Quoted 15 lines

[root@quaco ~]# find

Reverting back to building with python2-devel makes it work:

make O=/tmp/build/perf -C tools/perf install-bin

[acme@quaco perf]$ ldd ~/bin/perf | grep python

	libpython2.7.so.1.0 => /lib64/libpython2.7.so.1.0 (0x00007fe283792000)

[acme@quaco perf]$

[root@quaco ~]# perf test perf_event_attr
16: Setup struct perf_event_attr : Ok
[root@quaco ~]#

- Arnaldo

#2 lore raw

Em Mon, Feb 04, 2019 at 09:37:38PM +0100, Jiri Olsa escreveu:

Quoted 28 lines · Arnaldo Carvalho de Melo
Quoted 4 lines

Noticed this now when building with PYTHON=python3, can you take a look? For now I'm reinstalling python2-devel and building with it, i.e. removing that PYTHON=python3 make command line variable.

Quoted 11 lines

[root@quaco ~]# perf test -v perf_event_attr
16: Setup struct perf_event_attr :
--- start ---
test child forked, pid 23937
File "/home/acme/libexec/perf-core/tests/attr.py", line 325
except Unsup, obj:
^
SyntaxError: invalid syntax
test child finished with -1
---- end ----
Setup struct perf_event_attr: FAILED!

hum, I built the same way like you 'make PYTHON=python3' [root@krava perf]# ldd ./perf | grep python

        libpython3.6m.so.1.0 => /lib64/libpython3.6m.so.1.0 (0x00007f4ca7cc4000)

and get 'Ok result'

[root@krava perf]# ./perf test attr
16: Setup struct perf_event_attr : Ok
48: Synthesize attr update : Ok

Quoted 6 lines

[root@krava perf]# python3 --version
Python 3.6.8
[root@krava perf]# rpm -qa | grep python3-devel
python3-devel-3.6.8-1.fc28.x86_64

which Fedora are you on 29? I'm on 28

[acme@quaco ~]$ cat /etc/fedora-release
Fedora release 29 (Twenty Nine)

[acme@quaco tumbleweed]$ rpm -qa | grep python3 | wc -l 96
[acme@quaco tumbleweed]$ rpm -q python3-devel python3-devel-3.7.2-4.fc29.x86_64
[acme@quaco tumbleweed]$

But it is a SyntaxError, so something simpler, looking up...

- Arnaldo

Quoted 17 lines

jirka

Quoted 15 lines

[root@quaco ~]# find

Reverting back to building with python2-devel makes it work:

make O=/tmp/build/perf -C tools/perf install-bin

[acme@quaco perf]$ ldd ~/bin/perf | grep python

	libpython2.7.so.1.0 => /lib64/libpython2.7.so.1.0 (0x00007fe283792000)

[acme@quaco perf]$

[root@quaco ~]# perf test perf_event_attr
16: Setup struct perf_event_attr : Ok
[root@quaco ~]#

- Arnaldo

Signature · 1 line
- Arnaldo
#3 lore raw

Em Tue, Feb 05, 2019 at 10:02:14AM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 10 lines

Em Mon, Feb 04, 2019 at 09:37:38PM +0100, Jiri Olsa escreveu:

Quoted 5 lines · Arnaldo Carvalho de Melo
Quoted 3 lines

Noticed this now when building with PYTHON=python3, can you take a look? For now I'm reinstalling python2-devel and building with it, i.e. removing that PYTHON=python3 make command line variable.

which Fedora are you on 29? I'm on 28

[acme@quaco ~]$ cat /etc/fedora-release
Fedora release 29 (Twenty Nine)

Quoted 7 lines

[acme@quaco tumbleweed]$ rpm -qa | grep python3 | wc -l 96
[acme@quaco tumbleweed]$ rpm -q python3-devel python3-devel-3.7.2-4.fc29.x86_64
[acme@quaco tumbleweed]$

But it is a SyntaxError, so something simpler, looking up...

So python 3 needs to have that as:

except Unsup as obj:

How to make this work with both is what I'm trying to figure out now...

Quoted 23 lines

- Arnaldo

Quoted 17 lines

jirka

Quoted 15 lines

[root@quaco ~]# find

Reverting back to building with python2-devel makes it work:

make O=/tmp/build/perf -C tools/perf install-bin

[acme@quaco perf]$ ldd ~/bin/perf | grep python

	libpython2.7.so.1.0 => /lib64/libpython2.7.so.1.0 (0x00007fe283792000)

[acme@quaco perf]$

[root@quaco ~]# perf test perf_event_attr
16: Setup struct perf_event_attr : Ok
[root@quaco ~]#

- Arnaldo

Signature · 1 line
- Arnaldo
Signature · 1 line
- Arnaldo
#4 lore raw

Em Tue, Feb 05, 2019 at 10:08:43AM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 17 lines

Em Tue, Feb 05, 2019 at 10:02:14AM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 16 lines

Em Mon, Feb 04, 2019 at 09:37:38PM +0100, Jiri Olsa escreveu:

Quoted 5 lines · Arnaldo Carvalho de Melo
Quoted 3 lines

Noticed this now when building with PYTHON=python3, can you take a look? For now I'm reinstalling python2-devel and building with it, i.e. removing that PYTHON=python3 make command line variable.

which Fedora are you on 29? I'm on 28

[acme@quaco ~]$ cat /etc/fedora-release
Fedora release 29 (Twenty Nine)

[acme@quaco tumbleweed]$ rpm -qa | grep python3 | wc -l 96
[acme@quaco tumbleweed]$ rpm -q python3-devel python3-devel-3.7.2-4.fc29.x86_64
[acme@quaco tumbleweed]$

Quoted 7 lines
Quoted 1 line

But it is a SyntaxError, so something simpler, looking up...

So python 3 needs to have that as:

except Unsup as obj:

How to make this work with both is what I'm trying to figure out now...

So, all this is fixed in perf/core already by:

commit 35ea7e4bbb89ecd32057f5f6a2a8feb0d7224e51

Author: Tony Jones <[email protected]>
Date:   Wed Jan 23 16:52:29 2019 -0800

perf script python: Add Python3 support to tests/attr.py

Support both Python 2 and Python 3 in tests/attr.py

The use of "except as" syntax implies the minimum supported Python2 version is now v2.6

------------------

So nevermind, sorry for the noise :-)

- Arnaldo

#5 lore raw
In reply to Jiri Olsa

Em Mon, Feb 04, 2019 at 09:37:38PM +0100, Jiri Olsa escreveu:

Quoted 28 lines · Arnaldo Carvalho de Melo
Quoted 4 lines

Noticed this now when building with PYTHON=python3, can you take a look? For now I'm reinstalling python2-devel and building with it, i.e. removing that PYTHON=python3 make command line variable.

Quoted 11 lines

[root@quaco ~]# perf test -v perf_event_attr
16: Setup struct perf_event_attr :
--- start ---
test child forked, pid 23937
File "/home/acme/libexec/perf-core/tests/attr.py", line 325
except Unsup, obj:
^
SyntaxError: invalid syntax
test child finished with -1
---- end ----
Setup struct perf_event_attr: FAILED!

hum, I built the same way like you 'make PYTHON=python3' [root@krava perf]# ldd ./perf | grep python

        libpython3.6m.so.1.0 => /lib64/libpython3.6m.so.1.0 (0x00007f4ca7cc4000)

and get 'Ok result'

[root@krava perf]# ./perf test attr
16: Setup struct perf_event_attr : Ok
48: Synthesize attr update : Ok

Quoted 6 lines

[root@krava perf]# python3 --version
Python 3.6.8
[root@krava perf]# rpm -qa | grep python3-devel
python3-devel-3.6.8-1.fc28.x86_64

which Fedora are you on 29? I'm on 28

I think you tested perf/core, that has Tony's fix to make 'perf test perf_event_attr' work with both python2 and python3, right?

While I was having that failure with perf/urgent.

I just cherry-picked:

commit 35ea7e4bbb89ecd32057f5f6a2a8feb0d7224e51

Author: Tony Jones <[email protected]>
Date:   Wed Jan 23 16:52:29 2019 -0800

perf script python: Add Python3 support to tests/attr.py

----------------------

And now my perf/urgent branch passes that 'perf test' entry with both python2 and 3.

- Arnaldo

#6 lore raw
Quoted 41 lines · Arnaldo Carvalho de Melo

Em Mon, Feb 04, 2019 at 09:37:38PM +0100, Jiri Olsa escreveu:

Quoted 28 lines · Arnaldo Carvalho de Melo
Quoted 4 lines

Noticed this now when building with PYTHON=python3, can you take a look? For now I'm reinstalling python2-devel and building with it, i.e. removing that PYTHON=python3 make command line variable.

Quoted 11 lines

[root@quaco ~]# perf test -v perf_event_attr
16: Setup struct perf_event_attr :
--- start ---
test child forked, pid 23937
File "/home/acme/libexec/perf-core/tests/attr.py", line 325
except Unsup, obj:
^
SyntaxError: invalid syntax
test child finished with -1
---- end ----
Setup struct perf_event_attr: FAILED!

hum, I built the same way like you 'make PYTHON=python3' [root@krava perf]# ldd ./perf | grep python

        libpython3.6m.so.1.0 => /lib64/libpython3.6m.so.1.0 (0x00007f4ca7cc4000)

and get 'Ok result'

[root@krava perf]# ./perf test attr
16: Setup struct perf_event_attr : Ok
48: Synthesize attr update : Ok

Quoted 6 lines

[root@krava perf]# python3 --version
Python 3.6.8
[root@krava perf]# rpm -qa | grep python3-devel
python3-devel-3.6.8-1.fc28.x86_64

which Fedora are you on 29? I'm on 28

I think you tested perf/core, that has Tony's fix to make 'perf test perf_event_attr' work with both python2 and python3, right?

While I was having that failure with perf/urgent.

Quoted 7 lines

I just cherry-picked:

commit 35ea7e4bbb89ecd32057f5f6a2a8feb0d7224e51

Author: Tony Jones <[email protected]>
Date:   Wed Jan 23 16:52:29 2019 -0800

perf script python: Add Python3 support to tests/attr.py

right, i was over latest perf/core

jirka

Quoted 8 lines

----------------------

And now my perf/urgent branch passes that 'perf test' entry with both python2 and 3.

- Arnaldo