[DTrace-devel] [PATCH] test: Add test for option "version"
eugene.loh at oracle.com
eugene.loh at oracle.com
Sat Feb 18 01:10:39 UTC 2023
From: Eugene Loh <eugene.loh at oracle.com>
Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
---
test/unittest/options/err.version.d | 17 +++++++++++++++++
test/unittest/options/err.version.r | 2 ++
test/unittest/options/tst.version.r | 2 ++
test/unittest/options/tst.version.sh | 15 +++++++++++++++
4 files changed, 36 insertions(+)
create mode 100644 test/unittest/options/err.version.d
create mode 100644 test/unittest/options/err.version.r
create mode 100644 test/unittest/options/tst.version.r
create mode 100755 test/unittest/options/tst.version.sh
diff --git a/test/unittest/options/err.version.d b/test/unittest/options/err.version.d
new file mode 100644
index 00000000..bd86e13f
--- /dev/null
+++ b/test/unittest/options/err.version.d
@@ -0,0 +1,17 @@
+/*
+ * Oracle Linux DTrace.
+ * Copyright (c) 2023, 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.
+ */
+
+/*
+ * ASSERTION: The -xversion option works.
+ *
+ * SECTION: Options and Tunables/Consumer Options
+ */
+
+/* @@runtest-opts: -xversion=99.1 */
+BEGIN {
+ exit(0);
+}
diff --git a/test/unittest/options/err.version.r b/test/unittest/options/err.version.r
new file mode 100644
index 00000000..6cdd1f7f
--- /dev/null
+++ b/test/unittest/options/err.version.r
@@ -0,0 +1,2 @@
+-- @@stderr --
+dtrace: failed to set -x version: Requested version is not supported by compiler
diff --git a/test/unittest/options/tst.version.r b/test/unittest/options/tst.version.r
new file mode 100644
index 00000000..15010b3d
--- /dev/null
+++ b/test/unittest/options/tst.version.r
@@ -0,0 +1,2 @@
+version is 2.0
+
diff --git a/test/unittest/options/tst.version.sh b/test/unittest/options/tst.version.sh
new file mode 100755
index 00000000..cd069aa7
--- /dev/null
+++ b/test/unittest/options/tst.version.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+#
+# Oracle Linux DTrace.
+# Copyright (c) 2023, 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.
+#
+
+dtrace=$1
+
+myversion=`$dtrace $dt_flags -V | awk '{ print $NF }'`
+echo version is $myversion
+
+$dtrace $dt_flags -xversion=$myversion -qn 'BEGIN { exit(0) }'
+exit $?
--
2.18.4
More information about the DTrace-devel
mailing list