• Tony Jones's avatar
    perf script python: Add Python3 support to tests/attr.py · 8f2f350c
    Tony Jones authored
    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
    
    Committer testing:
    
      $ make -C tools/perf PYTHON3=python install-bin
    
    Before:
    
      # perf test attr
      16: Setup struct perf_event_attr                          : FAILED!
      48: Synthesize attr update                                : Ok
      [root@quaco ~]# perf test -v attr
      16: Setup struct perf_event_attr                          :
      --- start ---
      test child forked, pid 3121
        File "/home/acme/libexec/perf-core/tests/attr.py", line 324
          except Unsup, obj:
                    ^
      SyntaxError: invalid syntax
      test child finished with -1
      ---- end ----
      Setup struct perf_event_attr: FAILED!
      48: Synthesize attr update                                :
      --- start ---
      test child forked, pid 3124
      test child finished with 0
      ---- end ----
      Synthesize attr update: Ok
      #
    
    After:
    
       # perf test attr
      16: Setup struct perf_event_attr                          : Ok
      48: Synthesize attr update                                : Ok
      #
    Signed-off-by: default avatarTony Jones <tonyj@suse.de>
    Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
    Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Jonathan Corbet <corbet@lwn.net>
    Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
    Cc: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
    Link: http://lkml.kernel.org/r/20190124005229.16146-7-tonyj@suse.deSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    8f2f350c
attr.py 11.4 KB