Commit graph

88 commits

Author SHA1 Message Date
Mark Johnston 397e83df75 dtrace tests: Regenerate makefiles after commit d0b2dbfa0e 2024-06-01 11:16:39 -04:00
Mark Johnston cb6b5e8ab9 dtrace tests: Fix loading of the test kernel module
The old way is racy and can cause two instances, running in parallel, to
attempt to load dtrace_test, and only one will succeed.  This caused
errors when running dtrace tests in parallel.

MFC after:	1 week
2024-06-01 11:16:33 -04:00
Mark Johnston a61d2c7fbd dtrace tests: Diff expected and actual output upon a miscompare
This makes quick diagnosis of test failures easier.

MFC after:	1 week
2024-01-10 18:19:36 -05:00
Mark Johnston 66bfb4b2ee dtrace tests: Require perl
A number of tests use it, so just require it globally as we do with
other tools.

MFC after:	1 week
2024-01-10 18:18:27 -05:00
Mark Johnston e25922b34e dtrace tests: Run ksh with -p
In particular, avoid loading the user's .profile file, since that can
have undesirable side effects.  Most tests were already careful to do
this.

MFC after:	1 week
2024-01-10 18:17:59 -05:00
Domagoj Stolfa 93f27766a7 dtrace: Add the 'oformat' libdtrace option
This option can be used to specify a format to use in DTrace output.
The following formats are supported:
 - json
 - xml
 - html
 - none (default DTrace output)

This is implemented using libxo and integrated into libdtrace. Client
code only works with the following API:

 - dtrace_oformat_setup(dtrace_hdl_t *) -- to be called when output is starting.
 - dtrace_oformat_teardown(dtrace_hdl_t *) -- to be called when output is finished
 - dtrace_oformat(dtrace_hdl_t *) -- check if oformat is enabled.
 - dtrace_set_outfp(FILE *) -- sets the output file for oformat.
 - Ensure that oformat is correctly checked in the drop handler and record
   processing callbacks.

This commit also adds tests which check if the generated output is
valid (JSON, XML) and extends the dtrace(1) describing the structured output.

Reviewed by:	markj
Discussed with:	phil
MFC after:	2 months
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D41745
2024-01-10 18:14:26 -05:00
Domagoj Stolfa 7a3af0a59b dtrace: Remove $FreeBSD$ from genmakefiles.sh.
$FreeBSD$ is gone in head, so this should be removed as well.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D41595
2023-08-25 14:55:59 -06:00
Warner Losh d0b2dbfa0e Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16 11:55:03 -06:00
Domagoj Stolfa 6de0222840 dtrace: Add WITH_DTRACE_ASAN
See commit 4ae6991228.  This version of
the commit avoids inadvertently changing SHLIBDIR for libdtrace.so.
2023-08-02 09:15:08 -04:00
Mark Johnston 5cdaac92e1 dtrace: Revert the addition of WITH_DTRACE_ASAN
The follow-up fix triggers a lib32 build failure, revert everything
until the problem is addressed.
2023-08-01 13:03:10 -04:00
Domagoj Stolfa 4ae6991228 dtrace: Add WITH_DTRACE_ASAN
This option is a blanket for all the DTrace-related software. The option
when enabled passes in -fsanitize=address -fsanitize=undeifned, enabling
ASAN and UBSAN in the following components:

 - libdtrace
 - dtrace(1)
 - lockstat(1)
 - plockstat(1)

The option defaults to "no" and is intended as a developer aid.

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D41157
2023-07-27 16:07:34 -04:00
Christos Margiolis 911f026039 dtrace: move kinst tests to common
Reviewed by:	markj
Approved by:	markj (mentor)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D40414
2023-07-04 18:46:59 +03:00
Simon J. Gerraty d9a4274795 Update/fix Makefile.depend for userland 2023-04-18 17:14:23 -07:00
Mark Johnston 19a847e5f2 kinst: Add a rudimentary regression test case
The test instruments a number of large, frequently called kernel
functions while generating load in the background.

MFC after:	3 months
2022-10-11 18:19:55 -04:00
Li-Wen Hsu 0088bc444e
DTrace test: skip flakey common.misc.t_dtrace_contrib.tst_dynopt_d in CI
PR:		237641
Sponsored by:	The FreeBSD Foundation
2022-03-24 11:37:50 +08:00
Li-Wen Hsu e62aee66b0
DTrace test: Add a new keyword SKIPCI to gentest.sh
This is for marking a test case is flakey and should not be executed in
the CI environment.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34635
2022-03-24 11:30:27 +08:00
Emmanuel Vadot 79ac3c12a7 pkgbase: Put dtrace in its own package
While dtrace is usefull some people might not want it.

Differential Revision:	https://reviews.freebsd.org/D30752
Sponsored by:	Diablotin Systems
2021-06-19 17:49:31 +02:00
Alex Richardson e17ebfd3b7 Remove -I flag for include path that doesn't exist
Found this while trying to get macOS bootstrap to work again after OpenZFS merge.

Reviewed By:	#zfs, freqlabs
Differential Revision: https://reviews.freebsd.org/D26192
2020-09-10 15:37:07 +00:00
Matt Macy 9e5787d228 Merge OpenZFS support in to HEAD.
The primary benefit is maintaining a completely shared
code base with the community allowing FreeBSD to receive
new features sooner and with less effort.

I would advise against doing 'zpool upgrade'
or creating indispensable pools using new
features until this change has had a month+
to soak.

Work on merging FreeBSD support in to what was
at the time "ZFS on Linux" began in August 2018.
I first publicly proposed transitioning FreeBSD
to (new) OpenZFS on December 18th, 2018. FreeBSD
support in OpenZFS was finally completed in December
2019. A CFT for downstreaming OpenZFS support in
to FreeBSD was first issued on July 8th. All issues
that were reported have been addressed or, for
a couple of less critical matters there are
pull requests in progress with OpenZFS. iXsystems
has tested and dogfooded extensively internally.
The TrueNAS 12 release is based on OpenZFS with
some additional features that have not yet made
it upstream.

Improvements include:
  project quotas, encrypted datasets,
  allocation classes, vectorized raidz,
  vectorized checksums, various command line
  improvements, zstd compression.

Thanks to those who have helped along the way:
Ryan Moeller, Allan Jude, Zack Welch, and many
others.

Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D25872
2020-08-25 02:21:27 +00:00
Mark Johnston d2d16e5663 Enable creation of static userspace probes in incremental builds.
To define USDT probes, dtrace -G makes use of relocations for undefined
symbols: the target address is overwritten with NOPs and the location is
recorded in the DOF section of the output object file.  To avoid link
errors, the original relocation is destroyed.  However, this means that
the same input object file cannot be processed multiple times, as
happens during incremental rebuilds.  Instead, only set the relocation
type to NONE, so that all information required to reconstruct USDT
probes is preserved.

Reported by:	bdrewery
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
2020-08-20 19:28:19 +00:00
Bryan Drewery b155807e48 dtrace tests: Support globbing for excludes
Downstream this makes skipping tests like common/ip/tst.*sctp*.ksh simpler.

Reviewed by:	vangyzen, cem, markj
Sponsored by:	Dell EMC
Differential Revision:	https://reviews.freebsd.org/D24608
2020-04-29 21:12:32 +00:00
Mariusz Zaborski 39d51a9400 DTrace: add a top level makefile to the new test suit
Pointed out by:	markj
2019-06-09 22:45:07 +00:00
Mariusz Zaborski 75ed05ef7d DTrace: create an amd64 test suit
Create two tests checking if we can read urgs registers and if the
rax register returns a correct number.

Reviewed by:	markj
Discussed with:	lwhsu
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D20364
2019-06-05 22:32:26 +00:00
Mark Johnston f0e2814d34 Hook up the existing i386 DTrace tests to the build.
Now that it's relatively easy to do so, we might as well.

MFC after:	1 week
Event:		Waterloo Hackathon 2019
2019-05-22 03:42:03 +00:00
Mark Johnston 2df0edc13c Make it possible to generate makefiles for arch-dependent DTrace tests.
MFC after:	1 week
Event:		Waterloo Hackathon 2019
2019-05-22 03:10:23 +00:00
Michael Tuexen 1e88cc8b59 Add support for send, receive and state-change DTrace providers for
SCTP. They are based on what is specified in the Solaris DTrace manual
for Solaris 11.4.

Reviewed by:		0mp, dteske, markj
Relnotes:		yes
Differential Revision:	https://reviews.freebsd.org/D16839
2018-08-22 21:23:32 +00:00
Michael Tuexen 7bda966394 Add a dtrace provider for UDP-Lite.
The dtrace provider for UDP-Lite is modeled after the UDP provider.
This fixes the bug that UDP-Lite packets were triggering the UDP
provider.
Thanks to dteske@ for providing the dwatch module.

Reviewed by:		dteske@, markj@, rrs@
Relnotes:		yes
Differential Revision:	https://reviews.freebsd.org/D16377
2018-07-31 22:56:03 +00:00
Michael Tuexen 53e0911116 Improve TCP related tests for dtrace.
Ensure that the TCP connections are terminated gracefully as expected
by the test. Use appropriate numbers for sent/received packets.
In addition, enable tst.localtcpstate.ksh, which should pass, but
doesn't until https://reviews.freebsd.org/D16369 is committed.

Reviewed by:		markj@
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D16288
2018-07-22 10:50:59 +00:00
Michael Tuexen dc9f20b3f3 Fix the UDP tests for dtrace.
The code imported from opensolaris was depending on ping supporting
UDP for sending probes. Since this is not supported by ping on FreeBSD
use a perl script instead.
The remote test requires the usage of ksh93, so state that in the
sheband.
Enable the local test, but keep the remote test disabled, since it
requires a remote machine on the LAN.

Reviewed by:		markj@, gnn@
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D16268
2018-07-15 20:34:22 +00:00
Mark Johnston d678ce4b6b Remove tst.zonename.d from the list of expected failures.
X-MFC with:	r327888
2018-01-14 17:56:19 +00:00
Mark Johnston 224e0c2f61 Add "jid" and "jailname" variables to DTrace.
These return the jail ID and jail name for the traced process,
respectively, and are analogous to "zonename" on Solaris/illumos.
"zonename" is now aliased to "jailname".

