[DTrace-devel] [PATCH] unittest/print: add test covering module-defined type
Alan Maguire
alan.maguire at oracle.com
Wed Apr 24 09:23:14 UTC 2024
print() action tests do not cover module-defined types. Add a test
using a module-defined type that has not changed recently.
struct tun_page was chosen since it is identical in UEK6U3 and upstream
and declared in tun.c which is a module on most distros.
To pass this tests requires the fix in [1]
Suggested-by: Nick Alcock <nick.alcock at oracle.com>
Signed-off-by: Alan Maguire <alan.maguire at oracle.com>
[1] https://oss.oracle.com/pipermail/dtrace-devel/2024-April/004764.html
---
test/unittest/print/tst.print.modtype.d | 18 ++++++++++++++++++
test/unittest/print/tst.print.modtype.r | 6 ++++++
2 files changed, 24 insertions(+)
create mode 100644 test/unittest/print/tst.print.modtype.d
create mode 100644 test/unittest/print/tst.print.modtype.r
diff --git a/test/unittest/print/tst.print.modtype.d b/test/unittest/print/tst.print.modtype.d
new file mode 100644
index 00000000..ed68b492
--- /dev/null
+++ b/test/unittest/print/tst.print.modtype.d
@@ -0,0 +1,18 @@
+/*
+ * Oracle Linux DTrace.
+ * Copyright (c) 2024, 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.
+ */
+/* @@nosort */
+
+#pragma D option quiet
+
+BEGIN
+{
+ tun_page = (struct tun_page *)alloca(sizeof (struct tun_page));
+ tun_page->page = (struct page *)0xfeedfacefeedface;
+ tun_page->count = 123;
+ print(tun_page);
+ exit(0);
+}
diff --git a/test/unittest/print/tst.print.modtype.r b/test/unittest/print/tst.print.modtype.r
new file mode 100644
index 00000000..b9736607
--- /dev/null
+++ b/test/unittest/print/tst.print.modtype.r
@@ -0,0 +1,6 @@
+{ptr} = *
+ (struct tun_page) {
+ .page = (struct page *){ptr},
+ .count = (int)123,
+ }
+
--
2.39.3
More information about the DTrace-devel
mailing list