[DTrace-devel] [PATCH 17/17] usdt: testsuite updates

Nick Alcock nick.alcock at oracle.com
Wed Aug 10 22:07:09 UTC 2022


A lot of tests can be enabled now, but a lot are still XFAIL: anything
that relies on is-enabled probes, systemwide probing, globbing of USDT
probe names, or args which are non-integral are guaranteed broken.

We also mark three pid tests as broken which need raise().  I have no
idea how they ever worked, but I don't think their failing now is a sign
of a problem in USDT.

We add one new test to make sure that you can run a probe-containing
program and then repeatedly probe it from multiple dtraces in turn
without them messing up each others' probes in any way.  (Doing it from
multiple dtraces in *parallel* may well not work yet: no specific code
has been written to make it work: that's planned for the next phase.)

Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
---
 test/triggers/Build                           |  2 +-
 test/unittest/pid/tst.args1.d                 |  1 +
 test/unittest/pid/tst.ret1.d                  |  1 +
 test/unittest/pid/tst.ret2.d                  |  1 +
 test/unittest/usdt/tst.args-alt.d             |  2 +-
 test/unittest/usdt/tst.args.d                 |  1 -
 test/unittest/usdt/tst.dlclose1.sh            |  2 -
 test/unittest/usdt/tst.dlclose2.sh            |  3 +-
 test/unittest/usdt/tst.dlclose3.sh            |  2 +
 test/unittest/usdt/tst.dlclose3.x             |  1 -
 test/unittest/usdt/tst.eliminate.sh           |  2 +-
 test/unittest/usdt/tst.enable.d               |  2 +-
 test/unittest/usdt/tst.enable_and.d           |  2 +-
 test/unittest/usdt/tst.enable_and_2.d         |  2 +-
 test/unittest/usdt/tst.enable_or.d            |  2 +-
 test/unittest/usdt/tst.enable_or_2.d          |  2 +-
 test/unittest/usdt/tst.enable_return.d        |  2 +-
 test/unittest/usdt/tst.enable_stmt.d          |  2 +-
 test/unittest/usdt/tst.enabled.sh             |  2 +-
 test/unittest/usdt/tst.enabled2.sh            |  2 -
 test/unittest/usdt/tst.entryreturn.sh         |  2 +-
 test/unittest/usdt/tst.fork.sh                |  2 +-
 test/unittest/usdt/tst.guess32.sh             |  1 -
 test/unittest/usdt/tst.guess64.sh             |  1 -
 test/unittest/usdt/tst.lingering.r            |  8 ++++
 .../usdt/{tst.fork.sh => tst.lingering.sh}    | 44 ++++++++++++-------
 test/unittest/usdt/tst.multiple.sh            |  1 -
 test/unittest/usdt/tst.reeval.sh              |  2 +-
 test/unittest/usdt/tst.static.sh              |  1 -
 test/unittest/usdt/tst.static2.sh             |  1 -
 test/unittest/usdt/tst.tailcall.d             |  4 +-
 31 files changed, 59 insertions(+), 44 deletions(-)
 delete mode 120000 test/unittest/usdt/tst.dlclose3.x
 create mode 100644 test/unittest/usdt/tst.lingering.r
 copy test/unittest/usdt/{tst.fork.sh => tst.lingering.sh} (66%)

diff --git a/test/triggers/Build b/test/triggers/Build
index d97886247cc7..1ef6f3ae1df8 100644
--- a/test/triggers/Build
+++ b/test/triggers/Build
@@ -12,7 +12,7 @@ EXTERNAL_64BIT_TRIGGERS = testprobe readwholedir mmap bogus-ioctl open delaydie
     ustack-tst-spin ustack-tst-mtspin \
     visible-constructor visible-constructor-static visible-constructor-static-unstripped
 
-# EXTERNAL_64BIT_SDT_TRIGGERS = usdt-tst-argmap usdt-tst-args usdt-tst-forker usdt-tst-special
+EXTERNAL_64BIT_SDT_TRIGGERS = usdt-tst-argmap usdt-tst-args usdt-tst-forker usdt-tst-special
 EXTERNAL_64BIT_TRIGGERS += $(EXTERNAL_64BIT_SDT_TRIGGERS)
 
 EXTERNAL_32BIT_TRIGGERS := visible-constructor-32
diff --git a/test/unittest/pid/tst.args1.d b/test/unittest/pid/tst.args1.d
index c92bf719b9b5..d83513edae3b 100644
--- a/test/unittest/pid/tst.args1.d
+++ b/test/unittest/pid/tst.args1.d
@@ -8,6 +8,7 @@
 /* @@runtest-opts: $_pid */
 /* @@trigger: pid-tst-args1 */
 /* @@trigger-timing: before */
+/* @@xfail: dtv2: needs destructive actions */
 
 /*
  * ASSERTION: test that all 10 arguments are what we expect them to be.
diff --git a/test/unittest/pid/tst.ret1.d b/test/unittest/pid/tst.ret1.d
index 398e2cc83cc7..3778eb0aeee9 100644
--- a/test/unittest/pid/tst.ret1.d
+++ b/test/unittest/pid/tst.ret1.d
@@ -7,6 +7,7 @@
 /* @@runtest-opts: $_pid */
 /* @@trigger: pid-tst-ret1 */
 /* @@trigger-timing: before */
+/* @@xfail: dtv2: needs destructive actions */
 
 /*
  * ASSERTION: test that we get the right return value from non-leaf returns
diff --git a/test/unittest/pid/tst.ret2.d b/test/unittest/pid/tst.ret2.d
index a542646aa9fc..e7676e65204d 100644
--- a/test/unittest/pid/tst.ret2.d
+++ b/test/unittest/pid/tst.ret2.d
@@ -7,6 +7,7 @@
 /* @@runtest-opts: $_pid */
 /* @@trigger: pid-tst-ret2 */
 /* @@trigger-timing: before */
+/* @@xfail: dtv2: needs destructive actions */
 
 /*
  * ASSERTION: test that we get the right return value from leaf returns
diff --git a/test/unittest/usdt/tst.args-alt.d b/test/unittest/usdt/tst.args-alt.d
index ba0be203b29f..e193f15a7544 100644
--- a/test/unittest/usdt/tst.args-alt.d
+++ b/test/unittest/usdt/tst.args-alt.d
@@ -5,7 +5,7 @@
  * http://oss.oracle.com/licenses/upl.
  */
 
-/* @@xfail: dtv2 */
+/* @@xfail: dtv2, no args support yet */
 /* @@trigger: usdt-tst-args */
 /* @@trigger-timing: before */
 /* @@runtest-opts: $_pid */
diff --git a/test/unittest/usdt/tst.args.d b/test/unittest/usdt/tst.args.d
index 1397e60c97aa..8c8e3009a4a9 100644
--- a/test/unittest/usdt/tst.args.d
+++ b/test/unittest/usdt/tst.args.d
@@ -5,7 +5,6 @@
  * http://oss.oracle.com/licenses/upl.
  */
 
-/* @@xfail: dtv2 */
 /* @@trigger: usdt-tst-args */
 /* @@trigger-timing: before */
 /* @@runtest-opts: $_pid */
diff --git a/test/unittest/usdt/tst.dlclose1.sh b/test/unittest/usdt/tst.dlclose1.sh
index 81fa2415e52d..ee4d95f3bf20 100755
--- a/test/unittest/usdt/tst.dlclose1.sh
+++ b/test/unittest/usdt/tst.dlclose1.sh
@@ -27,8 +27,6 @@
 #
 # The first USDT provider check should find test_prov$pid.
 # The second should not.
-#
-# @@xfail: dtv2 (USDT probes)
 
 dtrace=$1
 CC=/usr/bin/gcc
diff --git a/test/unittest/usdt/tst.dlclose2.sh b/test/unittest/usdt/tst.dlclose2.sh
index 0ee868fa9b3e..5794586c6ba2 100755
--- a/test/unittest/usdt/tst.dlclose2.sh
+++ b/test/unittest/usdt/tst.dlclose2.sh
@@ -5,8 +5,9 @@
 # Licensed under the Universal Permissive License v 1.0 as shown at
 # http://oss.oracle.com/licenses/upl.
 #
+# @@xfail: dtv2, no wildcard usdt probes yet
+#
 PATH=/usr/bin:/usr/sbin:$PATH
-# @@xfail: dtv2
 
 if [ $# != 1 ]; then
 	echo expected one argument: '<'dtrace-path'>'
diff --git a/test/unittest/usdt/tst.dlclose3.sh b/test/unittest/usdt/tst.dlclose3.sh
index 0a98608fbdc8..86170b8763a0 100755
--- a/test/unittest/usdt/tst.dlclose3.sh
+++ b/test/unittest/usdt/tst.dlclose3.sh
@@ -5,6 +5,8 @@
 # Licensed under the Universal Permissive License v 1.0 as shown at
 # http://oss.oracle.com/licenses/upl.
 #
+# @@xfail: dtv2, needs dtprobed synchronization with running dtraces
+# @@tags: unstable
 
 #
 # This test verifies that performing a dlclose(3dl) on a library doesn't
diff --git a/test/unittest/usdt/tst.dlclose3.x b/test/unittest/usdt/tst.dlclose3.x
deleted file mode 120000
index 6507ccd87ea5..000000000000
--- a/test/unittest/usdt/tst.dlclose3.x
+++ /dev/null
@@ -1 +0,0 @@
-../pid/test.x
\ No newline at end of file
diff --git a/test/unittest/usdt/tst.eliminate.sh b/test/unittest/usdt/tst.eliminate.sh
index 4dbd52849de4..feb3b9ef5ac2 100755
--- a/test/unittest/usdt/tst.eliminate.sh
+++ b/test/unittest/usdt/tst.eliminate.sh
@@ -4,7 +4,7 @@
 # Copyright (c) 2007, 2020, 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.
-# @@xfail: Linux ld does not seem to supoprt STV_ELIMINATE
+# @@xfail: Linux ld does not seem to support STV_ELIMINATE
 #
 # Make sure temporary symbols generated due to DTrace probes in static
 # functions are removed in the final link step.
diff --git a/test/unittest/usdt/tst.enable.d b/test/unittest/usdt/tst.enable.d
index f35e7ddf6966..cb5bf9a04408 100644
--- a/test/unittest/usdt/tst.enable.d
+++ b/test/unittest/usdt/tst.enable.d
@@ -5,7 +5,7 @@
  * http://oss.oracle.com/licenses/upl.
  */
 
-/* @@xfail: dtv2 */
+/* @@xfail: dtv2, no is-enabled probes yet */
 /* @@trigger: usdt-tst-special 2 */
 
 #pragma D option quiet
diff --git a/test/unittest/usdt/tst.enable_and.d b/test/unittest/usdt/tst.enable_and.d
index 21deb6d5a781..9c2fa6d93a21 100644
--- a/test/unittest/usdt/tst.enable_and.d
+++ b/test/unittest/usdt/tst.enable_and.d
@@ -5,7 +5,7 @@
  * http://oss.oracle.com/licenses/upl.
  */
 
-/* @@xfail: dtv2 */
+/* @@xfail: dtv2, no is-enabled probes yet */
 /* @@trigger: usdt-tst-special 5 */
 
 #pragma D option quiet
diff --git a/test/unittest/usdt/tst.enable_and_2.d b/test/unittest/usdt/tst.enable_and_2.d
index ac6f06176045..239cd13e99b1 100644
--- a/test/unittest/usdt/tst.enable_and_2.d
+++ b/test/unittest/usdt/tst.enable_and_2.d
@@ -5,7 +5,7 @@
  * http://oss.oracle.com/licenses/upl.
  */
 
-/* @@xfail: dtv2 */
+/* @@xfail: dtv2, no is-enabled probes yet */
 /* @@trigger: usdt-tst-special 6 */
 
 #pragma D option quiet
diff --git a/test/unittest/usdt/tst.enable_or.d b/test/unittest/usdt/tst.enable_or.d
index 73a1bdd16484..99d423b4b55f 100644
--- a/test/unittest/usdt/tst.enable_or.d
+++ b/test/unittest/usdt/tst.enable_or.d
@@ -5,7 +5,7 @@
  * http://oss.oracle.com/licenses/upl.
  */
 
-/* @@xfail: dtv2 */
+/* @@xfail: dtv2, no is-enabled probes yet */
 /* @@trigger: usdt-tst-special 3 */
 
 #pragma D option quiet
diff --git a/test/unittest/usdt/tst.enable_or_2.d b/test/unittest/usdt/tst.enable_or_2.d
index 8d3483be3e23..9563d4fb610c 100644
--- a/test/unittest/usdt/tst.enable_or_2.d
+++ b/test/unittest/usdt/tst.enable_or_2.d
@@ -5,7 +5,7 @@
  * http://oss.oracle.com/licenses/upl.
  */
 
-/* @@xfail: dtv2 */
+/* @@xfail: dtv2, no is-enabled probes yet */
 /* @@trigger: usdt-tst-special 4 */
 
 #pragma D option quiet
diff --git a/test/unittest/usdt/tst.enable_return.d b/test/unittest/usdt/tst.enable_return.d
index 5a6f998aa7fd..e596f1f41237 100644
--- a/test/unittest/usdt/tst.enable_return.d
+++ b/test/unittest/usdt/tst.enable_return.d
@@ -5,7 +5,7 @@
  * http://oss.oracle.com/licenses/upl.
  */
 
-/* @@xfail: dtv2 */
+/* @@xfail: dtv2, no is-enabled probes yet */
 /* @@trigger: usdt-tst-special 8 */
 
 #pragma D option quiet
diff --git a/test/unittest/usdt/tst.enable_stmt.d b/test/unittest/usdt/tst.enable_stmt.d
index 2c1c775e2fce..a327c1b213f9 100644
--- a/test/unittest/usdt/tst.enable_stmt.d
+++ b/test/unittest/usdt/tst.enable_stmt.d
@@ -5,7 +5,7 @@
  * http://oss.oracle.com/licenses/upl.
  */
 
-/* @@xfail: dtv2 */
+/* @@xfail: dtv2, no is-enabled probes yet */
 /* @@trigger: usdt-tst-special 7 */
 
 #pragma D option quiet
diff --git a/test/unittest/usdt/tst.enabled.sh b/test/unittest/usdt/tst.enabled.sh
index 21c44b5c46a5..4377c0a83946 100755
--- a/test/unittest/usdt/tst.enabled.sh
+++ b/test/unittest/usdt/tst.enabled.sh
@@ -9,7 +9,7 @@ if [ $# != 1 ]; then
 	echo expected one argument: '<'dtrace-path'>'
 	exit 2
 fi
-# @@xfail: dtv2
+# @@xfail: dtv2, no is-enabled probes yet
 
 dtrace=$1
 CC=/usr/bin/gcc
diff --git a/test/unittest/usdt/tst.enabled2.sh b/test/unittest/usdt/tst.enabled2.sh
index da7233a76d00..738e9348d31a 100755
--- a/test/unittest/usdt/tst.enabled2.sh
+++ b/test/unittest/usdt/tst.enabled2.sh
@@ -8,8 +8,6 @@
 # This test is primarily intended to verify a fix for SPARC, but there's no
 # harm in running it on other platforms. Here, we verify that is-enabled
 # probes don't interfere with return values from previously invoked functions.
-#
-# @@xfail: dtv2
 
 if [ $# != 1 ]; then
 	echo expected one argument: '<'dtrace-path'>'
diff --git a/test/unittest/usdt/tst.entryreturn.sh b/test/unittest/usdt/tst.entryreturn.sh
index e9b97cdb2b1a..5fa1318bf49a 100755
--- a/test/unittest/usdt/tst.entryreturn.sh
+++ b/test/unittest/usdt/tst.entryreturn.sh
@@ -5,11 +5,11 @@
 # Licensed under the Universal Permissive License v 1.0 as shown at
 # http://oss.oracle.com/licenses/upl.
 #
+# @@xfail: dtv2, needs system()
 if [ $# != 1 ]; then
 	echo expected one argument: '<'dtrace-path'>'
 	exit 2
 fi
-# @@xfail: dtv2
 
 dtrace=$1
 CC=/usr/bin/gcc
diff --git a/test/unittest/usdt/tst.fork.sh b/test/unittest/usdt/tst.fork.sh
index 7c99ecc1844e..969dacf9c9bd 100755
--- a/test/unittest/usdt/tst.fork.sh
+++ b/test/unittest/usdt/tst.fork.sh
@@ -5,11 +5,11 @@
 # Licensed under the Universal Permissive License v 1.0 as shown at
 # http://oss.oracle.com/licenses/upl.
 #
+# @@xfail: dtv2, no real probe-in-forked-child support yet
 if [ $# != 1 ]; then
 	echo expected one argument: '<'dtrace-path'>'
 	exit 2
 fi
-# @@xfail: dtv2
 
 dtrace=$1
 CC=/usr/bin/gcc
diff --git a/test/unittest/usdt/tst.guess32.sh b/test/unittest/usdt/tst.guess32.sh
index f4dedeb72aad..990e453147bb 100755
--- a/test/unittest/usdt/tst.guess32.sh
+++ b/test/unittest/usdt/tst.guess32.sh
@@ -4,7 +4,6 @@
 # Copyright (c) 2006, 2020, 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.
-# @@xfail: dtv2
 
 if [ $# != 1 ]; then
 	echo expected one argument: '<'dtrace-path'>'
diff --git a/test/unittest/usdt/tst.guess64.sh b/test/unittest/usdt/tst.guess64.sh
index 03410ad05fe9..8341c18f4a90 100755
--- a/test/unittest/usdt/tst.guess64.sh
+++ b/test/unittest/usdt/tst.guess64.sh
@@ -9,7 +9,6 @@ if [ $# != 1 ]; then
 	echo expected one argument: '<'dtrace-path'>'
 	exit 2
 fi
-# @@xfail: dtv2
 
 dtrace=$1
 CC=/usr/bin/gcc
diff --git a/test/unittest/usdt/tst.lingering.r b/test/unittest/usdt/tst.lingering.r
new file mode 100644
index 000000000000..31babb1670ac
--- /dev/null
+++ b/test/unittest/usdt/tst.lingering.r
@@ -0,0 +1,8 @@
+test:main:go
+
+test:main:go2
+
+test:main:go2
+
+test:main:go
+
diff --git a/test/unittest/usdt/tst.fork.sh b/test/unittest/usdt/tst.lingering.sh
similarity index 66%
copy from test/unittest/usdt/tst.fork.sh
copy to test/unittest/usdt/tst.lingering.sh
index 7c99ecc1844e..bee59df44da7 100755
--- a/test/unittest/usdt/tst.fork.sh
+++ b/test/unittest/usdt/tst.lingering.sh
@@ -1,27 +1,30 @@
 #!/bin/bash
 #
 # Oracle Linux DTrace.
-# Copyright (c) 2006, 2020, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2022, 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.
 #
+# Test multiple probes, repeatedly invoked by multiple dtraces
+# on the same running trigger
+#
 if [ $# != 1 ]; then
 	echo expected one argument: '<'dtrace-path'>'
 	exit 2
 fi
-# @@xfail: dtv2
 
 dtrace=$1
 CC=/usr/bin/gcc
 CFLAGS=
 
-DIRNAME="$tmpdir/usdt-fork.$$.$RANDOM"
+DIRNAME="$tmpdir/usdt-lingering.$$.$RANDOM"
 mkdir -p $DIRNAME
 cd $DIRNAME
 
 cat > prov.d <<EOF
 provider test_prov {
 	probe go();
+	probe go2();
 };
 EOF
 
@@ -33,22 +36,18 @@ fi
 
 cat > test.c <<EOF
 #include <sys/types.h>
-#include <sys/wait.h>
 #include <unistd.h>
 #include "prov.h"
 
 int
 main(int argc, char **argv)
 {
-	TEST_PROV_GO();
-	if (fork() == 0) {
+	for (;;) {
 		TEST_PROV_GO();
-		return 0;
+		TEST_PROV_GO2();
+		sleep(1);
 	}
 
-	wait(NULL);
-	TEST_PROV_GO();
-
 	return 0;
 }
 EOF
@@ -69,16 +68,29 @@ if [ $? -ne 0 ]; then
 	exit 1
 fi
 
+./test &
+TRIGPID=$!
+
+trap 'kill -9 $TRIGPID' ERR EXIT
+
 script() {
-	$dtrace -c ./test -Zqs /dev/stdin <<EOF
-	test_prov*:::
+	$dtrace -p $TRIGPID -qs /dev/stdin <<EOF
+	test_prov\$target:::$1
 	{
 		printf("%s:%s:%s\n", probemod, probefunc, probename);
+		exit(0);
+	}
+
+	tick-5s
+	{
+		printf("probe $1 timed out\n");
+		exit(1);
 	}
 EOF
 }
 
-script
-status=$?
-
-exit $status
+set -e
+script go
+script go2
+script go2
+script go
diff --git a/test/unittest/usdt/tst.multiple.sh b/test/unittest/usdt/tst.multiple.sh
index 28a3fcd874b7..81e709535575 100755
--- a/test/unittest/usdt/tst.multiple.sh
+++ b/test/unittest/usdt/tst.multiple.sh
@@ -9,7 +9,6 @@ if [ $# != 1 ]; then
 	echo expected one argument: '<'dtrace-path'>'
 	exit 2
 fi
-# @@xfail: dtv2
 
 dtrace=$1
 CC=/usr/bin/gcc
diff --git a/test/unittest/usdt/tst.reeval.sh b/test/unittest/usdt/tst.reeval.sh
index 0340931d4b33..31658be7efc7 100755
--- a/test/unittest/usdt/tst.reeval.sh
+++ b/test/unittest/usdt/tst.reeval.sh
@@ -9,7 +9,7 @@ if [ $# != 1 ]; then
 	echo expected one argument: '<'dtrace-path'>'
 	exit 2
 fi
-# @@xfail: dtv2
+# @@xfail: dtv2, no args on usdt probes yet
 
 dtrace=$1
 CC=/usr/bin/gcc
diff --git a/test/unittest/usdt/tst.static.sh b/test/unittest/usdt/tst.static.sh
index 62c89296bfba..08609691f4ac 100755
--- a/test/unittest/usdt/tst.static.sh
+++ b/test/unittest/usdt/tst.static.sh
@@ -9,7 +9,6 @@ if [ $# != 1 ]; then
 	echo expected one argument: '<'dtrace-path'>'
 	exit 2
 fi
-# @@xfail: dtv2
 
 dtrace=$1
 CC=/usr/bin/gcc
diff --git a/test/unittest/usdt/tst.static2.sh b/test/unittest/usdt/tst.static2.sh
index b1aa674fe4ea..40da74c3b94d 100755
--- a/test/unittest/usdt/tst.static2.sh
+++ b/test/unittest/usdt/tst.static2.sh
@@ -8,7 +8,6 @@
 # Rebuilding an object file containing DOF changes slightly when the object
 # files containing the probes have already been modified. This tests that
 # case by generating the DOF object, removing it, and building it again.
-# @@xfail: dtv2
 
 if [ $# != 1 ]; then
 	echo expected one argument: '<'dtrace-path'>'
diff --git a/test/unittest/usdt/tst.tailcall.d b/test/unittest/usdt/tst.tailcall.d
index e2d5508e6dce..11b2ff93cbf0 100644
--- a/test/unittest/usdt/tst.tailcall.d
+++ b/test/unittest/usdt/tst.tailcall.d
@@ -5,7 +5,7 @@
  * http://oss.oracle.com/licenses/upl.
  */
 
-/* @@xfail: dtv2 */
+/* @@xfail: dtv2, no is-enabled probes yet */
 /* @@trigger: usdt-tst-special 1 */
 
 #pragma D option quiet
@@ -13,7 +13,7 @@
 /*
  * ASSERTION:
  *	Make sure that if a probe is rendered into a tail call by the compiler,
- *	we can still use it.  Fo architectures that do not compile the trigger
+ *	we can still use it.  For architectures that do not compile the trigger
  *	code into a tail-call scenario, this will work as a regular USDT probe
  *	test as last instruction of a function.
  */
-- 
2.37.1.265.g363c192786.dirty




More information about the DTrace-devel mailing list