Linux DTrace development list
 help / color / mirror / Atom feed
From: Kris Van Hees <kris.van.hees@oracle.com>
To: Nick Alcock <nick.alcock@oracle.com>
Cc: dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com,
	kris.van.hees@oracle.com
Subject: Re: [PATCH v2 9/9] test: work when relocated
Date: Fri, 2 Aug 2024 01:32:44 -0400	[thread overview]
Message-ID: <ZqxvfAn3RDFiOU/c@oracle.com> (raw)
In-Reply-To: <20240801132156.286780-10-nick.alcock@oracle.com>

On Thu, Aug 01, 2024 at 02:21:56PM +0100, Nick Alcock wrote:
> We do this by adding a variable to the pkg-config files that points at
> the dtrace binary, then using that.  To make this work when the prefix
> is changed, runtest.sh sets its own PKG_CONFIG_PATH to a directory
> relative to the testsuite.  This will fail if the pkg-config install
> path is also changed, but in that case presumably the person installing
> it has arranged for pkg-config to find the pkg-config files in the
> installed location.  Fix a couple of tests that are assuming the
> location of the dtrace binary can be used to determine whether the
> installed testsuite is in use.
> 
> Signed-off-by: Nick Alcock <nick.alcock@oracle.com>

Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>

> ---
>  runtest.sh                           | 13 +++++++++++--
>  test/unittest/usdt/tst.manyprocs.sh  |  2 +-
>  test/unittest/usdt/tst.multitrace.sh |  2 +-
>  uts/Build                            |  3 ++-
>  uts/dtrace.pc.in                     |  1 +
>  uts/dtrace_sdt.pc.in                 |  1 +
>  6 files changed, 17 insertions(+), 5 deletions(-)
> 
> diff --git a/runtest.sh b/runtest.sh
> index 16a1a77bd394..792b2f4f25c7 100755
> --- a/runtest.sh
> +++ b/runtest.sh
> @@ -18,6 +18,7 @@ shopt -s nullglob extglob
>  unset CDPATH
>  unset POSIXLY_CORRECT  # Interferes with 'wait'
>  export LC_COLLATE="C"
> +export dtrace="/usr/sbin/dtrace"
>  
>  arch="$(uname -m)"
>  
> @@ -574,7 +575,15 @@ if [[ -z $USE_INSTALLED ]]; then
>      export dtprobed_pid=$!
>      ZAPTHESE+=($dtprobed_pid)
>  else
> -    dtrace="/usr/sbin/dtrace"
> +    # If we don't have a pkg-config path, try to point at a plausible
> +    # one given DTrace's default install paths.  This will fail if
> +    # the pkg-config path is changed as well: in that case, presumably
> +    # the person changing that path has pointed pkg-config at it anyway.
> +    if [[ -z $PKG_CONFIG_PATH ]]; then
> +        export PKG_CONFIG_PATH="$(pwd)/../../../share/pkgconfig"
> +    fi
> +
> +    dtrace="$(pkg-config --variable=dtrace dtrace)"
>      test_libdir="installed"
>      test_ldflags=""
>      test_cppflags="-DARCH_$arch $(pkg-config --cflags dtrace_sdt) $(pkg-config --cflags dtrace)"
> @@ -584,8 +593,8 @@ else
>          exit 1
>      fi
>  fi
> -export dtrace
>  export test_cppflags
> +export test_libdir
>  
>  # Figure out if the preprocessor supports -fno-diagnostics-show-option: if it
>  # does, add a bunch of options designed to make GCC output look like it used
> diff --git a/test/unittest/usdt/tst.manyprocs.sh b/test/unittest/usdt/tst.manyprocs.sh
> index a899470dfa0e..f820ed231c38 100755
> --- a/test/unittest/usdt/tst.manyprocs.sh
> +++ b/test/unittest/usdt/tst.manyprocs.sh
> @@ -82,7 +82,7 @@ done
>  # should contain at most five or so DOFs, even though 512
>  # processes left stale DOF around.  (Allow up to ten in
>  # case the most recent cleanup is still underway.)
> -if [[ $dtrace != "/usr/sbin/dtrace" ]] && [[ -n $DTRACE_OPT_DOFSTASHPATH ]]; then
> +if [[ $test_libdir != "installed" ]] && [[ -n $DTRACE_OPT_DOFSTASHPATH ]]; then
>      NUMDOFS="$(find $DTRACE_OPT_DOFSTASHPATH/stash/dof -type f | wc -l)"
>      if [[ $NUMDOFS -gt 10 ]]; then
>  	echo "DOF stash contains too many old DOFs: $NUMDOFS" >&2
> diff --git a/test/unittest/usdt/tst.multitrace.sh b/test/unittest/usdt/tst.multitrace.sh
> index 84cf1e8caa54..dcabde620c03 100755
> --- a/test/unittest/usdt/tst.multitrace.sh
> +++ b/test/unittest/usdt/tst.multitrace.sh
> @@ -123,7 +123,7 @@ ONE=$!
>  # if re-executed with a newer version of dtprobed with incompatible
>  # parse state.  Overwrite the parsed DOF with crap first, to force
>  # a failure if it simply doesn't reparse at all.
> -if [[ $dtrace != "/usr/sbin/dtrace" ]] && [[ -n $dtprobed_pid ]]; then
> +if [[ $test_libdir != "installed" ]] && [[ -n $dtprobed_pid ]]; then
>      sleep 1
>      for parsed in $DTRACE_OPT_DOFSTASHPATH/stash/dof-pid/*/*/parsed/*; do
>  	echo 'a' > $parsed
> diff --git a/uts/Build b/uts/Build
> index 7948e9f2d084..181819410624 100644
> --- a/uts/Build
> +++ b/uts/Build
> @@ -37,6 +37,7 @@ install::
>  		(cd $(uts_DIR) && \
>  		    sed -e 's,@SDTINCLUDEDIR@,$(SDTINCLUDEDIR),g;' \
>  			-e 's,@INCLUDEDIR@,$(INCLUDEDIR),g;' \
> -			-e 's,@VERSION@,$(VERSION),g' < \
> +			-e 's,@VERSION@,$(VERSION),g;' \
> +			-e 's,@DTRACE@,$(SBINDIR)/dtrace,g' < \
>  			$${name}.in > $(INSTPKGCONFIGDIR)/$$name;) \
>  	done
> diff --git a/uts/dtrace.pc.in b/uts/dtrace.pc.in
> index 58aa46fc75c9..9977082c5a7c 100644
> --- a/uts/dtrace.pc.in
> +++ b/uts/dtrace.pc.in
> @@ -1,5 +1,6 @@
>  includedir = @INCLUDEDIR@
>  libdir = @LIBDIR@
> +dtrace = @DTRACE@
>  
>  Name: DTrace
>  Description: DTrace consumer headers
> diff --git a/uts/dtrace_sdt.pc.in b/uts/dtrace_sdt.pc.in
> index c5506f9355d9..32474bc3f75d 100644
> --- a/uts/dtrace_sdt.pc.in
> +++ b/uts/dtrace_sdt.pc.in
> @@ -1,4 +1,5 @@
>  sdtincludedir = @SDTINCLUDEDIR@
> +dtrace = @DTRACE@
>  
>  Name: DTrace SDT
>  Description: DTrace raw SDT headers
> -- 
> 2.46.0.277.ge12b8151ed

      reply	other threads:[~2024-08-02  5:32 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-01 13:21 [PATCH v2 0/9] relocatable DTrace Nick Alcock
2024-08-01 13:21 ` [PATCH v2 1/9] spec: install sdt*.h in /usr/lib64/dtrace/include/sys Nick Alcock
2024-08-02  5:23   ` Kris Van Hees
2024-08-01 13:21 ` [PATCH v2 2/9] build: initial pkg-config support Nick Alcock
2024-08-02  5:24   ` Kris Van Hees
2024-08-01 13:21 ` [PATCH v2 3/9] build: track configured vars Nick Alcock
2024-08-02  5:28   ` Kris Van Hees
2024-08-01 13:21 ` [PATCH v2 4/9] build: --bindir is supposed to be equivalent to --sbindir Nick Alcock
2024-08-02  5:28   ` Kris Van Hees
2024-08-01 13:21 ` [PATCH v2 5/9] build: the TESTDIR is relative to the LIBDIR by default Nick Alcock
2024-08-02  5:29   ` Kris Van Hees
2024-08-01 13:21 ` [PATCH v2 6/9] build: add a pkg-config file for dtrace consumers: use it Nick Alcock
2024-08-02  5:30   ` Kris Van Hees
2024-08-01 13:21 ` [PATCH v2 7/9] runtest: remove obsolete kernel coverage data collection Nick Alcock
2024-08-02  5:31   ` Kris Van Hees
2024-08-01 13:21 ` [PATCH v2 8/9] build: make dtrace and dtprobed relocatable Nick Alcock
2024-08-02  5:31   ` Kris Van Hees
2024-08-01 13:21 ` [PATCH v2 9/9] test: work when relocated Nick Alcock
2024-08-02  5:32   ` Kris Van Hees [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZqxvfAn3RDFiOU/c@oracle.com \
    --to=kris.van.hees@oracle.com \
    --cc=dtrace-devel@oss.oracle.com \
    --cc=dtrace@lists.linux.dev \
    --cc=nick.alcock@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox