lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAP-5=fX46C2A22B1TBSgNb0BR1BumvqQeZvaFbU=9OqHmYPqrQ@mail.gmail.com>
Date: Wed, 1 Oct 2025 07:55:12 -0700
From: Ian Rogers <irogers@...gle.com>
To: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>, 
	Namhyung Kim <namhyung@...nel.org>, 
	Alexander Shishkin <alexander.shishkin@...ux.intel.com>, Jiri Olsa <jolsa@...nel.org>, 
	Adrian Hunter <adrian.hunter@...el.com>, James Clark <james.clark@...aro.org>, 
	Collin Funk <collin.funk1@...il.com>, Ravi Bangoria <ravi.bangoria@....com>, 
	linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org
Subject: Re: [PATCH v1 1/2] perf test: Add an 'import perf' test shell script

On Wed, Oct 1, 2025 at 6:42 AM Arnaldo Carvalho de Melo <acme@...nel.org> wrote:
>
> On Tue, Sep 30, 2025 at 01:02:55PM -0700, Ian Rogers wrote:
> > On Wed, Sep 3, 2025 at 11:42 AM Ian Rogers <irogers@...gle.com> wrote:
> > >
> > > The 'import perf' test needs to set up a path to the python module as
> > > well as to know the python command to invoke. These are hard coded at
> > > build time to be build a directory and the python used in the build,
> > > which is less than desirable. Avoid the hard coded values by reusing
> > > the existing shell script python setup and determine a potential built
> > > python module via the path of the perf executable.
> > >
> > > Signed-off-by: Ian Rogers <irogers@...gle.com>
> >
> > Ping.
>
> There is another patch in this area to make it work, right?
>
> After applying this one I get a failure, only when I set PYTHONPATH it
> works:
>
> ⬢ [acme@...lbx perf-tools-next]$ export PYTHONPATH=/tmp/build/perf-tools-next/python_ext_build/lib/
> ⬢ [acme@...lbx perf-tools-next]$ perf test -v pytho
> Couldn't bump rlimit(MEMLOCK), failures may take place when creating BPF maps, etc
>  88: 'import perf' in python                                         : Ok
> ⬢ [acme@...lbx perf-tools-next]$

Hmm.. if you are running from the install directory then I guess the
assumption should be that the install bin directory is in the PATH,
lib in LD_LIBRARY_PATH and PYTHONPATH set up for the directory too? We
could have the script look for a python module going from ..../bin to
..../lib and fix the PYTHONPATH for you. Wdyyt?

Thanks,
Ian

> - Arnaldo
>
>
>
> > Thanks,
> > Ian
> >
> > > ---
> > >  tools/perf/tests/shell/python-use.sh | 36 ++++++++++++++++++++++++++++
> > >  1 file changed, 36 insertions(+)
> > >  create mode 100755 tools/perf/tests/shell/python-use.sh
> > >
> > > diff --git a/tools/perf/tests/shell/python-use.sh b/tools/perf/tests/shell/python-use.sh
> > > new file mode 100755
> > > index 000000000000..fd2ee5390060
> > > --- /dev/null
> > > +++ b/tools/perf/tests/shell/python-use.sh
> > > @@ -0,0 +1,36 @@
> > > +#!/bin/bash
> > > +# 'import perf' in python
> > > +# SPDX-License-Identifier: GPL-2.0
> > > +# Just test if we can load the python binding.
> > > +set -e
> > > +
> > > +shelldir=$(dirname "$0")
> > > +# shellcheck source=lib/setup_python.sh
> > > +. "${shelldir}"/lib/setup_python.sh
> > > +
> > > +MODULE_DIR=$(dirname "$(which perf)")/python
> > > +
> > > +if [ -d "$MODULE_DIR" ]
> > > +then
> > > +    CMD=$(cat <<EOF
> > > +import sys
> > > +sys.path.insert(0, '$MODULE_DIR')
> > > +import perf
> > > +print('success!')
> > > +EOF
> > > +    )
> > > +else
> > > +    CMD=$(cat <<EOF
> > > +import perf
> > > +print('success!')
> > > +EOF
> > > +    )
> > > +fi
> > > +
> > > +echo -e "Testing 'import perf' with:\n$CMD"
> > > +
> > > +if ! echo "$CMD" | $PYTHON | grep -q "success!"
> > > +then
> > > +  exit 1
> > > +fi
> > > +exit 0
> > > --
> > > 2.51.0.338.gd7d06c2dae-goog
> > >

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