Also add some stress tests for the new variables.

Submitted by:	Domagoj Stolfa <domagoj.stolfa@gmail.com>
Reviewed by:	dteske (previous version)
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D13877
2018-01-12 19:59:46 +00:00
Mark Johnston 60eddb209b Add a regression test for r327794.
MFC after:	2 weeks
2018-01-10 21:40:36 +00:00
Mark Johnston 7c3701904a Mark uctf/err.user64mode.ksh as EXFAIL for now.
MFC after:	1 week
2017-12-15 18:09:23 +00:00
Mark Johnston 97cb52fa9a Actually add the -x setenv test Makefile, missed in r326499.
X-MFC with:	r326499
2017-12-08 19:26:25 +00:00
Mark Johnston 04006780d9 Complete support for dtrace's -x setenv option.
This allows one to override the environment for processes created with
dtrace -c. By default, the environment is inherited.

This support was originally merged from illumos in r249367 but was lost
when the commit was later reverted and then brought back piecemeal.

Reported by:	Samuel Lepetit <slepetit@apple.com>
MFC after:	2 weeks
2017-12-03 16:57:28 +00:00
Mark Johnston f4b90f5a5c Revert r326181 for now.
We can't link an executable using -m32 until the lib32 phase of a
buildworld, though the build works fine when executing make from
cddl/usr.sbin/dtrace/tests. Some other solution will need to be found.
2017-11-27 17:54:17 +00:00
Mark Johnston e96f62322b Compile one of the uctf test programs with -m32.
The err.user64mode.ksh test expects it to run as a 32-bit process.

MFC after:	1 week
2017-11-24 19:57:13 +00:00
Mark Johnston 483f7100b4 Annotate pragma/err.invalidlibdep.ksh as EXFAIL.
The test creates a D library with a "depends_on library" pragma
referencing a non-existent library, and expects compilation to fail.
However, as far as I can tell, libdtrace is supposed simply abort
compilation of the library in this case, and continue. This behaviour
is desirable when adding libraries which depend on optional KLDs, for
example.

MFC after:	1 week
2017-11-22 15:54:52 +00:00
Mark Johnston 7c72b10912 Annotate usdt/tst.eliminate.ksh as EXFAIL.
It appears to depend on some behaviour specific to the Sun link editor.

MFC after:	1 week
2017-11-21 16:00:18 +00:00
Bryan Drewery ea825d0274 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:07:04 +00:00
Bryan Drewery 3806950135 DIRDEPS_BUILD: Connect new directories.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:04:07 +00:00
Mark Johnston a3a7b74e18 Add a regression test for r322773.
MFC after:	1 week
2017-08-21 21:58:42 +00:00
Li-Wen Hsu 288ebd813a The test case common.funcs.t_dtrace_contrib.tst_basename_d generates a
verifying script which needs being run to complete the test.

While here, add missing shebang.

Reviewed by:	gnn, markj, ngie
Differential Revision:	https://reviews.freebsd.org/D11716
2017-07-25 13:18:28 +00:00
Li-Wen Hsu d83c70758a Add a simple script which calls open(2) and others to generate events for
testing.

This test times-out on a quiet system because there is nobody triggers
syscall::open:entry or syscall::: probe while test execution.

Reviewed by:	gnn, markj (earlier version)
Differential Revision:	https://reviews.freebsd.org/D11671
2017-07-25 12:58:03 +00:00
Li-Wen Hsu b9de3393dd Add a simple program which calls sigtimedwait(2) to generate events for testing
This test timeout on a quiet system because there is nobody triggers
'syscall::*wait*:entry' probe while test execution.

Reviewed by:	gnn, markj, ngie
Differential Revision:	https://reviews.freebsd.org/D11668
2017-07-25 12:52:32 +00:00
Mark Johnston c645060dbb Override the locale so that file lists get a consistent sort order.
Reported by:	avg
MFC after:	1 week
2017-06-10 14:47:01 +00:00
Andriy Gapon 6bd205a529 follow up to r319746: add the new test files to the make file
Reported by:	markj
MFC after:	2 days
X-MFC with:	r319746
2017-06-10 06:13:52 +00:00
Mark Johnston b4a3f67bd6 Add a little helper program for tst.exitcore.ksh.
sleep(1) is capsicumized, which means that we cannot rely on it to dump
core as required by the test.

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-05-22 20:34:51 +00:00
Mark Johnston 9ebaf5f802 Remove the EXFAIL annotation for tests which pass as of r309596.
Reported by:	bdrewery
Sponsored by:	Dell EMC Isilon
2017-05-19 00:25:09 +00:00
Enji Cooper acc37ca1c1 cddl: normalize paths using SRCTOP-relative paths or :H when possible
This simplifies make logic/output

While here, remove bogus CFLAGS which look for headers in cddl/lib/libumem.
There aren't any source files there (just Makefiles)

MFC after:	1 month
Sponsored by:	Dell EMC Isilon
2017-03-04 11:30:04 +00:00