[DTrace-devel] [PATCH 04/15 v2] Provide additional tests for the exit() action
Kris Van Hees
kris.van.hees at oracle.com
Fri May 29 10:59:24 PDT 2020
Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>
---
.../actions/exit/err.D_PROTO_ARG.str.d | 19 +++++++++++++++++
.../actions/exit/err.D_PROTO_ARG.str.r | 4 ++++
.../actions/exit/err.D_PROTO_ARG.void.d | 19 +++++++++++++++++
.../actions/exit/err.D_PROTO_ARG.void.r | 4 ++++
....noarg.d => err.D_PROTO_LEN.missing_arg.d} | 0
.../exit/err.D_PROTO_LEN.missing_arg.r | 2 ++
.../actions/exit/err.D_PROTO_LEN.noarg.r | 2 --
.../exit/err.D_PROTO_LEN.too_many_args.d | 19 +++++++++++++++++
.../exit/err.D_PROTO_LEN.too_many_args.r | 2 ++
test/unittest/actions/exit/err.fail.d | 2 +-
test/unittest/actions/exit/tst.expr.d | 21 +++++++++++++++++++
test/unittest/actions/exit/tst.expr.r | 1 +
12 files changed, 92 insertions(+), 3 deletions(-)
create mode 100644 test/unittest/actions/exit/err.D_PROTO_ARG.str.d
create mode 100644 test/unittest/actions/exit/err.D_PROTO_ARG.str.r
create mode 100644 test/unittest/actions/exit/err.D_PROTO_ARG.void.d
create mode 100644 test/unittest/actions/exit/err.D_PROTO_ARG.void.r
rename test/unittest/actions/exit/{err.D_PROTO_LEN.noarg.d => err.D_PROTO_LEN.missing_arg.d} (100%)
create mode 100644 test/unittest/actions/exit/err.D_PROTO_LEN.missing_arg.r
delete mode 100644 test/unittest/actions/exit/err.D_PROTO_LEN.noarg.r
create mode 100644 test/unittest/actions/exit/err.D_PROTO_LEN.too_many_args.d
create mode 100644 test/unittest/actions/exit/err.D_PROTO_LEN.too_many_args.r
create mode 100644 test/unittest/actions/exit/tst.expr.d
create mode 100644 test/unittest/actions/exit/tst.expr.r
diff --git a/test/unittest/actions/exit/err.D_PROTO_ARG.str.d b/test/unittest/actions/exit/err.D_PROTO_ARG.str.d
new file mode 100644
index 00000000..e3ef0158
--- /dev/null
+++ b/test/unittest/actions/exit/err.D_PROTO_ARG.str.d
@@ -0,0 +1,19 @@
+/*
+ * Oracle Linux DTrace.
+ * Copyright (c) 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.
+ */
+
+/*
+ * ASSERTION: The exit() action cannot be passed a string argument.
+ *
+ * SECTION: Actions and Subroutines/exit()
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+ exit("");
+}
diff --git a/test/unittest/actions/exit/err.D_PROTO_ARG.str.r b/test/unittest/actions/exit/err.D_PROTO_ARG.str.r
new file mode 100644
index 00000000..6d259e68
--- /dev/null
+++ b/test/unittest/actions/exit/err.D_PROTO_ARG.str.r
@@ -0,0 +1,4 @@
+-- @@stderr --
+dtrace: failed to compile script test/unittest/actions/exit/err.D_PROTO_ARG.str.d: [D_PROTO_ARG] line 18: exit( ) argument #1 is incompatible with prototype:
+ prototype: int
+ argument: string
diff --git a/test/unittest/actions/exit/err.D_PROTO_ARG.void.d b/test/unittest/actions/exit/err.D_PROTO_ARG.void.d
new file mode 100644
index 00000000..7a635372
--- /dev/null
+++ b/test/unittest/actions/exit/err.D_PROTO_ARG.void.d
@@ -0,0 +1,19 @@
+/*
+ * Oracle Linux DTrace.
+ * Copyright (c) 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.
+ */
+
+/*
+ * ASSERTION: The exit() action cannot be passed a void argument.
+ *
+ * SECTION: Actions and Subroutines/exit()
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+ exit(exit(0));
+}
diff --git a/test/unittest/actions/exit/err.D_PROTO_ARG.void.r b/test/unittest/actions/exit/err.D_PROTO_ARG.void.r
new file mode 100644
index 00000000..6d357eab
--- /dev/null
+++ b/test/unittest/actions/exit/err.D_PROTO_ARG.void.r
@@ -0,0 +1,4 @@
+-- @@stderr --
+dtrace: failed to compile script test/unittest/actions/exit/err.D_PROTO_ARG.void.d: [D_PROTO_ARG] line 18: exit( ) argument #1 is incompatible with prototype:
+ prototype: int
+ argument: void
diff --git a/test/unittest/actions/exit/err.D_PROTO_LEN.noarg.d b/test/unittest/actions/exit/err.D_PROTO_LEN.missing_arg.d
similarity index 100%
rename from test/unittest/actions/exit/err.D_PROTO_LEN.noarg.d
rename to test/unittest/actions/exit/err.D_PROTO_LEN.missing_arg.d
diff --git a/test/unittest/actions/exit/err.D_PROTO_LEN.missing_arg.r b/test/unittest/actions/exit/err.D_PROTO_LEN.missing_arg.r
new file mode 100644
index 00000000..d8a95f6c
--- /dev/null
+++ b/test/unittest/actions/exit/err.D_PROTO_LEN.missing_arg.r
@@ -0,0 +1,2 @@
+-- @@stderr --
+dtrace: failed to compile script test/unittest/actions/exit/err.D_PROTO_LEN.missing_arg.d: [D_PROTO_LEN] line 18: exit( ) prototype mismatch: 0 args passed, 1 expected
diff --git a/test/unittest/actions/exit/err.D_PROTO_LEN.noarg.r b/test/unittest/actions/exit/err.D_PROTO_LEN.noarg.r
deleted file mode 100644
index db1e1510..00000000
--- a/test/unittest/actions/exit/err.D_PROTO_LEN.noarg.r
+++ /dev/null
@@ -1,2 +0,0 @@
--- @@stderr --
-dtrace: failed to compile script test/unittest/actions/exit/err.D_PROTO_LEN.noarg.d: [D_PROTO_LEN] line 18: exit( ) prototype mismatch: 0 args passed, 1 expected
diff --git a/test/unittest/actions/exit/err.D_PROTO_LEN.too_many_args.d b/test/unittest/actions/exit/err.D_PROTO_LEN.too_many_args.d
new file mode 100644
index 00000000..007e9342
--- /dev/null
+++ b/test/unittest/actions/exit/err.D_PROTO_LEN.too_many_args.d
@@ -0,0 +1,19 @@
+/*
+ * Oracle Linux DTrace.
+ * Copyright (c) 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.
+ */
+
+/*
+ * ASSERTION: The exit() action requires exactly one argument.
+ *
+ * SECTION: Actions and Subroutines/exit()
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+ exit(0, 1);
+}
diff --git a/test/unittest/actions/exit/err.D_PROTO_LEN.too_many_args.r b/test/unittest/actions/exit/err.D_PROTO_LEN.too_many_args.r
new file mode 100644
index 00000000..d21002d2
--- /dev/null
+++ b/test/unittest/actions/exit/err.D_PROTO_LEN.too_many_args.r
@@ -0,0 +1,2 @@
+-- @@stderr --
+dtrace: failed to compile script test/unittest/actions/exit/err.D_PROTO_LEN.too_many_args.d: [D_PROTO_LEN] line 18: exit( ) prototype mismatch: 2 args passed, 1 expected
diff --git a/test/unittest/actions/exit/err.fail.d b/test/unittest/actions/exit/err.fail.d
index 046d1637..c08f96ec 100644
--- a/test/unittest/actions/exit/err.fail.d
+++ b/test/unittest/actions/exit/err.fail.d
@@ -6,7 +6,7 @@
*/
/*
- * ASSERTION: Calling exit(n) indicates failures if n is not 0.
+ * ASSERTION: Calling exit(n) indicates failure if n is not 0.
*
* SECTION: Actions and Subroutines/exit()
*/
diff --git a/test/unittest/actions/exit/tst.expr.d b/test/unittest/actions/exit/tst.expr.d
new file mode 100644
index 00000000..83c8f778
--- /dev/null
+++ b/test/unittest/actions/exit/tst.expr.d
@@ -0,0 +1,21 @@
+/*
+ * Oracle Linux DTrace.
+ * Copyright (c) 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.
+ */
+
+/*
+ * ASSERTION: Calling exit(n) with an expression that evaluates to 0 indicates
+ * success.
+ *
+ * SECTION: Actions and Subroutines/exit()
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+ x = 1;
+ exit(x - 1);
+}
diff --git a/test/unittest/actions/exit/tst.expr.r b/test/unittest/actions/exit/tst.expr.r
new file mode 100644
index 00000000..8b137891
--- /dev/null
+++ b/test/unittest/actions/exit/tst.expr.r
@@ -0,0 +1 @@
+
--
2.26.0
More information about the DTrace-devel
mailing list