* [PATCH 0/9] relocatable DTrace
@ 2024-05-31 18:59 Nick Alcock
2024-05-31 18:59 ` [PATCH 1/9] spec: install sdt*.h in /usr/lib64/dtrace/include/sys Nick Alcock
` (9 more replies)
0 siblings, 10 replies; 17+ messages in thread
From: Nick Alcock @ 2024-05-31 18:59 UTC (permalink / raw)
To: dtrace, dtrace-devel
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.)
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
tests: delete the kernel build dir stuff
build: make dtrace and dtprobed relocatable
test: work when relocated
Build | 1 +
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 | 33 +++--------------
test/unittest/usdt/tst.manyprocs.sh | 2 +-
test/unittest/usdt/tst.multitrace.sh | 2 +-
uts/Build | 16 ++++++++-
uts/dtrace.pc.in | 8 +++++
uts/dtrace_sdt.pc.in | 6 ++++
15 files changed, 87 insertions(+), 76 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
base-commit: 454c6d47bf408415f7eb52ea701779f041aa6957
--
2.45.1.275.g567cb0950c
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 1/9] spec: install sdt*.h in /usr/lib64/dtrace/include/sys
2024-05-31 18:59 [PATCH 0/9] relocatable DTrace Nick Alcock
@ 2024-05-31 18:59 ` Nick Alcock
2024-05-31 18:59 ` [PATCH 2/9] build: initial pkg-config support Nick Alcock
` (8 subsequent siblings)
9 siblings, 0 replies; 17+ messages in thread
From: Nick Alcock @ 2024-05-31 18:59 UTC (permalink / raw)
To: dtrace, dtrace-devel
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 42ea9bc339586..28eeaa4783769 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.45.1.275.g567cb0950c
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 2/9] build: initial pkg-config support
2024-05-31 18:59 [PATCH 0/9] relocatable DTrace Nick Alcock
2024-05-31 18:59 ` [PATCH 1/9] spec: install sdt*.h in /usr/lib64/dtrace/include/sys Nick Alcock
@ 2024-05-31 18:59 ` Nick Alcock
2024-05-31 18:59 ` [PATCH 3/9] build: track configured vars Nick Alcock
` (7 subsequent siblings)
9 siblings, 0 replies; 17+ messages in thread
From: Nick Alcock @ 2024-05-31 18:59 UTC (permalink / raw)
To: dtrace, dtrace-devel
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 b1109727dc66b..0fc9b3b5e85cd 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 c423bc82b7637..462548bcc69c9 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 28eeaa4783769..1887fcadaed62 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 3bcd676ea788d..cc9703e12c161 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 864b2dfdacbf4..feafa21369f2e 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 0000000000000..c5506f9355d92
--- /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.45.1.275.g567cb0950c
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 3/9] build: track configured vars
2024-05-31 18:59 [PATCH 0/9] relocatable DTrace Nick Alcock
2024-05-31 18:59 ` [PATCH 1/9] spec: install sdt*.h in /usr/lib64/dtrace/include/sys Nick Alcock
2024-05-31 18:59 ` [PATCH 2/9] build: initial pkg-config support Nick Alcock
@ 2024-05-31 18:59 ` Nick Alcock
2024-05-31 18:59 ` [PATCH 4/9] build: --bindir is supposed to be equivalent to --sbindir Nick Alcock
` (6 subsequent siblings)
9 siblings, 0 replies; 17+ messages in thread
From: Nick Alcock @ 2024-05-31 18:59 UTC (permalink / raw)
To: dtrace, dtrace-devel
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 462548bcc69c9..fb9a45cda1b77 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.45.1.275.g567cb0950c
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 4/9] build: --bindir is supposed to be equivalent to --sbindir
2024-05-31 18:59 [PATCH 0/9] relocatable DTrace Nick Alcock
` (2 preceding siblings ...)
2024-05-31 18:59 ` [PATCH 3/9] build: track configured vars Nick Alcock
@ 2024-05-31 18:59 ` Nick Alcock
2024-05-31 18:59 ` [PATCH 5/9] build: the TESTDIR is relative to the LIBDIR by default Nick Alcock
` (5 subsequent siblings)
9 siblings, 0 replies; 17+ messages in thread
From: Nick Alcock @ 2024-05-31 18:59 UTC (permalink / raw)
To: dtrace, dtrace-devel
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 0fc9b3b5e85cd..5903a8e355f61 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 fb9a45cda1b77..4026a3eafcd36 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.45.1.275.g567cb0950c
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 5/9] build: the TESTDIR is relative to the LIBDIR by default
2024-05-31 18:59 [PATCH 0/9] relocatable DTrace Nick Alcock
` (3 preceding siblings ...)
2024-05-31 18:59 ` [PATCH 4/9] build: --bindir is supposed to be equivalent to --sbindir Nick Alcock
@ 2024-05-31 18:59 ` Nick Alcock
2024-05-31 18:59 ` [PATCH 6/9] build: add a pkg-config file for dtrace consumers: use it Nick Alcock
` (4 subsequent siblings)
9 siblings, 0 replies; 17+ messages in thread
From: Nick Alcock @ 2024-05-31 18:59 UTC (permalink / raw)
To: dtrace, dtrace-devel
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 5903a8e355f61..e7657d466df50 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.45.1.275.g567cb0950c
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 6/9] build: add a pkg-config file for dtrace consumers: use it
2024-05-31 18:59 [PATCH 0/9] relocatable DTrace Nick Alcock
` (4 preceding siblings ...)
2024-05-31 18:59 ` [PATCH 5/9] build: the TESTDIR is relative to the LIBDIR by default Nick Alcock
@ 2024-05-31 18:59 ` Nick Alcock
2024-05-31 18:59 ` [PATCH 7/9] tests: delete the kernel build dir stuff Nick Alcock
` (3 subsequent siblings)
9 siblings, 0 replies; 17+ messages in thread
From: Nick Alcock @ 2024-05-31 18:59 UTC (permalink / raw)
To: dtrace, dtrace-devel
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 cc9703e12c161..817f4a90487d9 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 feafa21369f2e..7948e9f2d084b 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 0000000000000..58aa46fc75c9d
--- /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.45.1.275.g567cb0950c
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 7/9] tests: delete the kernel build dir stuff
2024-05-31 18:59 [PATCH 0/9] relocatable DTrace Nick Alcock
` (5 preceding siblings ...)
2024-05-31 18:59 ` [PATCH 6/9] build: add a pkg-config file for dtrace consumers: use it Nick Alcock
@ 2024-05-31 18:59 ` Nick Alcock
2024-07-31 19:22 ` [DTrace-devel] " Kris Van Hees
2024-05-31 18:59 ` [PATCH 8/9] build: make dtrace and dtprobed relocatable Nick Alcock
` (2 subsequent siblings)
9 siblings, 1 reply; 17+ messages in thread
From: Nick Alcock @ 2024-05-31 18:59 UTC (permalink / raw)
To: dtrace, dtrace-devel
The DTrace kernel module is long dead: we don't need kernel coverage any
more. Delete the example runtest.conf as well (but do not delete the
loading runtest.conf: we are about to use it for another purpose).
Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
---
runtest.conf.example | 10 ----------
runtest.sh | 26 --------------------------
2 files changed, 36 deletions(-)
delete mode 100644 runtest.conf.example
diff --git a/runtest.conf.example b/runtest.conf.example
deleted file mode 100644
index c92aa6b96cff6..0000000000000
--- 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 817f4a90487d9..d9b7c02c06a3e 100755
--- a/runtest.sh
+++ b/runtest.sh
@@ -644,15 +644,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 +1583,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.45.1.275.g567cb0950c
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 8/9] build: make dtrace and dtprobed relocatable
2024-05-31 18:59 [PATCH 0/9] relocatable DTrace Nick Alcock
` (6 preceding siblings ...)
2024-05-31 18:59 ` [PATCH 7/9] tests: delete the kernel build dir stuff Nick Alcock
@ 2024-05-31 18:59 ` Nick Alcock
2024-05-31 19:46 ` [DTrace-devel] " Nick Alcock
2024-05-31 18:59 ` [PATCH 9/9] test: work when relocated Nick Alcock
2024-07-31 19:21 ` [DTrace-devel] [PATCH 0/9] relocatable DTrace Kris Van Hees
9 siblings, 1 reply; 17+ messages in thread
From: Nick Alcock @ 2024-05-31 18:59 UTC (permalink / raw)
To: dtrace, dtrace-devel
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 11ad9fed4dcf0..5b4906a86d26e 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 55c622c19dc0a..68800fbeb5fcb 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 0f5d1c08aee86..cc65c3452981f 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 8e491fe28ad13..2e590701d03e7 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.45.1.275.g567cb0950c
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 9/9] test: work when relocated
2024-05-31 18:59 [PATCH 0/9] relocatable DTrace Nick Alcock
` (7 preceding siblings ...)
2024-05-31 18:59 ` [PATCH 8/9] build: make dtrace and dtprobed relocatable Nick Alcock
@ 2024-05-31 18:59 ` Nick Alcock
2024-07-31 19:21 ` [DTrace-devel] [PATCH 0/9] relocatable DTrace Kris Van Hees
9 siblings, 0 replies; 17+ messages in thread
From: Nick Alcock @ 2024-05-31 18:59 UTC (permalink / raw)
To: dtrace, dtrace-devel
We do this by writing out a runtest.conf into the testdir at
make install-test time that tells the testsuite where dtrace
is located. 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>
---
Build | 1 +
runtest.sh | 5 +++--
test/unittest/usdt/tst.manyprocs.sh | 2 +-
test/unittest/usdt/tst.multitrace.sh | 2 +-
4 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/Build b/Build
index 485e75d62b4cb..071bef631f7c4 100644
--- a/Build
+++ b/Build
@@ -10,6 +10,7 @@ install-test::
mkdir -p $(INSTTESTDIR)
$(call describe-install-target,$(INSTTESTDIR),GNUmakefile runtest.sh .git-version Makecheck Makeoptions)
install -m 755 runtest.sh $(INSTTESTDIR)
+ echo dtrace="$(SBINDIR)/dtrace" > $(INSTTESTDIR)/runtest.conf
install -m 644 Makecheck .git-version $(INSTTESTDIR)
install -m 644 Makeoptions.installed $(INSTTESTDIR)/Makeoptions
sed "s,@INSTALL_SUBST@,TESTDIR=$(TESTDIR)," < Makecheck.installed.in > $(INSTTESTDIR)/GNUmakefile
diff --git a/runtest.sh b/runtest.sh
index d9b7c02c06a3e..25b8cf5665032 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)"
@@ -576,7 +577,7 @@ if [[ -z $USE_INSTALLED ]]; then
export dtprobed_pid=$!
ZAPTHESE+=($dtprobed_pid)
else
- dtrace="/usr/sbin/dtrace"
+ # inherit the dtrace path from runtest.conf or defaults (above)
test_libdir="installed"
test_ldflags=""
test_cppflags="-DARCH_$arch $(pkg-config --cflags dtrace_sdt) $(pkg-config --cflags dtrace)"
@@ -586,8 +587,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 a899470dfa0e1..f820ed231c388 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 84cf1e8caa543..dcabde620c030 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
--
2.45.1.275.g567cb0950c
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [DTrace-devel] [PATCH 8/9] build: make dtrace and dtprobed relocatable
2024-05-31 18:59 ` [PATCH 8/9] build: make dtrace and dtprobed relocatable Nick Alcock
@ 2024-05-31 19:46 ` Nick Alcock
0 siblings, 0 replies; 17+ messages in thread
From: Nick Alcock @ 2024-05-31 19:46 UTC (permalink / raw)
To: dtrace-devel, dtrace
On 31 May 2024, Nick Alcock via DTrace-devel outgrape:
> +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; \
Ugh, this is tabdamaged, and even though this doesn't matter inside a
\'ed recipe, I've pushed a fixed version to nix/relocatable.
Sorry about that.
--
NULL && (void)
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [DTrace-devel] [PATCH 0/9] relocatable DTrace
2024-05-31 18:59 [PATCH 0/9] relocatable DTrace Nick Alcock
` (8 preceding siblings ...)
2024-05-31 18:59 ` [PATCH 9/9] test: work when relocated Nick Alcock
@ 2024-07-31 19:21 ` Kris Van Hees
2024-07-31 19:54 ` Nick Alcock
9 siblings, 1 reply; 17+ messages in thread
From: Kris Van Hees @ 2024-07-31 19:21 UTC (permalink / raw)
To: Nick Alcock; +Cc: dtrace, dtrace-devel
General comments because my review covers the entire series...
Why are there two pkg_config files being introduced when it seems like a
single dtrace.pc one would be sufficient. The dtrace utility is used both
for tracing and for the building of libraries and executables with USDT
probes, I see no reason why a single dtrace.pc couldn't cover both.
On that note, why can't pkg-config then also be used as a means to get the
location of the dtrace executable? Why go through the trouble of performing
text substitution on runtest.sh to insert the location of dtrace when you
already use pkg-config in it to get the appropriate include directory for
the installed case.
I think this series needs to be reworked to be consistent. If we are going
to use pkg-config, then let's use it to its fullest extent rather than using
it for some stuff but then still hardcoding other things. That makes no sense
to me.
On Fri, May 31, 2024 at 07:59:19PM +0100, Nick Alcock via DTrace-devel wrote:
> 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.)
>
> 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
> tests: delete the kernel build dir stuff
> build: make dtrace and dtprobed relocatable
> test: work when relocated
>
> Build | 1 +
> 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 | 33 +++--------------
> test/unittest/usdt/tst.manyprocs.sh | 2 +-
> test/unittest/usdt/tst.multitrace.sh | 2 +-
> uts/Build | 16 ++++++++-
> uts/dtrace.pc.in | 8 +++++
> uts/dtrace_sdt.pc.in | 6 ++++
> 15 files changed, 87 insertions(+), 76 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
>
>
> base-commit: 454c6d47bf408415f7eb52ea701779f041aa6957
> --
> 2.45.1.275.g567cb0950c
>
>
> _______________________________________________
> DTrace-devel mailing list
> DTrace-devel@oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/dtrace-devel
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [DTrace-devel] [PATCH 7/9] tests: delete the kernel build dir stuff
2024-05-31 18:59 ` [PATCH 7/9] tests: delete the kernel build dir stuff Nick Alcock
@ 2024-07-31 19:22 ` Kris Van Hees
2024-07-31 19:32 ` Nick Alcock
0 siblings, 1 reply; 17+ messages in thread
From: Kris Van Hees @ 2024-07-31 19:22 UTC (permalink / raw)
To: Nick Alcock; +Cc: dtrace, dtrace-devel
The subject line does not (to me) convey what this patch actually does. It
would be more clear to perhaps say something like "test: remove obsolete
kernel coverage data collection'
On Fri, May 31, 2024 at 07:59:26PM +0100, Nick Alcock via DTrace-devel wrote:
> The DTrace kernel module is long dead: we don't need kernel coverage any
> more. Delete the example runtest.conf as well (but do not delete the
> loading runtest.conf: we are about to use it for another purpose).
>
> Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
> ---
> runtest.conf.example | 10 ----------
> runtest.sh | 26 --------------------------
> 2 files changed, 36 deletions(-)
> delete mode 100644 runtest.conf.example
>
> diff --git a/runtest.conf.example b/runtest.conf.example
> deleted file mode 100644
> index c92aa6b96cff6..0000000000000
> --- 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 817f4a90487d9..d9b7c02c06a3e 100755
> --- a/runtest.sh
> +++ b/runtest.sh
> @@ -644,15 +644,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 +1583,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.45.1.275.g567cb0950c
>
>
> _______________________________________________
> DTrace-devel mailing list
> DTrace-devel@oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/dtrace-devel
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [DTrace-devel] [PATCH 7/9] tests: delete the kernel build dir stuff
2024-07-31 19:22 ` [DTrace-devel] " Kris Van Hees
@ 2024-07-31 19:32 ` Nick Alcock
0 siblings, 0 replies; 17+ messages in thread
From: Nick Alcock @ 2024-07-31 19:32 UTC (permalink / raw)
To: Kris Van Hees; +Cc: dtrace, dtrace-devel
On 31 Jul 2024, Kris Van Hees spake thusly:
> The subject line does not (to me) convey what this patch actually does. It
> would be more clear to perhaps say something like "test: remove obsolete
> kernel coverage data collection'
Sorry, that's a truly *terrible* subject line isn't it :( A classic
case of being deep in the runtest weeds and forgetting that the tests
include, uh, actual *tests* and not just the test runner.
Adjusted to exactly what you suggested, except s/test/runtest/ (since
it's not a *test* at fault here).
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [DTrace-devel] [PATCH 0/9] relocatable DTrace
2024-07-31 19:21 ` [DTrace-devel] [PATCH 0/9] relocatable DTrace Kris Van Hees
@ 2024-07-31 19:54 ` Nick Alcock
2024-07-31 20:11 ` Kris Van Hees
0 siblings, 1 reply; 17+ messages in thread
From: Nick Alcock @ 2024-07-31 19:54 UTC (permalink / raw)
To: Kris Van Hees; +Cc: dtrace, dtrace-devel
On 31 Jul 2024, Kris Van Hees said:
> General comments because my review covers the entire series...
>
> Why are there two pkg_config files being introduced when it seems like a
> single dtrace.pc one would be sufficient. The dtrace utility is used both
> for tracing and for the building of libraries and executables with USDT
> probes, I see no reason why a single dtrace.pc couldn't cover both.
Simply because there are two distinct use cases here that require a
different set of libraries and headers from different places: "we want
to use USDT using <sdt.h>", and "we are a DTrace consumer". Almost
nothing wants both, only one wants a library, etc etc.
Bear in mind that more-or-less universal usage of pkg-config (as in,
with CMake, Autoconf and Meson it is hard to impossible to do anything
else) has the caller appending $(pkg-config --cflags $pkg) to CFLAGS or
CPPFLAGS and $(pkg-config --libs $pkg) to LIBS. If we tried to use the
same pkg-config file, this would mean that *raw USDT probe users* would
find themselves linking with libdtrace! This is *surely* not what we
want.
pkg-config is not meant to be "one pkg-config file per package", despite
the name: a huge number of packages have multiple. (The worst offender
on my system appears to be Qt 6, with 136, but even a simple thing like
xcb-util has four.)
> On that note, why can't pkg-config then also be used as a means to get the
> location of the dtrace executable? Why go through the trouble of performing
> text substitution on runtest.sh to insert the location of dtrace when you
> already use pkg-config in it to get the appropriate include directory for
> the installed case.
Because I didn't think of it. That's an excellent idea. Adjusting
accordingly. Will send a v2 of the whole series (because it's been
ages).
> I think this series needs to be reworked to be consistent. If we are going
> to use pkg-config, then let's use it to its fullest extent rather than using
> it for some stuff but then still hardcoding other things. That makes no sense
> to me.
Agreed. Anything else you can think of that's hardcoded? I can't
immediately think of anything (because we can't use pkg-config in
dtprobed.service, it's not a program) but you looked at this much more
recently than me...
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [DTrace-devel] [PATCH 0/9] relocatable DTrace
2024-07-31 19:54 ` Nick Alcock
@ 2024-07-31 20:11 ` Kris Van Hees
2024-08-01 16:45 ` Nick Alcock
0 siblings, 1 reply; 17+ messages in thread
From: Kris Van Hees @ 2024-07-31 20:11 UTC (permalink / raw)
To: Nick Alcock; +Cc: Kris Van Hees, dtrace, dtrace-devel
On Wed, Jul 31, 2024 at 08:54:44PM +0100, Nick Alcock wrote:
> On 31 Jul 2024, Kris Van Hees said:
>
> > General comments because my review covers the entire series...
> >
> > Why are there two pkg_config files being introduced when it seems like a
> > single dtrace.pc one would be sufficient. The dtrace utility is used both
> > for tracing and for the building of libraries and executables with USDT
> > probes, I see no reason why a single dtrace.pc couldn't cover both.
>
> Simply because there are two distinct use cases here that require a
> different set of libraries and headers from different places: "we want
> to use USDT using <sdt.h>", and "we are a DTrace consumer". Almost
> nothing wants both, only one wants a library, etc etc.
>
> Bear in mind that more-or-less universal usage of pkg-config (as in,
> with CMake, Autoconf and Meson it is hard to impossible to do anything
> else) has the caller appending $(pkg-config --cflags $pkg) to CFLAGS or
> CPPFLAGS and $(pkg-config --libs $pkg) to LIBS. If we tried to use the
> same pkg-config file, this would mean that *raw USDT probe users* would
> find themselves linking with libdtrace! This is *surely* not what we
> want.
If people do that without actually checking whether it makes any sense, then
that would be an argument (to me) to not use pkg-config at all. Using
pkg-config to get --libs when there is no library to link with is pointless
and merely shows that the person using this has no diea what they are doing.
The cflags argument I can accept, but then perhaps we need *3* pkg-config
files? What exactly do we need this for? Testsuite needs to know where to
find dtrace, so that could need a pkg-config file. Anyone wanting to use
libdtrace would need to know where to find the library and what cflags to
use (finding the include files), which would need a pkg-config file. And
compiling code with SDT would need another pkg-config file.
This brings it back to my original thought that if we are going to provide
pkg-config, we need to carefully think about what we need to provide and do
it consistently.
> pkg-config is not meant to be "one pkg-config file per package", despite
> the name: a huge number of packages have multiple. (The worst offender
> on my system appears to be Qt 6, with 136, but even a simple thing like
> xcb-util has four.)
>
> > On that note, why can't pkg-config then also be used as a means to get the
> > location of the dtrace executable? Why go through the trouble of performing
> > text substitution on runtest.sh to insert the location of dtrace when you
> > already use pkg-config in it to get the appropriate include directory for
> > the installed case.
>
> Because I didn't think of it. That's an excellent idea. Adjusting
> accordingly. Will send a v2 of the whole series (because it's been
> ages).
>
> > I think this series needs to be reworked to be consistent. If we are going
> > to use pkg-config, then let's use it to its fullest extent rather than using
> > it for some stuff but then still hardcoding other things. That makes no sense
> > to me.
>
> Agreed. Anything else you can think of that's hardcoded? I can't
> immediately think of anything (because we can't use pkg-config in
> dtprobed.service, it's not a program) but you looked at this much more
> recently than me...
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [DTrace-devel] [PATCH 0/9] relocatable DTrace
2024-07-31 20:11 ` Kris Van Hees
@ 2024-08-01 16:45 ` Nick Alcock
0 siblings, 0 replies; 17+ messages in thread
From: Nick Alcock @ 2024-08-01 16:45 UTC (permalink / raw)
To: Kris Van Hees; +Cc: dtrace, dtrace-devel
On 31 Jul 2024, Kris Van Hees outgrape:
> On Wed, Jul 31, 2024 at 08:54:44PM +0100, Nick Alcock wrote:
>> On 31 Jul 2024, Kris Van Hees said:
>>
>> > General comments because my review covers the entire series...
>> >
>> > Why are there two pkg_config files being introduced when it seems like a
>> > single dtrace.pc one would be sufficient. The dtrace utility is used both
>> > for tracing and for the building of libraries and executables with USDT
>> > probes, I see no reason why a single dtrace.pc couldn't cover both.
>>
>> Simply because there are two distinct use cases here that require a
>> different set of libraries and headers from different places: "we want
>> to use USDT using <sdt.h>", and "we are a DTrace consumer". Almost
>> nothing wants both, only one wants a library, etc etc.
>>
>> Bear in mind that more-or-less universal usage of pkg-config (as in,
>> with CMake, Autoconf and Meson it is hard to impossible to do anything
>> else) has the caller appending $(pkg-config --cflags $pkg) to CFLAGS or
>> CPPFLAGS and $(pkg-config --libs $pkg) to LIBS. If we tried to use the
>> same pkg-config file, this would mean that *raw USDT probe users* would
>> find themselves linking with libdtrace! This is *surely* not what we
>> want.
>
> If people do that without actually checking whether it makes any sense, then
> that would be an argument (to me) to not use pkg-config at all. Using
> pkg-config to get --libs when there is no library to link with is pointless
> and merely shows that the person using this has no diea what they are doing.
Agreed. If someone is putting the pkg-config files somewhere unusual,
it's because they have *already* pointed pkg-config at that new place,
so we can rely on pkg-config still working.
We can handle people changing --prefix alone (the overwhelmingly common
case) by setting the pkg-config path to "../../../share/pkgconfig" :)
> The cflags argument I can accept, but then perhaps we need *3* pkg-config
> files?
No need.
> What exactly do we need this for? Testsuite needs to know where to
> find dtrace, so that could need a pkg-config file. Anyone wanting to use
> libdtrace would need to know where to find the library and what cflags to
> use (finding the include files), which would need a pkg-config file. And
> compiling code with SDT would need another pkg-config file.
We need two -- one for consumers (which need to know where dtrace.h and
libdtrace are) and one for sdt users (which need to know where sdt.h
is). We can just add the dtrace= variable pointing at the executable to
both: either might potentially find it useful to know that, and an
unused variable in a pkg-config file is harmless.
--
NULL && (void)
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2024-08-01 16:45 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-31 18:59 [PATCH 0/9] relocatable DTrace Nick Alcock
2024-05-31 18:59 ` [PATCH 1/9] spec: install sdt*.h in /usr/lib64/dtrace/include/sys Nick Alcock
2024-05-31 18:59 ` [PATCH 2/9] build: initial pkg-config support Nick Alcock
2024-05-31 18:59 ` [PATCH 3/9] build: track configured vars Nick Alcock
2024-05-31 18:59 ` [PATCH 4/9] build: --bindir is supposed to be equivalent to --sbindir Nick Alcock
2024-05-31 18:59 ` [PATCH 5/9] build: the TESTDIR is relative to the LIBDIR by default Nick Alcock
2024-05-31 18:59 ` [PATCH 6/9] build: add a pkg-config file for dtrace consumers: use it Nick Alcock
2024-05-31 18:59 ` [PATCH 7/9] tests: delete the kernel build dir stuff Nick Alcock
2024-07-31 19:22 ` [DTrace-devel] " Kris Van Hees
2024-07-31 19:32 ` Nick Alcock
2024-05-31 18:59 ` [PATCH 8/9] build: make dtrace and dtprobed relocatable Nick Alcock
2024-05-31 19:46 ` [DTrace-devel] " Nick Alcock
2024-05-31 18:59 ` [PATCH 9/9] test: work when relocated Nick Alcock
2024-07-31 19:21 ` [DTrace-devel] [PATCH 0/9] relocatable DTrace Kris Van Hees
2024-07-31 19:54 ` Nick Alcock
2024-07-31 20:11 ` Kris Van Hees
2024-08-01 16:45 ` Nick Alcock
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox