* [PATCH v2 0/9] relocatable DTrace
@ 2024-08-01 13:21 Nick Alcock
2024-08-01 13:21 ` [PATCH v2 1/9] spec: install sdt*.h in /usr/lib64/dtrace/include/sys Nick Alcock
` (8 more replies)
0 siblings, 9 replies; 19+ messages in thread
From: Nick Alcock @ 2024-08-01 13:21 UTC (permalink / raw)
To: dtrace, dtrace-devel; +Cc: kris.van.hees
This relatively simple patch series makes DTrace work with non-default
(s)bindir, libdir, includedir (changing the other installation-directory
variables largely worked already).
We add a pkg-config file named dtrace.pc for the consumer headers
<dtrace.h> and <sys/dtrace.h> and for libdtrace.so: I expect there are
no users of these outside DTrace proper at all right now, but providing
this means we can point future users at a suitable pkg-config file so
they can automatically adapt to dtraces installed wherever you please.
There is one wrinkle, which is that the udev and (especially) systemd
service files for dtprobed have to be installed somewhere where udev and
systemd can see them. We emit a warning if they don't end up in either
of the two fixed locations where systemd looks for such things, unless
the user has explicitly passed in --with-systemd-unit-dir=, in which
case we presume that the user is doing that because they know that their
systemd is looking somewhere else too and is pointing the DTrace build
system at it.
(We add an extra makefile target to allow users to forcibly install the
systemd service file even if we have not installed it by default because
we think that it won't be used. Users/distributors installing DTrace in
--prefix=/usr or --prefix=/usr/local will never need to worry about any
of this: in these cases we install the service file as before because we
know that systemd will find it).
(The first of these patches has already been submitted on its own,
but this series relies on it so I thought it might be clearest to
resubmit it as part of this series too.)
(Multiple test runs with non-default values of prefix, sbindir, libdir,
includedir, and systemd-unit-dir passed OK with no failures I can
attribute to relocating things.)
Changes since v1:
As requested by reviews: in particular, runtest.conf is gone,
and we rely on pkg-config to find the dtrace binary when the
installed testsuite is run.
Nick Alcock (9):
spec: install sdt*.h in /usr/lib64/dtrace/include/sys
build: initial pkg-config support
build: track configured vars
build: --bindir is supposed to be equivalent to --sbindir
build: the TESTDIR is relative to the LIBDIR by default
build: add a pkg-config file for dtrace consumers: use it
runtest: remove obsolete kernel coverage data collection
build: make dtrace and dtprobed relocatable
test: work when relocated
GNUmakefile | 6 +--
Maketargets | 3 ++
cmd/Build | 4 +-
configure | 11 ++---
dtprobed/Build | 36 ++++++++++++----
.../{dtprobed.service => dtprobed.service.in} | 2 +-
dtrace.spec | 23 ++++------
runtest.conf.example | 10 -----
runtest.sh | 43 ++++++-------------
test/unittest/usdt/tst.manyprocs.sh | 2 +-
test/unittest/usdt/tst.multitrace.sh | 2 +-
uts/Build | 17 +++++++-
uts/dtrace.pc.in | 9 ++++
uts/dtrace_sdt.pc.in | 7 +++
14 files changed, 97 insertions(+), 78 deletions(-)
rename dtprobed/{dtprobed.service => dtprobed.service.in} (95%)
delete mode 100644 runtest.conf.example
create mode 100644 uts/dtrace.pc.in
create mode 100644 uts/dtrace_sdt.pc.in
--
2.46.0.277.ge12b8151ed
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v2 1/9] spec: install sdt*.h in /usr/lib64/dtrace/include/sys
2024-08-01 13:21 [PATCH v2 0/9] relocatable DTrace Nick Alcock
@ 2024-08-01 13:21 ` 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
` (7 subsequent siblings)
8 siblings, 1 reply; 19+ messages in thread
From: Nick Alcock @ 2024-08-01 13:21 UTC (permalink / raw)
To: dtrace, dtrace-devel; +Cc: kris.van.hees
This is the specfile part of the sdt.h move, rendered more
complex by the need to clean up the mess left behind by the
old sdt.h renaming.
Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
---
dtrace.spec | 22 +++++++---------------
1 file changed, 7 insertions(+), 15 deletions(-)
diff --git a/dtrace.spec b/dtrace.spec
index 42ea9bc33958..28eeaa478376 100644
--- a/dtrace.spec
+++ b/dtrace.spec
@@ -86,8 +86,6 @@ BuildRequires: binutils-devel >= 2.30-58.0.8
Requires: libdtrace-ctf >= 1.1.0
BuildRequires: libdtrace-ctf-devel >= 1.1.0
%endif
-Conflicts: systemtap-sdt-devel
-Provides: systemtap-sdt-devel
Summary: DTrace user interface.
Version: 2.0.1
Release: 0%{?dist}
@@ -194,11 +192,6 @@ make DESTDIR=$RPM_BUILD_ROOT VERSION=%{version} \
sed -i '/^ProtectSystem=/d; /^ProtectControlGroups=/d; /^RuntimeDirectory/d;' $RPM_BUILD_ROOT/usr/lib/systemd/system/dtprobed.service
%endif
-# Because systemtap creates a sdt.h header file we have to rename
-# ours and then shift theirs out of the way.
-mv $RPM_BUILD_ROOT/usr/include/sys/sdt.h \
- $RPM_BUILD_ROOT/usr/include/sys/sdt-dtrace.h
-
%clean
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
rm -rf $RPM_BUILD_DIR/%{name}-%{version}
@@ -222,13 +215,14 @@ if [ $1 -ge 2 ] ; then
%systemd_postun_with_restart dtprobed.service
fi
-# if sdt-systemtap.h doesn't exist then we can move the existing dtrace sdt.h
+# Clean up the mess left behind by previous installations' overwriting
+# of systemtap's sdt.h: if an sdt-systemtap.h exists and is a regular
+# file, move it back to sdt.h. (RPM itself will identify and delete
+# all the other debris.)
+
SYSINCDIR=/usr/include/sys
-if [ -e $SYSINCDIR/sdt.h -a ! -e $SYSINCDIR/sdt-systemtap.h ]; then
- mv $SYSINCDIR/sdt.h $SYSINCDIR/sdt-systemtap.h
- ln -s $SYSINCDIR/sdt-dtrace.h $SYSINCDIR/sdt.h
-elif [ ! -e $SYSINCDIR/sdt.h ]; then
- ln -s $SYSINCDIR/sdt-dtrace.h $SYSINCDIR/sdt.h
+if [ -f $SYSINCDIR/sdt-systemtap.h ]; then
+ mv -f $SYSINCDIR/sdt-systemtap.h $SYSINCDIR/sdt.h
fi
%preun
@@ -253,8 +247,6 @@ systemctl start dtprobed || :
%{_sbindir}/dtrace
%{_sbindir}/dtprobed
%{_mandir}/man8/dtrace.8.gz
-%{_includedir}/sys/sdt-dtrace.h
-%{_includedir}/sys/sdt_internal.h
%doc %{_docdir}/dtrace-%{version}/*
%{_unitdir}/dtprobed.service
%{_unitdir}/dtrace-usdt.target
--
2.46.0.277.ge12b8151ed
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v2 2/9] build: initial pkg-config support
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-01 13:21 ` 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
` (6 subsequent siblings)
8 siblings, 1 reply; 19+ messages in thread
From: Nick Alcock @ 2024-08-01 13:21 UTC (permalink / raw)
To: dtrace, dtrace-devel; +Cc: kris.van.hees
This initial pkg-config file, dtrace_sdt.pc, points at the location
of the sdt.h include file. We immediately use it in make check in the
installed testsuite, compensating for any install-time changes in the
location of the dtrace libdir.
Further changes will be forthcoming to properly support relocatable
installation.
Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
---
GNUmakefile | 2 ++
configure | 2 ++
dtrace.spec | 1 +
runtest.sh | 2 +-
uts/Build | 14 +++++++++++++-
uts/dtrace_sdt.pc.in | 6 ++++++
6 files changed, 25 insertions(+), 2 deletions(-)
create mode 100644 uts/dtrace_sdt.pc.in
diff --git a/GNUmakefile b/GNUmakefile
index b1109727dc66..0fc9b3b5e85c 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -100,6 +100,8 @@ DOCDIR = $(prefix)/share/doc/dtrace-$(VERSION)
INSTDOCDIR = $(DESTDIR)$(DOCDIR)
MANDIR = $(prefix)/share/man/man8
INSTMANDIR = $(DESTDIR)$(MANDIR)
+PKGCONFIGDIR = $(prefix)/share/pkgconfig
+INSTPKGCONFIGDIR = $(DESTDIR)$(PKGCONFIGDIR)
TESTDIR = $(prefix)/lib$(BITNESS)/dtrace/testsuite
INSTTESTDIR = $(DESTDIR)$(TESTDIR)
TARGETS =
diff --git a/configure b/configure
index c423bc82b763..462548bcc69c 100755
--- a/configure
+++ b/configure
@@ -60,6 +60,7 @@ Installation paths:
--sbindir=PREFIX/sbin Alias for --bindir
--includedir=PREFIX/include #include directory
--mandir=PREFIX/share/man/man8 Manpage directory
+--pkg-config-dir=PREFIX/share/pkgconfig Pkg-config directory
--udevdir=PREFIX/lib/udev/rules.d udev rules directory
--systemd-unit-dir=PREFIX/lib/systemd/system systemd unit directory
--docdir=PREFIX/share/doc/dtrace Documentation directory
@@ -130,6 +131,7 @@ for option in "$@"; do
--systemd-unit-dir=*) write_make_var SYSTEMDUNITDIR "$option";;
--docdir=*) write_make_var DOCDIR "$option";;
--mandir=*) write_make_var MANDIR "$option";;
+ --pkg-config-dir=*) write_make_var PKGCONFIGDIR "$option";;
--testdir=*) write_make_var TESTDIR "$option";;
CC=*) write_make_var CC "$option";;
CPP=*) write_make_var PREPROCESS "$option";;
diff --git a/dtrace.spec b/dtrace.spec
index 28eeaa478376..1887fcadaed6 100644
--- a/dtrace.spec
+++ b/dtrace.spec
@@ -246,6 +246,7 @@ systemctl start dtprobed || :
%{_libdir}/libdtrace.so.*
%{_sbindir}/dtrace
%{_sbindir}/dtprobed
+%{_datadir}/pkgconfig/dtrace_sdt.pc
%{_mandir}/man8/dtrace.8.gz
%doc %{_docdir}/dtrace-%{version}/*
%{_unitdir}/dtprobed.service
diff --git a/runtest.sh b/runtest.sh
index 3bcd676ea788..cc9703e12c16 100755
--- a/runtest.sh
+++ b/runtest.sh
@@ -579,7 +579,7 @@ else
dtrace="/usr/sbin/dtrace"
test_libdir="installed"
test_ldflags=""
- test_cppflags="-DARCH_$arch -I/usr/lib64/dtrace/include"
+ test_cppflags="-DARCH_$arch $(pkg-config --cflags dtrace_sdt)"
if [[ ! -x $dtrace ]]; then
echo "$dtrace not available." >&2
diff --git a/uts/Build b/uts/Build
index 864b2dfdacbf..feafa21369f2 100644
--- a/uts/Build
+++ b/uts/Build
@@ -14,11 +14,16 @@ SYS_HEADERS_INSTALL := common/sys/dtrace.h \
# sdt*.h are used by programs that contain USDT probes that want to define
# probes by hand rather than using dtrace -h. SystemTap has another header
-# with the same name, so we install these out of the way.
+# with the same name, so we install these out of the way and provide a
+# pkg-config file to pull them in.
PROBE_HEADERS_INSTALL := common/sys/sdt.h \
common/sys/sdt_internal.h
+# The pkg-config files undergo a few translations with sed before installation.
+
+SHARE_PKG_CONFIG_INSTALL := dtrace_sdt.pc
+
install::
mkdir -p $(INSTINCLUDEDIR)/sys
$(call describe-install-target,$(INSTINCLUDEDIR)/sys,$(notdir $(SYS_HEADERS_INSTALL)))
@@ -26,3 +31,10 @@ install::
mkdir -p $(INSTSDTINCLUDEDIR)/sys
$(call describe-install-target,$(INSTSDTINCLUDEDIR)/sys,$(notdir $(PROBE_HEADERS_INSTALL)))
cd $(uts_DIR) && install -m 644 $(PROBE_HEADERS_INSTALL) $(INSTSDTINCLUDEDIR)/sys
+ mkdir -p $(INSTPKGCONFIGDIR)
+ $(call describe-install-target,$(INSTPKGCONFIGDIR),$(SHARE_PKG_CONFIG_INSTALL))
+ for name in $(SHARE_PKG_CONFIG_INSTALL); do \
+ cd $(uts_DIR) && \
+ sed 's,@SDTINCLUDEDIR@,$(SDTINCLUDEDIR),g; s,@VERSION@,$(VERSION),g' < \
+ $${name}.in > $(INSTPKGCONFIGDIR)/$$name; \
+ done
diff --git a/uts/dtrace_sdt.pc.in b/uts/dtrace_sdt.pc.in
new file mode 100644
index 000000000000..c5506f9355d9
--- /dev/null
+++ b/uts/dtrace_sdt.pc.in
@@ -0,0 +1,6 @@
+sdtincludedir = @SDTINCLUDEDIR@
+
+Name: DTrace SDT
+Description: DTrace raw SDT headers
+Version: @VERSION@
+Cflags: -I${sdtincludedir}
--
2.46.0.277.ge12b8151ed
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v2 3/9] build: track configured vars
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-01 13:21 ` [PATCH v2 2/9] build: initial pkg-config support Nick Alcock
@ 2024-08-01 13:21 ` 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
` (5 subsequent siblings)
8 siblings, 1 reply; 19+ messages in thread
From: Nick Alcock @ 2024-08-01 13:21 UTC (permalink / raw)
To: dtrace, dtrace-devel; +Cc: kris.van.hees
This lets the build system determine whether a variable was
explicitly set via ./configure (the assumption being that
if you set something explicitly, you knew what you were doing,
so e.g. if you set the --systemd-unit-dir to /foo/bar, you
have also arranged for systemd to look there for unit files,
so the build system can install the systemd unit files there
on the assumption that they will work).
Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
---
configure | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/configure b/configure
index 462548bcc69c..fb9a45cda1b7 100755
--- a/configure
+++ b/configure
@@ -17,13 +17,12 @@ write_make_var()
{
local val="$(printf "%s" "$2" | sed 's,^.*=,,')"
- [[ ! -d build ]] && mkdir -p build
-
if [[ ! -f build/.config-vars.mk.new ]]; then
echo '# This file is automatically generated.' > build/.config-vars.mk.new
fi
printf '%s=%s\n' $1 "$val" >> build/.config-vars.mk.new
+ printf "override CONFIGURED_VARS+=%s\n" $1 >> build/.config-vars.mk.new
}
# Write out build/.config/*.mk and build/.config/*.h, which are the same
@@ -115,7 +114,9 @@ above stick for future make invocations until "make clean".
EOF
}
+[[ ! -d build ]] && mkdir -p build
rm -rf build/.config.new build/.config-vars.mk.new
+echo 'override CONFIGURED_VARS=' > build/.config-vars.mk.new
trap 'rm -rf build/.config.new build/.config-vars.mk.new' ERR
for option in "$@"; do
@@ -173,8 +174,6 @@ done
echo 'Writing build/config-vars.mk'
rm -f build/config-vars.mk
-[[ ! -f build/.config-vars.mk.new ]] && \
- touch build/config-vars.mk
mv -f build/.config-vars.mk.new build/config-vars.mk
rm -rf build/.config
--
2.46.0.277.ge12b8151ed
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v2 4/9] build: --bindir is supposed to be equivalent to --sbindir
2024-08-01 13:21 [PATCH v2 0/9] relocatable DTrace Nick Alcock
` (2 preceding siblings ...)
2024-08-01 13:21 ` [PATCH v2 3/9] build: track configured vars Nick Alcock
@ 2024-08-01 13:21 ` 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
` (4 subsequent siblings)
8 siblings, 1 reply; 19+ messages in thread
From: Nick Alcock @ 2024-08-01 13:21 UTC (permalink / raw)
To: dtrace, dtrace-devel; +Cc: kris.van.hees
The configure script said as much, but actually it set a
BINDIR variable that was never used for anything.
Fix this.
Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
---
GNUmakefile | 2 --
configure | 2 +-
2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/GNUmakefile b/GNUmakefile
index 0fc9b3b5e85c..5903a8e355f6 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -82,8 +82,6 @@ prefix ?= /usr
export objdir := $(abspath build)
LIBDIR = $(prefix)/lib$(BITNESS)
INSTLIBDIR = $(DESTDIR)$(LIBDIR)
-BINDIR = $(prefix)/bin
-INSTBINDIR = $(DESTDIR)$(BINDIR)
INCLUDEDIR = $(prefix)/include
INSTINCLUDEDIR = $(DESTDIR)$(INCLUDEDIR)
SDTINCLUDEDIR = $(LIBDIR)/dtrace/include
diff --git a/configure b/configure
index fb9a45cda1b7..4026a3eafcd3 100755
--- a/configure
+++ b/configure
@@ -125,7 +125,7 @@ for option in "$@"; do
--prefix=*) write_make_var prefix "$option";;
--objdir=*) write_make_var objdir "$option";;
--libdir=*) write_make_var LIBDIR "$option";;
- --bindir=*) write_make_var BINDIR "$option";;
+ --bindir=*) write_make_var SBINDIR "$option";;
--sbindir=*) write_make_var SBINDIR "$option";;
--includedir=*) write_make_var INCLUDEDIR "$option";;
--udevdir=*) write_make_var UDEVDIR "$option";;
--
2.46.0.277.ge12b8151ed
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v2 5/9] build: the TESTDIR is relative to the LIBDIR by default
2024-08-01 13:21 [PATCH v2 0/9] relocatable DTrace Nick Alcock
` (3 preceding siblings ...)
2024-08-01 13:21 ` [PATCH v2 4/9] build: --bindir is supposed to be equivalent to --sbindir Nick Alcock
@ 2024-08-01 13:21 ` 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
` (3 subsequent siblings)
8 siblings, 1 reply; 19+ messages in thread
From: Nick Alcock @ 2024-08-01 13:21 UTC (permalink / raw)
To: dtrace, dtrace-devel; +Cc: kris.van.hees
If users change the LIBDIR but not the TESTDIR, the TESTDIR
is meant to follow it, but wasn't.
Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
---
GNUmakefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/GNUmakefile b/GNUmakefile
index 5903a8e355f6..e7657d466df5 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -100,7 +100,7 @@ MANDIR = $(prefix)/share/man/man8
INSTMANDIR = $(DESTDIR)$(MANDIR)
PKGCONFIGDIR = $(prefix)/share/pkgconfig
INSTPKGCONFIGDIR = $(DESTDIR)$(PKGCONFIGDIR)
-TESTDIR = $(prefix)/lib$(BITNESS)/dtrace/testsuite
+TESTDIR = $(LIBDIR)/dtrace/testsuite
INSTTESTDIR = $(DESTDIR)$(TESTDIR)
TARGETS =
--
2.46.0.277.ge12b8151ed
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v2 6/9] build: add a pkg-config file for dtrace consumers: use it
2024-08-01 13:21 [PATCH v2 0/9] relocatable DTrace Nick Alcock
` (4 preceding siblings ...)
2024-08-01 13:21 ` [PATCH v2 5/9] build: the TESTDIR is relative to the LIBDIR by default Nick Alcock
@ 2024-08-01 13:21 ` 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
` (2 subsequent siblings)
8 siblings, 1 reply; 19+ messages in thread
From: Nick Alcock @ 2024-08-01 13:21 UTC (permalink / raw)
To: dtrace, dtrace-devel; +Cc: kris.van.hees
This lets you relocate the include path anywhere you like: users of
<dtrace.h> et al should invoke $(pkg-config --cflags dtrace) and
$(pkg-config --libs dtrace) to get the dtrace consumer header directory and
-ldtrace invocation for linking.
Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
---
runtest.sh | 2 +-
uts/Build | 10 ++++++----
uts/dtrace.pc.in | 8 ++++++++
3 files changed, 15 insertions(+), 5 deletions(-)
create mode 100644 uts/dtrace.pc.in
diff --git a/runtest.sh b/runtest.sh
index cc9703e12c16..817f4a90487d 100755
--- a/runtest.sh
+++ b/runtest.sh
@@ -579,7 +579,7 @@ else
dtrace="/usr/sbin/dtrace"
test_libdir="installed"
test_ldflags=""
- test_cppflags="-DARCH_$arch $(pkg-config --cflags dtrace_sdt)"
+ test_cppflags="-DARCH_$arch $(pkg-config --cflags dtrace_sdt) $(pkg-config --cflags dtrace)"
if [[ ! -x $dtrace ]]; then
echo "$dtrace not available." >&2
diff --git a/uts/Build b/uts/Build
index feafa21369f2..7948e9f2d084 100644
--- a/uts/Build
+++ b/uts/Build
@@ -22,7 +22,7 @@ PROBE_HEADERS_INSTALL := common/sys/sdt.h \
# The pkg-config files undergo a few translations with sed before installation.
-SHARE_PKG_CONFIG_INSTALL := dtrace_sdt.pc
+SHARE_PKG_CONFIG_INSTALL := dtrace.pc dtrace_sdt.pc
install::
mkdir -p $(INSTINCLUDEDIR)/sys
@@ -34,7 +34,9 @@ install::
mkdir -p $(INSTPKGCONFIGDIR)
$(call describe-install-target,$(INSTPKGCONFIGDIR),$(SHARE_PKG_CONFIG_INSTALL))
for name in $(SHARE_PKG_CONFIG_INSTALL); do \
- cd $(uts_DIR) && \
- sed 's,@SDTINCLUDEDIR@,$(SDTINCLUDEDIR),g; s,@VERSION@,$(VERSION),g' < \
- $${name}.in > $(INSTPKGCONFIGDIR)/$$name; \
+ (cd $(uts_DIR) && \
+ sed -e 's,@SDTINCLUDEDIR@,$(SDTINCLUDEDIR),g;' \
+ -e 's,@INCLUDEDIR@,$(INCLUDEDIR),g;' \
+ -e 's,@VERSION@,$(VERSION),g' < \
+ $${name}.in > $(INSTPKGCONFIGDIR)/$$name;) \
done
diff --git a/uts/dtrace.pc.in b/uts/dtrace.pc.in
new file mode 100644
index 000000000000..58aa46fc75c9
--- /dev/null
+++ b/uts/dtrace.pc.in
@@ -0,0 +1,8 @@
+includedir = @INCLUDEDIR@
+libdir = @LIBDIR@
+
+Name: DTrace
+Description: DTrace consumer headers
+Version: @VERSION@
+Cflags: -I${includedir}
+Libs: -L${libdir} -ldtrace
--
2.46.0.277.ge12b8151ed
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v2 7/9] runtest: remove obsolete kernel coverage data collection
2024-08-01 13:21 [PATCH v2 0/9] relocatable DTrace Nick Alcock
` (5 preceding siblings ...)
2024-08-01 13:21 ` [PATCH v2 6/9] build: add a pkg-config file for dtrace consumers: use it Nick Alcock
@ 2024-08-01 13:21 ` 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-01 13:21 ` [PATCH v2 9/9] test: work when relocated Nick Alcock
8 siblings, 1 reply; 19+ messages in thread
From: Nick Alcock @ 2024-08-01 13:21 UTC (permalink / raw)
To: dtrace, dtrace-devel; +Cc: kris.van.hees
The DTrace kernel module is long dead: we don't need kernel coverage any
more. Delete the example runtest.conf as well, and drop loading it, since
it served no purpose but to point to the kernel tree used for coverage.
Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
---
runtest.conf.example | 10 ----------
runtest.sh | 28 ----------------------------
2 files changed, 38 deletions(-)
delete mode 100644 runtest.conf.example
diff --git a/runtest.conf.example b/runtest.conf.example
deleted file mode 100644
index c92aa6b96cff..000000000000
--- a/runtest.conf.example
+++ /dev/null
@@ -1,10 +0,0 @@
-# Test configuration file.
-#
-# Copy this file to runtest.conf and edit it.
-
-# Kernel build directory.
-#
-# If this is not specified, kernel test coverage information will not
-# be available.
-
-# KERNEL_BUILD_DIR=
diff --git a/runtest.sh b/runtest.sh
index 817f4a90487d..16a1a77bd394 100755
--- a/runtest.sh
+++ b/runtest.sh
@@ -21,8 +21,6 @@ export LC_COLLATE="C"
arch="$(uname -m)"
-[[ -f ./runtest.conf ]] && . ./runtest.conf
-
load_modules()
{
# If running as root, pull in appropriate modules
@@ -644,15 +642,6 @@ if [[ -n $NOBADDOF ]]; then
--quiet -o $logdir/coverage/initial.lcov 2>/dev/null
fi
done
-
- if [[ -n $KERNEL_BUILD_DIR ]] && [[ -d $KERNEL_BUILD_DIR ]] &&
- [[ -d /sys/kernel/debug/gcov/$KERNEL_BUILD_DIR/kernel/dtrace ]]; then
- rm -rf $KERNEL_BUILD_DIR/coverage
- mkdir -p $KERNEL_BUILD_DIR/coverage
- lcov --zerocounters --quiet
- lcov --capture --base-directory $KERNEL_BUILD_DIR --initial \
- --quiet -o $KERNEL_BUILD_DIR/coverage/initial.lcov 2>/dev/null
- fi
fi
load_modules
@@ -1592,23 +1581,6 @@ for name in build*; do
fi
done
-if [[ -n $KERNEL_BUILD_DIR ]] && [[ -d $KERNEL_BUILD_DIR ]] &&
- [[ -d /sys/kernel/debug/gcov/$KERNEL_BUILD_DIR/kernel/dtrace ]]; then
- force_out "Coverage info for kernel:\n"
-
- lcov --capture --base-directory $KERNEL_BUILD_DIR \
- --quiet -o $KERNEL_BUILD_DIR/coverage/coverage.lcov
- lcov --add-tracefile $KERNEL_BUILD_DIR/coverage/initial.lcov \
- --add-tracefile $KERNEL_BUILD_DIR/coverage/coverage.lcov \
- --quiet -o $KERNEL_BUILD_DIR/coverage/coverage.lcov
-
- genhtml --frames --show-details -o $KERNEL_BUILD_DIR/coverage \
- --title "DTrace kernel coverage" --highlight --legend \
- $KERNEL_BUILD_DIR/coverage/coverage.lcov | \
- awk 'BEGIN { quiet=1; } { if (!quiet) { print ($0); } } /^Overall coverage rate:$/ { quiet=0; }' | \
- tee -a $LOGFILE $SUMFILE
-fi
-
if [[ -n $ERRORS ]]; then
exit 1
fi
--
2.46.0.277.ge12b8151ed
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v2 8/9] build: make dtrace and dtprobed relocatable
2024-08-01 13:21 [PATCH v2 0/9] relocatable DTrace Nick Alcock
` (6 preceding siblings ...)
2024-08-01 13:21 ` [PATCH v2 7/9] runtest: remove obsolete kernel coverage data collection Nick Alcock
@ 2024-08-01 13:21 ` 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
8 siblings, 1 reply; 19+ messages in thread
From: Nick Alcock @ 2024-08-01 13:21 UTC (permalink / raw)
To: dtrace, dtrace-devel; +Cc: kris.van.hees
The majority of the complexity here involves figuring out what to
do about the systemd service file. We presume that if the user
is installing such that the service file lands inone of the two fixed
locations systemd knows how to find persistent service files in, or
if the user has explicitly passed --systemd-unit-dir to configure,
it makes sense to install the systemd service file (because systemd
will find it): otherwise, we avoid installing it and print a
warning that the user must do so if dtprobed is to be properly
started.
Provide a new installation target, install-dtprobed-autostart, to do
so.
(Regardless, the service file is changed to substitute in the real
installed path of dtprobed.)
Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
---
Maketargets | 3 ++
cmd/Build | 4 +--
dtprobed/Build | 36 ++++++++++++++-----
.../{dtprobed.service => dtprobed.service.in} | 2 +-
4 files changed, 34 insertions(+), 11 deletions(-)
rename dtprobed/{dtprobed.service => dtprobed.service.in} (95%)
diff --git a/Maketargets b/Maketargets
index 11ad9fed4dcf..5b4906a86d26 100644
--- a/Maketargets
+++ b/Maketargets
@@ -14,6 +14,9 @@ help::
@printf "dlibs Build translator files\n" >&2
@printf "install Install (DESTDIR supported)\n" >&2
@printf "install-test Install testsuite (DESTDIR supported)\n" >&2
+ @printf "install-dtprobed-autostart Install udev / systemd rules to start dtprobed" >&2
+ @printf " (done by make install unless prefix or sbindir" >&2
+ @printf " are changed)" >&2
@printf "clean / realclean Clean up build tree\n" >&2
@printf "TAGS / tags / gtags Make tags files\n" >&2
@printf "\n" >&2
diff --git a/cmd/Build b/cmd/Build
index 55c622c19dc0..68800fbeb5fc 100644
--- a/cmd/Build
+++ b/cmd/Build
@@ -1,5 +1,5 @@
# Oracle Linux DTrace.
-# Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
# Licensed under the Universal Permissive License v 1.0 as shown at
# http://oss.oracle.com/licenses/upl.
@@ -36,7 +36,7 @@ if [[ -z \$$_DTRACE_CHECK_INSTALLED ]]; then\n\
export LD_LIBRARY_PATH=$(objdir)\n\
dtrace_cmd=$(objdir)/dtrace\n\
else\n\
- dtrace_cmd=/usr/sbin/dtrace\n\
+ dtrace_cmd=$(SBINDIR)/dtrace\n\
fi\n\
\n\
if [[ -n \$$DTRACE_GDB ]]; then\n\
diff --git a/dtprobed/Build b/dtprobed/Build
index 0f5d1c08aee8..9132c3e31c8a 100644
--- a/dtprobed/Build
+++ b/dtprobed/Build
@@ -42,17 +42,13 @@ dtprobed.c_CFLAGS := -Wno-pedantic
seccomp-assistance.c_CFLAGS := -fno-lto
endif
-install::
- mkdir -p $(INSTSBINDIR)
- $(call describe-install-target,$(INSTSBINDIR),dtprobed)
- install -m 755 $(objdir)/dtprobed $(INSTSBINDIR)
- mkdir -p $(INSTUDEVDIR)
- $(call describe-install-target,$(INSTUDEVDIR),60-dtprobed.rules)
- install -m 644 $(dtprobed_DIR)60-dtprobed.rules $(INSTUDEVDIR)
+install-dtprobed-autostart::
ifdef HAVE_LIBSYSTEMD
mkdir -p $(INSTSYSTEMDUNITDIR) $(INSTSYSTEMDPRESETDIR)
$(call describe-install-target,$(INSTSYSTEMDUNITDIR),dtprobed.service)
- install -m 644 $(dtprobed_DIR)dtprobed.service $(INSTSYSTEMDUNITDIR)
+ sed 's,@SBINDIR@,$(SBINDIR),' < $(dtprobed_DIR)dtprobed.service.in > $(INSTSYSTEMDUNITDIR)/dtprobed.service
+ chown root:root $(INSTSYSTEMDUNITDIR)/dtprobed.service
+ chmod 0644 $(INSTSYSTEMDUNITDIR)/dtprobed.service
$(call describe-install-target,$(INSTSYSTEMDUNITDIR),dtrace-usdt.target)
install -m 644 $(dtprobed_DIR)dtrace-usdt.target $(INSTSYSTEMDUNITDIR)
$(call describe-install-target,$(INSTSYSTEMDPRESETDIR),50-dtprobed.preset)
@@ -61,3 +57,27 @@ ifdef HAVE_LIBSYSTEMD
systemctl enable dtprobed.service dtrace-usdt.target; \
fi
endif
+
+install::
+ mkdir -p $(INSTSBINDIR)
+ $(call describe-install-target,$(INSTSBINDIR),dtprobed)
+ install -m 755 $(objdir)/dtprobed $(INSTSBINDIR)
+ mkdir -p $(INSTUDEVDIR)
+ $(call describe-install-target,$(INSTUDEVDIR),60-dtprobed.rules)
+ install -m 644 $(dtprobed_DIR)60-dtprobed.rules $(INSTUDEVDIR)
+ if [[ "$(SYSTEMDUNITDIR)" = /usr/lib/systemd/system ]] || \
+ [[ "$(SYSTEMDUNITDIR)" = /usr/local/lib/systemd/system ]] || \
+ [[ -n "$(filter SYSTEMDUNITDIR,$(CONFIGURED_VARS))" ]] ; then \
+ $(MAKE) install-dtprobed-autostart; \
+ else \
+ echo " === WARNING WARNING WARNING === " >&2; \
+ echo "systemd service files for dtprobed not installed." >&2; \
+ echo "USDT probes (and the testsuite) will not work unless this is" >&2; \
+ echo "done. Try make install-dtprobed-autostart, but this may not" >&2; \
+ echo "be enough: you may need to manually move the systemd service" >&2; \
+ echo "files somewhere udev and systemd will find them." >&2; \
+ echo "If there is already a running dtprobed, it may or may not work" >&2; \
+ echo "in conjunction with this DTrace." >&2; \
+ echo "Configure with --systemd-unit-dir to override this decision." >&2; \
+ echo " === WARNING WARNING WARNING === " >&2; \
+ fi
diff --git a/dtprobed/dtprobed.service b/dtprobed/dtprobed.service.in
similarity index 95%
rename from dtprobed/dtprobed.service
rename to dtprobed/dtprobed.service.in
index 8e491fe28ad1..2e590701d03e 100644
--- a/dtprobed/dtprobed.service
+++ b/dtprobed/dtprobed.service.in
@@ -12,7 +12,7 @@ Before=basic.target
[Service]
Type=notify
-ExecStart=/usr/sbin/dtprobed -F
+ExecStart=@SBINDIR@/dtprobed -F
Restart=on-failure
RestartPreventExitStatus=1
ProtectSystem=strict
--
2.46.0.277.ge12b8151ed
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH v2 9/9] test: work when relocated
2024-08-01 13:21 [PATCH v2 0/9] relocatable DTrace Nick Alcock
` (7 preceding siblings ...)
2024-08-01 13:21 ` [PATCH v2 8/9] build: make dtrace and dtprobed relocatable Nick Alcock
@ 2024-08-01 13:21 ` Nick Alcock
2024-08-02 5:32 ` Kris Van Hees
8 siblings, 1 reply; 19+ messages in thread
From: Nick Alcock @ 2024-08-01 13:21 UTC (permalink / raw)
To: dtrace, dtrace-devel; +Cc: kris.van.hees
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>
---
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
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH v2 1/9] spec: install sdt*.h in /usr/lib64/dtrace/include/sys
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
0 siblings, 0 replies; 19+ messages in thread
From: Kris Van Hees @ 2024-08-02 5:23 UTC (permalink / raw)
To: Nick Alcock; +Cc: dtrace, dtrace-devel, kris.van.hees
On Thu, Aug 01, 2024 at 02:21:48PM +0100, Nick Alcock wrote:
> This is the specfile part of the sdt.h move, rendered more
> complex by the need to clean up the mess left behind by the
> old sdt.h renaming.
>
> Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
> ---
> dtrace.spec | 22 +++++++---------------
> 1 file changed, 7 insertions(+), 15 deletions(-)
>
> diff --git a/dtrace.spec b/dtrace.spec
> index 42ea9bc33958..28eeaa478376 100644
> --- a/dtrace.spec
> +++ b/dtrace.spec
> @@ -86,8 +86,6 @@ BuildRequires: binutils-devel >= 2.30-58.0.8
> Requires: libdtrace-ctf >= 1.1.0
> BuildRequires: libdtrace-ctf-devel >= 1.1.0
> %endif
> -Conflicts: systemtap-sdt-devel
> -Provides: systemtap-sdt-devel
> Summary: DTrace user interface.
> Version: 2.0.1
> Release: 0%{?dist}
> @@ -194,11 +192,6 @@ make DESTDIR=$RPM_BUILD_ROOT VERSION=%{version} \
> sed -i '/^ProtectSystem=/d; /^ProtectControlGroups=/d; /^RuntimeDirectory/d;' $RPM_BUILD_ROOT/usr/lib/systemd/system/dtprobed.service
> %endif
>
> -# Because systemtap creates a sdt.h header file we have to rename
> -# ours and then shift theirs out of the way.
> -mv $RPM_BUILD_ROOT/usr/include/sys/sdt.h \
> - $RPM_BUILD_ROOT/usr/include/sys/sdt-dtrace.h
> -
> %clean
> [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
> rm -rf $RPM_BUILD_DIR/%{name}-%{version}
> @@ -222,13 +215,14 @@ if [ $1 -ge 2 ] ; then
> %systemd_postun_with_restart dtprobed.service
> fi
>
> -# if sdt-systemtap.h doesn't exist then we can move the existing dtrace sdt.h
> +# Clean up the mess left behind by previous installations' overwriting
> +# of systemtap's sdt.h: if an sdt-systemtap.h exists and is a regular
> +# file, move it back to sdt.h. (RPM itself will identify and delete
> +# all the other debris.)
> +
> SYSINCDIR=/usr/include/sys
> -if [ -e $SYSINCDIR/sdt.h -a ! -e $SYSINCDIR/sdt-systemtap.h ]; then
> - mv $SYSINCDIR/sdt.h $SYSINCDIR/sdt-systemtap.h
> - ln -s $SYSINCDIR/sdt-dtrace.h $SYSINCDIR/sdt.h
> -elif [ ! -e $SYSINCDIR/sdt.h ]; then
> - ln -s $SYSINCDIR/sdt-dtrace.h $SYSINCDIR/sdt.h
> +if [ -f $SYSINCDIR/sdt-systemtap.h ]; then
> + mv -f $SYSINCDIR/sdt-systemtap.h $SYSINCDIR/sdt.h
> fi
>
> %preun
> @@ -253,8 +247,6 @@ systemctl start dtprobed || :
> %{_sbindir}/dtrace
> %{_sbindir}/dtprobed
> %{_mandir}/man8/dtrace.8.gz
> -%{_includedir}/sys/sdt-dtrace.h
> -%{_includedir}/sys/sdt_internal.h
> %doc %{_docdir}/dtrace-%{version}/*
> %{_unitdir}/dtprobed.service
> %{_unitdir}/dtrace-usdt.target
> --
> 2.46.0.277.ge12b8151ed
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v2 2/9] build: initial pkg-config support
2024-08-01 13:21 ` [PATCH v2 2/9] build: initial pkg-config support Nick Alcock
@ 2024-08-02 5:24 ` Kris Van Hees
0 siblings, 0 replies; 19+ messages in thread
From: Kris Van Hees @ 2024-08-02 5:24 UTC (permalink / raw)
To: Nick Alcock; +Cc: dtrace, dtrace-devel, kris.van.hees
On Thu, Aug 01, 2024 at 02:21:49PM +0100, Nick Alcock wrote:
> This initial pkg-config file, dtrace_sdt.pc, points at the location
> of the sdt.h include file. We immediately use it in make check in the
> installed testsuite, compensating for any install-time changes in the
> location of the dtrace libdir.
>
> Further changes will be forthcoming to properly support relocatable
> installation.
>
> Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
> ---
> GNUmakefile | 2 ++
> configure | 2 ++
> dtrace.spec | 1 +
> runtest.sh | 2 +-
> uts/Build | 14 +++++++++++++-
> uts/dtrace_sdt.pc.in | 6 ++++++
> 6 files changed, 25 insertions(+), 2 deletions(-)
> create mode 100644 uts/dtrace_sdt.pc.in
>
> diff --git a/GNUmakefile b/GNUmakefile
> index b1109727dc66..0fc9b3b5e85c 100644
> --- a/GNUmakefile
> +++ b/GNUmakefile
> @@ -100,6 +100,8 @@ DOCDIR = $(prefix)/share/doc/dtrace-$(VERSION)
> INSTDOCDIR = $(DESTDIR)$(DOCDIR)
> MANDIR = $(prefix)/share/man/man8
> INSTMANDIR = $(DESTDIR)$(MANDIR)
> +PKGCONFIGDIR = $(prefix)/share/pkgconfig
> +INSTPKGCONFIGDIR = $(DESTDIR)$(PKGCONFIGDIR)
> TESTDIR = $(prefix)/lib$(BITNESS)/dtrace/testsuite
> INSTTESTDIR = $(DESTDIR)$(TESTDIR)
> TARGETS =
> diff --git a/configure b/configure
> index c423bc82b763..462548bcc69c 100755
> --- a/configure
> +++ b/configure
> @@ -60,6 +60,7 @@ Installation paths:
> --sbindir=PREFIX/sbin Alias for --bindir
> --includedir=PREFIX/include #include directory
> --mandir=PREFIX/share/man/man8 Manpage directory
> +--pkg-config-dir=PREFIX/share/pkgconfig Pkg-config directory
> --udevdir=PREFIX/lib/udev/rules.d udev rules directory
> --systemd-unit-dir=PREFIX/lib/systemd/system systemd unit directory
> --docdir=PREFIX/share/doc/dtrace Documentation directory
> @@ -130,6 +131,7 @@ for option in "$@"; do
> --systemd-unit-dir=*) write_make_var SYSTEMDUNITDIR "$option";;
> --docdir=*) write_make_var DOCDIR "$option";;
> --mandir=*) write_make_var MANDIR "$option";;
> + --pkg-config-dir=*) write_make_var PKGCONFIGDIR "$option";;
> --testdir=*) write_make_var TESTDIR "$option";;
> CC=*) write_make_var CC "$option";;
> CPP=*) write_make_var PREPROCESS "$option";;
> diff --git a/dtrace.spec b/dtrace.spec
> index 28eeaa478376..1887fcadaed6 100644
> --- a/dtrace.spec
> +++ b/dtrace.spec
> @@ -246,6 +246,7 @@ systemctl start dtprobed || :
> %{_libdir}/libdtrace.so.*
> %{_sbindir}/dtrace
> %{_sbindir}/dtprobed
> +%{_datadir}/pkgconfig/dtrace_sdt.pc
> %{_mandir}/man8/dtrace.8.gz
> %doc %{_docdir}/dtrace-%{version}/*
> %{_unitdir}/dtprobed.service
> diff --git a/runtest.sh b/runtest.sh
> index 3bcd676ea788..cc9703e12c16 100755
> --- a/runtest.sh
> +++ b/runtest.sh
> @@ -579,7 +579,7 @@ else
> dtrace="/usr/sbin/dtrace"
> test_libdir="installed"
> test_ldflags=""
> - test_cppflags="-DARCH_$arch -I/usr/lib64/dtrace/include"
> + test_cppflags="-DARCH_$arch $(pkg-config --cflags dtrace_sdt)"
>
> if [[ ! -x $dtrace ]]; then
> echo "$dtrace not available." >&2
> diff --git a/uts/Build b/uts/Build
> index 864b2dfdacbf..feafa21369f2 100644
> --- a/uts/Build
> +++ b/uts/Build
> @@ -14,11 +14,16 @@ SYS_HEADERS_INSTALL := common/sys/dtrace.h \
>
> # sdt*.h are used by programs that contain USDT probes that want to define
> # probes by hand rather than using dtrace -h. SystemTap has another header
> -# with the same name, so we install these out of the way.
> +# with the same name, so we install these out of the way and provide a
> +# pkg-config file to pull them in.
>
> PROBE_HEADERS_INSTALL := common/sys/sdt.h \
> common/sys/sdt_internal.h
>
> +# The pkg-config files undergo a few translations with sed before installation.
> +
> +SHARE_PKG_CONFIG_INSTALL := dtrace_sdt.pc
> +
> install::
> mkdir -p $(INSTINCLUDEDIR)/sys
> $(call describe-install-target,$(INSTINCLUDEDIR)/sys,$(notdir $(SYS_HEADERS_INSTALL)))
> @@ -26,3 +31,10 @@ install::
> mkdir -p $(INSTSDTINCLUDEDIR)/sys
> $(call describe-install-target,$(INSTSDTINCLUDEDIR)/sys,$(notdir $(PROBE_HEADERS_INSTALL)))
> cd $(uts_DIR) && install -m 644 $(PROBE_HEADERS_INSTALL) $(INSTSDTINCLUDEDIR)/sys
> + mkdir -p $(INSTPKGCONFIGDIR)
> + $(call describe-install-target,$(INSTPKGCONFIGDIR),$(SHARE_PKG_CONFIG_INSTALL))
> + for name in $(SHARE_PKG_CONFIG_INSTALL); do \
> + cd $(uts_DIR) && \
> + sed 's,@SDTINCLUDEDIR@,$(SDTINCLUDEDIR),g; s,@VERSION@,$(VERSION),g' < \
> + $${name}.in > $(INSTPKGCONFIGDIR)/$$name; \
> + done
> diff --git a/uts/dtrace_sdt.pc.in b/uts/dtrace_sdt.pc.in
> new file mode 100644
> index 000000000000..c5506f9355d9
> --- /dev/null
> +++ b/uts/dtrace_sdt.pc.in
> @@ -0,0 +1,6 @@
> +sdtincludedir = @SDTINCLUDEDIR@
> +
> +Name: DTrace SDT
> +Description: DTrace raw SDT headers
> +Version: @VERSION@
> +Cflags: -I${sdtincludedir}
> --
> 2.46.0.277.ge12b8151ed
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v2 3/9] build: track configured vars
2024-08-01 13:21 ` [PATCH v2 3/9] build: track configured vars Nick Alcock
@ 2024-08-02 5:28 ` Kris Van Hees
0 siblings, 0 replies; 19+ messages in thread
From: Kris Van Hees @ 2024-08-02 5:28 UTC (permalink / raw)
To: Nick Alcock; +Cc: dtrace, dtrace-devel, kris.van.hees
On Thu, Aug 01, 2024 at 02:21:50PM +0100, Nick Alcock wrote:
> This lets the build system determine whether a variable was
> explicitly set via ./configure (the assumption being that
> if you set something explicitly, you knew what you were doing,
> so e.g. if you set the --systemd-unit-dir to /foo/bar, you
> have also arranged for systemd to look there for unit files,
> so the build system can install the systemd unit files there
> on the assumption that they will work).
>
> Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
> ---
> configure | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/configure b/configure
> index 462548bcc69c..fb9a45cda1b7 100755
> --- a/configure
> +++ b/configure
> @@ -17,13 +17,12 @@ write_make_var()
> {
> local val="$(printf "%s" "$2" | sed 's,^.*=,,')"
>
> - [[ ! -d build ]] && mkdir -p build
> -
> if [[ ! -f build/.config-vars.mk.new ]]; then
> echo '# This file is automatically generated.' > build/.config-vars.mk.new
> fi
>
> printf '%s=%s\n' $1 "$val" >> build/.config-vars.mk.new
> + printf "override CONFIGURED_VARS+=%s\n" $1 >> build/.config-vars.mk.new
> }
>
> # Write out build/.config/*.mk and build/.config/*.h, which are the same
> @@ -115,7 +114,9 @@ above stick for future make invocations until "make clean".
> EOF
> }
>
> +[[ ! -d build ]] && mkdir -p build
> rm -rf build/.config.new build/.config-vars.mk.new
> +echo 'override CONFIGURED_VARS=' > build/.config-vars.mk.new
> trap 'rm -rf build/.config.new build/.config-vars.mk.new' ERR
>
> for option in "$@"; do
> @@ -173,8 +174,6 @@ done
>
> echo 'Writing build/config-vars.mk'
> rm -f build/config-vars.mk
> -[[ ! -f build/.config-vars.mk.new ]] && \
> - touch build/config-vars.mk
> mv -f build/.config-vars.mk.new build/config-vars.mk
>
> rm -rf build/.config
> --
> 2.46.0.277.ge12b8151ed
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v2 4/9] build: --bindir is supposed to be equivalent to --sbindir
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
0 siblings, 0 replies; 19+ messages in thread
From: Kris Van Hees @ 2024-08-02 5:28 UTC (permalink / raw)
To: Nick Alcock; +Cc: dtrace, dtrace-devel, kris.van.hees
On Thu, Aug 01, 2024 at 02:21:51PM +0100, Nick Alcock wrote:
> The configure script said as much, but actually it set a
> BINDIR variable that was never used for anything.
>
> Fix this.
>
> Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
> ---
> GNUmakefile | 2 --
> configure | 2 +-
> 2 files changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/GNUmakefile b/GNUmakefile
> index 0fc9b3b5e85c..5903a8e355f6 100644
> --- a/GNUmakefile
> +++ b/GNUmakefile
> @@ -82,8 +82,6 @@ prefix ?= /usr
> export objdir := $(abspath build)
> LIBDIR = $(prefix)/lib$(BITNESS)
> INSTLIBDIR = $(DESTDIR)$(LIBDIR)
> -BINDIR = $(prefix)/bin
> -INSTBINDIR = $(DESTDIR)$(BINDIR)
> INCLUDEDIR = $(prefix)/include
> INSTINCLUDEDIR = $(DESTDIR)$(INCLUDEDIR)
> SDTINCLUDEDIR = $(LIBDIR)/dtrace/include
> diff --git a/configure b/configure
> index fb9a45cda1b7..4026a3eafcd3 100755
> --- a/configure
> +++ b/configure
> @@ -125,7 +125,7 @@ for option in "$@"; do
> --prefix=*) write_make_var prefix "$option";;
> --objdir=*) write_make_var objdir "$option";;
> --libdir=*) write_make_var LIBDIR "$option";;
> - --bindir=*) write_make_var BINDIR "$option";;
> + --bindir=*) write_make_var SBINDIR "$option";;
> --sbindir=*) write_make_var SBINDIR "$option";;
> --includedir=*) write_make_var INCLUDEDIR "$option";;
> --udevdir=*) write_make_var UDEVDIR "$option";;
> --
> 2.46.0.277.ge12b8151ed
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v2 5/9] build: the TESTDIR is relative to the LIBDIR by default
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
0 siblings, 0 replies; 19+ messages in thread
From: Kris Van Hees @ 2024-08-02 5:29 UTC (permalink / raw)
To: Nick Alcock; +Cc: dtrace, dtrace-devel, kris.van.hees
On Thu, Aug 01, 2024 at 02:21:52PM +0100, Nick Alcock wrote:
> If users change the LIBDIR but not the TESTDIR, the TESTDIR
> is meant to follow it, but wasn't.
>
> Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
> ---
> GNUmakefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/GNUmakefile b/GNUmakefile
> index 5903a8e355f6..e7657d466df5 100644
> --- a/GNUmakefile
> +++ b/GNUmakefile
> @@ -100,7 +100,7 @@ MANDIR = $(prefix)/share/man/man8
> INSTMANDIR = $(DESTDIR)$(MANDIR)
> PKGCONFIGDIR = $(prefix)/share/pkgconfig
> INSTPKGCONFIGDIR = $(DESTDIR)$(PKGCONFIGDIR)
> -TESTDIR = $(prefix)/lib$(BITNESS)/dtrace/testsuite
> +TESTDIR = $(LIBDIR)/dtrace/testsuite
> INSTTESTDIR = $(DESTDIR)$(TESTDIR)
> TARGETS =
>
> --
> 2.46.0.277.ge12b8151ed
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v2 6/9] build: add a pkg-config file for dtrace consumers: use it
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
0 siblings, 0 replies; 19+ messages in thread
From: Kris Van Hees @ 2024-08-02 5:30 UTC (permalink / raw)
To: Nick Alcock; +Cc: dtrace, dtrace-devel, kris.van.hees
On Thu, Aug 01, 2024 at 02:21:53PM +0100, Nick Alcock wrote:
> This lets you relocate the include path anywhere you like: users of
> <dtrace.h> et al should invoke $(pkg-config --cflags dtrace) and
> $(pkg-config --libs dtrace) to get the dtrace consumer header directory and
> -ldtrace invocation for linking.
>
> Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
> ---
> runtest.sh | 2 +-
> uts/Build | 10 ++++++----
> uts/dtrace.pc.in | 8 ++++++++
> 3 files changed, 15 insertions(+), 5 deletions(-)
> create mode 100644 uts/dtrace.pc.in
>
> diff --git a/runtest.sh b/runtest.sh
> index cc9703e12c16..817f4a90487d 100755
> --- a/runtest.sh
> +++ b/runtest.sh
> @@ -579,7 +579,7 @@ else
> dtrace="/usr/sbin/dtrace"
> test_libdir="installed"
> test_ldflags=""
> - test_cppflags="-DARCH_$arch $(pkg-config --cflags dtrace_sdt)"
> + test_cppflags="-DARCH_$arch $(pkg-config --cflags dtrace_sdt) $(pkg-config --cflags dtrace)"
>
> if [[ ! -x $dtrace ]]; then
> echo "$dtrace not available." >&2
> diff --git a/uts/Build b/uts/Build
> index feafa21369f2..7948e9f2d084 100644
> --- a/uts/Build
> +++ b/uts/Build
> @@ -22,7 +22,7 @@ PROBE_HEADERS_INSTALL := common/sys/sdt.h \
>
> # The pkg-config files undergo a few translations with sed before installation.
>
> -SHARE_PKG_CONFIG_INSTALL := dtrace_sdt.pc
> +SHARE_PKG_CONFIG_INSTALL := dtrace.pc dtrace_sdt.pc
>
> install::
> mkdir -p $(INSTINCLUDEDIR)/sys
> @@ -34,7 +34,9 @@ install::
> mkdir -p $(INSTPKGCONFIGDIR)
> $(call describe-install-target,$(INSTPKGCONFIGDIR),$(SHARE_PKG_CONFIG_INSTALL))
> for name in $(SHARE_PKG_CONFIG_INSTALL); do \
> - cd $(uts_DIR) && \
> - sed 's,@SDTINCLUDEDIR@,$(SDTINCLUDEDIR),g; s,@VERSION@,$(VERSION),g' < \
> - $${name}.in > $(INSTPKGCONFIGDIR)/$$name; \
> + (cd $(uts_DIR) && \
> + sed -e 's,@SDTINCLUDEDIR@,$(SDTINCLUDEDIR),g;' \
> + -e 's,@INCLUDEDIR@,$(INCLUDEDIR),g;' \
> + -e 's,@VERSION@,$(VERSION),g' < \
> + $${name}.in > $(INSTPKGCONFIGDIR)/$$name;) \
> done
> diff --git a/uts/dtrace.pc.in b/uts/dtrace.pc.in
> new file mode 100644
> index 000000000000..58aa46fc75c9
> --- /dev/null
> +++ b/uts/dtrace.pc.in
> @@ -0,0 +1,8 @@
> +includedir = @INCLUDEDIR@
> +libdir = @LIBDIR@
> +
> +Name: DTrace
> +Description: DTrace consumer headers
> +Version: @VERSION@
> +Cflags: -I${includedir}
> +Libs: -L${libdir} -ldtrace
> --
> 2.46.0.277.ge12b8151ed
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v2 7/9] runtest: remove obsolete kernel coverage data collection
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
0 siblings, 0 replies; 19+ messages in thread
From: Kris Van Hees @ 2024-08-02 5:31 UTC (permalink / raw)
To: Nick Alcock; +Cc: dtrace, dtrace-devel, kris.van.hees
On Thu, Aug 01, 2024 at 02:21:54PM +0100, Nick Alcock wrote:
> The DTrace kernel module is long dead: we don't need kernel coverage any
> more. Delete the example runtest.conf as well, and drop loading it, since
> it served no purpose but to point to the kernel tree used for coverage.
>
> Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
> ---
> runtest.conf.example | 10 ----------
> runtest.sh | 28 ----------------------------
> 2 files changed, 38 deletions(-)
> delete mode 100644 runtest.conf.example
>
> diff --git a/runtest.conf.example b/runtest.conf.example
> deleted file mode 100644
> index c92aa6b96cff..000000000000
> --- a/runtest.conf.example
> +++ /dev/null
> @@ -1,10 +0,0 @@
> -# Test configuration file.
> -#
> -# Copy this file to runtest.conf and edit it.
> -
> -# Kernel build directory.
> -#
> -# If this is not specified, kernel test coverage information will not
> -# be available.
> -
> -# KERNEL_BUILD_DIR=
> diff --git a/runtest.sh b/runtest.sh
> index 817f4a90487d..16a1a77bd394 100755
> --- a/runtest.sh
> +++ b/runtest.sh
> @@ -21,8 +21,6 @@ export LC_COLLATE="C"
>
> arch="$(uname -m)"
>
> -[[ -f ./runtest.conf ]] && . ./runtest.conf
> -
> load_modules()
> {
> # If running as root, pull in appropriate modules
> @@ -644,15 +642,6 @@ if [[ -n $NOBADDOF ]]; then
> --quiet -o $logdir/coverage/initial.lcov 2>/dev/null
> fi
> done
> -
> - if [[ -n $KERNEL_BUILD_DIR ]] && [[ -d $KERNEL_BUILD_DIR ]] &&
> - [[ -d /sys/kernel/debug/gcov/$KERNEL_BUILD_DIR/kernel/dtrace ]]; then
> - rm -rf $KERNEL_BUILD_DIR/coverage
> - mkdir -p $KERNEL_BUILD_DIR/coverage
> - lcov --zerocounters --quiet
> - lcov --capture --base-directory $KERNEL_BUILD_DIR --initial \
> - --quiet -o $KERNEL_BUILD_DIR/coverage/initial.lcov 2>/dev/null
> - fi
> fi
>
> load_modules
> @@ -1592,23 +1581,6 @@ for name in build*; do
> fi
> done
>
> -if [[ -n $KERNEL_BUILD_DIR ]] && [[ -d $KERNEL_BUILD_DIR ]] &&
> - [[ -d /sys/kernel/debug/gcov/$KERNEL_BUILD_DIR/kernel/dtrace ]]; then
> - force_out "Coverage info for kernel:\n"
> -
> - lcov --capture --base-directory $KERNEL_BUILD_DIR \
> - --quiet -o $KERNEL_BUILD_DIR/coverage/coverage.lcov
> - lcov --add-tracefile $KERNEL_BUILD_DIR/coverage/initial.lcov \
> - --add-tracefile $KERNEL_BUILD_DIR/coverage/coverage.lcov \
> - --quiet -o $KERNEL_BUILD_DIR/coverage/coverage.lcov
> -
> - genhtml --frames --show-details -o $KERNEL_BUILD_DIR/coverage \
> - --title "DTrace kernel coverage" --highlight --legend \
> - $KERNEL_BUILD_DIR/coverage/coverage.lcov | \
> - awk 'BEGIN { quiet=1; } { if (!quiet) { print ($0); } } /^Overall coverage rate:$/ { quiet=0; }' | \
> - tee -a $LOGFILE $SUMFILE
> -fi
> -
> if [[ -n $ERRORS ]]; then
> exit 1
> fi
> --
> 2.46.0.277.ge12b8151ed
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v2 8/9] build: make dtrace and dtprobed relocatable
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
0 siblings, 0 replies; 19+ messages in thread
From: Kris Van Hees @ 2024-08-02 5:31 UTC (permalink / raw)
To: Nick Alcock; +Cc: dtrace, dtrace-devel, kris.van.hees
On Thu, Aug 01, 2024 at 02:21:55PM +0100, Nick Alcock wrote:
> The majority of the complexity here involves figuring out what to
> do about the systemd service file. We presume that if the user
> is installing such that the service file lands inone of the two fixed
> locations systemd knows how to find persistent service files in, or
> if the user has explicitly passed --systemd-unit-dir to configure,
> it makes sense to install the systemd service file (because systemd
> will find it): otherwise, we avoid installing it and print a
> warning that the user must do so if dtprobed is to be properly
> started.
>
> Provide a new installation target, install-dtprobed-autostart, to do
> so.
>
> (Regardless, the service file is changed to substitute in the real
> installed path of dtprobed.)
>
> Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
> ---
> Maketargets | 3 ++
> cmd/Build | 4 +--
> dtprobed/Build | 36 ++++++++++++++-----
> .../{dtprobed.service => dtprobed.service.in} | 2 +-
> 4 files changed, 34 insertions(+), 11 deletions(-)
> rename dtprobed/{dtprobed.service => dtprobed.service.in} (95%)
>
> diff --git a/Maketargets b/Maketargets
> index 11ad9fed4dcf..5b4906a86d26 100644
> --- a/Maketargets
> +++ b/Maketargets
> @@ -14,6 +14,9 @@ help::
> @printf "dlibs Build translator files\n" >&2
> @printf "install Install (DESTDIR supported)\n" >&2
> @printf "install-test Install testsuite (DESTDIR supported)\n" >&2
> + @printf "install-dtprobed-autostart Install udev / systemd rules to start dtprobed" >&2
> + @printf " (done by make install unless prefix or sbindir" >&2
> + @printf " are changed)" >&2
> @printf "clean / realclean Clean up build tree\n" >&2
> @printf "TAGS / tags / gtags Make tags files\n" >&2
> @printf "\n" >&2
> diff --git a/cmd/Build b/cmd/Build
> index 55c622c19dc0..68800fbeb5fc 100644
> --- a/cmd/Build
> +++ b/cmd/Build
> @@ -1,5 +1,5 @@
> # Oracle Linux DTrace.
> -# Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved.
> +# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
> # Licensed under the Universal Permissive License v 1.0 as shown at
> # http://oss.oracle.com/licenses/upl.
>
> @@ -36,7 +36,7 @@ if [[ -z \$$_DTRACE_CHECK_INSTALLED ]]; then\n\
> export LD_LIBRARY_PATH=$(objdir)\n\
> dtrace_cmd=$(objdir)/dtrace\n\
> else\n\
> - dtrace_cmd=/usr/sbin/dtrace\n\
> + dtrace_cmd=$(SBINDIR)/dtrace\n\
> fi\n\
> \n\
> if [[ -n \$$DTRACE_GDB ]]; then\n\
> diff --git a/dtprobed/Build b/dtprobed/Build
> index 0f5d1c08aee8..9132c3e31c8a 100644
> --- a/dtprobed/Build
> +++ b/dtprobed/Build
> @@ -42,17 +42,13 @@ dtprobed.c_CFLAGS := -Wno-pedantic
> seccomp-assistance.c_CFLAGS := -fno-lto
> endif
>
> -install::
> - mkdir -p $(INSTSBINDIR)
> - $(call describe-install-target,$(INSTSBINDIR),dtprobed)
> - install -m 755 $(objdir)/dtprobed $(INSTSBINDIR)
> - mkdir -p $(INSTUDEVDIR)
> - $(call describe-install-target,$(INSTUDEVDIR),60-dtprobed.rules)
> - install -m 644 $(dtprobed_DIR)60-dtprobed.rules $(INSTUDEVDIR)
> +install-dtprobed-autostart::
> ifdef HAVE_LIBSYSTEMD
> mkdir -p $(INSTSYSTEMDUNITDIR) $(INSTSYSTEMDPRESETDIR)
> $(call describe-install-target,$(INSTSYSTEMDUNITDIR),dtprobed.service)
> - install -m 644 $(dtprobed_DIR)dtprobed.service $(INSTSYSTEMDUNITDIR)
> + sed 's,@SBINDIR@,$(SBINDIR),' < $(dtprobed_DIR)dtprobed.service.in > $(INSTSYSTEMDUNITDIR)/dtprobed.service
> + chown root:root $(INSTSYSTEMDUNITDIR)/dtprobed.service
> + chmod 0644 $(INSTSYSTEMDUNITDIR)/dtprobed.service
> $(call describe-install-target,$(INSTSYSTEMDUNITDIR),dtrace-usdt.target)
> install -m 644 $(dtprobed_DIR)dtrace-usdt.target $(INSTSYSTEMDUNITDIR)
> $(call describe-install-target,$(INSTSYSTEMDPRESETDIR),50-dtprobed.preset)
> @@ -61,3 +57,27 @@ ifdef HAVE_LIBSYSTEMD
> systemctl enable dtprobed.service dtrace-usdt.target; \
> fi
> endif
> +
> +install::
> + mkdir -p $(INSTSBINDIR)
> + $(call describe-install-target,$(INSTSBINDIR),dtprobed)
> + install -m 755 $(objdir)/dtprobed $(INSTSBINDIR)
> + mkdir -p $(INSTUDEVDIR)
> + $(call describe-install-target,$(INSTUDEVDIR),60-dtprobed.rules)
> + install -m 644 $(dtprobed_DIR)60-dtprobed.rules $(INSTUDEVDIR)
> + if [[ "$(SYSTEMDUNITDIR)" = /usr/lib/systemd/system ]] || \
> + [[ "$(SYSTEMDUNITDIR)" = /usr/local/lib/systemd/system ]] || \
> + [[ -n "$(filter SYSTEMDUNITDIR,$(CONFIGURED_VARS))" ]] ; then \
> + $(MAKE) install-dtprobed-autostart; \
> + else \
> + echo " === WARNING WARNING WARNING === " >&2; \
> + echo "systemd service files for dtprobed not installed." >&2; \
> + echo "USDT probes (and the testsuite) will not work unless this is" >&2; \
> + echo "done. Try make install-dtprobed-autostart, but this may not" >&2; \
> + echo "be enough: you may need to manually move the systemd service" >&2; \
> + echo "files somewhere udev and systemd will find them." >&2; \
> + echo "If there is already a running dtprobed, it may or may not work" >&2; \
> + echo "in conjunction with this DTrace." >&2; \
> + echo "Configure with --systemd-unit-dir to override this decision." >&2; \
> + echo " === WARNING WARNING WARNING === " >&2; \
> + fi
> diff --git a/dtprobed/dtprobed.service b/dtprobed/dtprobed.service.in
> similarity index 95%
> rename from dtprobed/dtprobed.service
> rename to dtprobed/dtprobed.service.in
> index 8e491fe28ad1..2e590701d03e 100644
> --- a/dtprobed/dtprobed.service
> +++ b/dtprobed/dtprobed.service.in
> @@ -12,7 +12,7 @@ Before=basic.target
>
> [Service]
> Type=notify
> -ExecStart=/usr/sbin/dtprobed -F
> +ExecStart=@SBINDIR@/dtprobed -F
> Restart=on-failure
> RestartPreventExitStatus=1
> ProtectSystem=strict
> --
> 2.46.0.277.ge12b8151ed
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v2 9/9] test: work when relocated
2024-08-01 13:21 ` [PATCH v2 9/9] test: work when relocated Nick Alcock
@ 2024-08-02 5:32 ` Kris Van Hees
0 siblings, 0 replies; 19+ messages in thread
From: Kris Van Hees @ 2024-08-02 5:32 UTC (permalink / raw)
To: Nick Alcock; +Cc: dtrace, dtrace-devel, kris.van.hees
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
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2024-08-02 5:32 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox