[PATCH] test: skip D return() action for kernels without support

Kris Van Hees <[email protected]>
Newsgroups dev.linux.lists.dtrace
Message-ID <BY5PR10MB3987606C19FA5E4C88EDC68EC2E8A@BY5PR10MB3987.namprd10.prod.outlook.com>
Most of the err.* tests can still be run, since they test other failure
modes.

Suggested-by: Eugene Loh <[email protected]>
Signed-off-by: Kris Van Hees <[email protected]>
---
 test/unittest/actions/return/err.destructive.x    |  1 +
 test/unittest/actions/return/tst.destructive.x    | 15 +++++++++++++++
 .../actions/return/tst.override-getpid-entry.x    |  1 +
 .../actions/return/tst.override-getpid-return.x   |  1 +
 4 files changed, 18 insertions(+)
 create mode 120000 test/unittest/actions/return/err.destructive.x
 create mode 100755 test/unittest/actions/return/tst.destructive.x
 create mode 120000 test/unittest/actions/return/tst.override-getpid-entry.x
 create mode 120000 test/unittest/actions/return/tst.override-getpid-return.x

diff --git a/test/unittest/actions/return/err.destructive.x b/test/unittest/actions/return/err.destructive.x
new file mode 120000
index 00000000..36e16002
--- /dev/null
+++ b/test/unittest/actions/return/err.destructive.x
@@ -0,0 +1 @@
+tst.destructive.x
\ No newline at end of file
diff --git a/test/unittest/actions/return/tst.destructive.x b/test/unittest/actions/return/tst.destructive.x
new file mode 100755
index 00000000..3157408b
--- /dev/null
+++ b/test/unittest/actions/return/tst.destructive.x
@@ -0,0 +1,15 @@
+#!/bin/bash
+#
+# Oracle Linux DTrace.
+# Copyright (c) 2025, 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.
+
+# Verify that the return() action can be used on the current kernel, i.e. that
+# function error injection and BPF kprobe override is enabled.
+
+if [[ -r /sys/kernel/debug/error_injection/list ]]; then
+	exit 0
+else
+	exit 2
+fi
diff --git a/test/unittest/actions/return/tst.override-getpid-entry.x b/test/unittest/actions/return/tst.override-getpid-entry.x
new file mode 120000
index 00000000..36e16002
--- /dev/null
+++ b/test/unittest/actions/return/tst.override-getpid-entry.x
@@ -0,0 +1 @@
+tst.destructive.x
\ No newline at end of file
diff --git a/test/unittest/actions/return/tst.override-getpid-return.x b/test/unittest/actions/return/tst.override-getpid-return.x
new file mode 120000
index 00000000..36e16002
--- /dev/null
+++ b/test/unittest/actions/return/tst.override-getpid-return.x
@@ -0,0 +1 @@
+tst.destructive.x
\ No newline at end of file
-- 
2.51.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.