Skip to contentSkip to conversation

test: add missing expectations and update diagnostics

PATCH In review Kris Van Hees 2 participants 2 messages Sep 28 – Oct 3

lore
Share & tools
lore
#0 lore raw

PATCH 8/8 test: add missing expectations and update diagnostics

---
 test/unittest/lexer/tst.keyword-member.d      |  2 ++
 test/unittest/lexer/tst.keyword-member.r      |  1 +
 test/unittest/lexer/tst.keyword-member.r.p    | 22 +++++++++++++++++++
 .../unittest/types/err.D_CAST_INVAL.badcast.r |  2 ++
 .../unittest/types/err.D_DECL_SCOPE.badenum.d | 19 ++++++++++++++++
 .../types/err.D_DECL_SCOPE.badstruct.d        | 17 ++++++++++++++
 test/unittest/types/err.D_SYNTAX.badenum.d    |  7 +++---
 test/unittest/types/err.D_SYNTAX.badenum.r    |  2 +-
 test/unittest/types/err.D_SYNTAX.badid.d      |  3 +--
 test/unittest/types/err.D_SYNTAX.badstruct.d  |  7 +++---
 test/unittest/types/err.D_SYNTAX.badstruct.r  |  2 +-
 test/unittest/types/err.unloaded_var.r        |  2 +-
 12 files changed, 73 insertions(+), 13 deletions(-)
 create mode 100644 test/unittest/lexer/tst.keyword-member.r
 create mode 100755 test/unittest/lexer/tst.keyword-member.r.p
 create mode 100644 test/unittest/types/err.D_CAST_INVAL.badcast.r
 create mode 100644 test/unittest/types/err.D_DECL_SCOPE.badenum.d
 create mode 100644 test/unittest/types/err.D_DECL_SCOPE.badstruct.d
test/unittest/lexer/tst.keyword-member.d +2 -0
index 0c3650e3..18d78c70 100644
@@ -11,6 +11,8 @@
  *      after -> and after ., even with comments interjected.
  */
 
+#pragma D option quiet
+
 BEGIN
 {
 	printf("%p\n", &(*(struct cgroup_root *)&`cgrp_dfl_root).cgrp.self);
test/unittest/lexer/tst.keyword-member.r new file +1 -0
new file mode 100644
index 00000000..808ef419
@@ -0,0 +1 @@
+All pointers are identical (as expected).
test/unittest/lexer/tst.keyword-member.r.p new file +22 -0
new file mode 100755
index 00000000..4eb25f23
@@ -0,0 +1,22 @@
+#!/usr/bin/gawk -f
+
+NR == 1 {
+	val = $1;
+}
+
+NF > 0 {
+	if ($1 != val) {
+		print "Output line " NR ": Expected " val ", got " $1;
+		fail++;
+	}
+}
+
+END {
+	if (fail) {
+		print fail " failures";
+		exit(1);
+	} else {
+		print "All pointers are identical (as expected).";
+		exit(0);
+	}
+}
test/unittest/types/err.D_CAST_INVAL.badcast.r new file +2 -0
new file mode 100644
index 00000000..0c62733f
@@ -0,0 +1,2 @@
+-- @@stderr --
+dtrace: failed to compile script test/unittest/types/err.D_CAST_INVAL.badcast.d: [D_CAST_INVAL] line 14: invalid cast expression: "void" to "struct task_struct"
test/unittest/types/err.D_DECL_SCOPE.badenum.d new file +19 -0
new file mode 100644
index 00000000..77e3d68d
@@ -0,0 +1,19 @@
+/*
+ * Oracle Linux DTrace.
+ * Copyright (c) 2006, 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:
+ *   Test a bogus enum declaration using an invalid identifer.
+ *
+ * SECTION: Type and Constant Definitions/Enumerations
+ */
+
+
+enum foo`bar
+{
+
+};
test/unittest/types/err.D_DECL_SCOPE.badstruct.d new file +17 -0
new file mode 100644
index 00000000..f8b1884d
@@ -0,0 +1,17 @@
+/*
+ * Oracle Linux DTrace.
+ * Copyright (c) 2006, 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:
+ *   Attempt a bogus struct declaration using an invalid identifer.
+ *
+ * SECTION: Structs and Unions/Structs
+ */
+
+struct foo`bar {
+
+};
test/unittest/types/err.D_SYNTAX.badenum.d +3 -4
index 77e3d68d..6717dd84 100644
@@ -1,19 +1,18 @@
 /*
  * Oracle Linux DTrace.
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2026, 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:
- *   Test a bogus enum declaration using an invalid identifer.
+ * ASSERTION: Test a bogus enum declaration using an invalid identifer.
  *
  * SECTION: Type and Constant Definitions/Enumerations
  */
 
 
-enum foo`bar
+enum foo.bar
 {
 
 };
test/unittest/types/err.D_SYNTAX.badenum.r +1 -1
index 834c2b1c..9a14d317 100644
@@ -1,2 +1,2 @@
 -- @@stderr --
-dtrace: failed to compile script test/unittest/types/err.D_SYNTAX.badenum.d: [D_SYNTAX] line 19: syntax error near "}"
+dtrace: failed to compile script test/unittest/types/err.D_SYNTAX.badenum.d: [D_SYNTAX] line 15: syntax error near "."
test/unittest/types/err.D_SYNTAX.badid.d +1 -2
index 23d026f3..8f234539 100644
@@ -6,8 +6,7 @@
  */
 
 /*
- * ASSERTION:
- *	Identifiers cannot begin with a digit
+ * ASSERTION: Identifiers cannot begin with a digit
  *
  * SECTION: Types, Operators, and Expressions/Identifier Names and Keywords
  */
test/unittest/types/err.D_SYNTAX.badstruct.d +3 -4
index f8b1884d..a4c8149c 100644
@@ -1,17 +1,16 @@
 /*
  * Oracle Linux DTrace.
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2026, 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:
- *   Attempt a bogus struct declaration using an invalid identifer.
+ * ASSERTION: Attempt a bogus struct declaration using an invalid identifer.
  *
  * SECTION: Structs and Unions/Structs
  */
 
-struct foo`bar {
+struct foo.bar {
 
 };
test/unittest/types/err.D_SYNTAX.badstruct.r +1 -1
index da798f0e..37ff0051 100644
@@ -1,2 +1,2 @@
 -- @@stderr --
-dtrace: failed to compile script test/unittest/types/err.D_SYNTAX.badstruct.d: [D_SYNTAX] line 17: syntax error near "}"
+dtrace: failed to compile script test/unittest/types/err.D_SYNTAX.badstruct.d: [D_SYNTAX] line 14: syntax error near "."
test/unittest/types/err.unloaded_var.r +1 -1
index ac7972c7..d8c59c5e 100644
@@ -1,2 +1,2 @@
 -- @@stderr --
-dtrace: failed to compile script test/unittest/types/err.unloaded_var.d: line 21: failed to resolve gfs2`gfs2_control_wq: Module is no longer loaded
+dtrace: failed to compile script test/unittest/types/err.unloaded_var.d: line 21: failed to resolve gfs2`gfs2_control_wq: Unknown module name
Signature · 1 line
2.52.0
Reviewed-by on v1 8/8
#1 lore raw
Quoted 225 lines · Kris Van Hees via DTrace-devel
---
 test/unittest/lexer/tst.keyword-member.d      |  2 ++
 test/unittest/lexer/tst.keyword-member.r      |  1 +
 test/unittest/lexer/tst.keyword-member.r.p    | 22 +++++++++++++++++++
 .../unittest/types/err.D_CAST_INVAL.badcast.r |  2 ++
 .../unittest/types/err.D_DECL_SCOPE.badenum.d | 19 ++++++++++++++++
 .../types/err.D_DECL_SCOPE.badstruct.d        | 17 ++++++++++++++
 test/unittest/types/err.D_SYNTAX.badenum.d    |  7 +++---
 test/unittest/types/err.D_SYNTAX.badenum.r    |  2 +-
 test/unittest/types/err.D_SYNTAX.badid.d      |  3 +--
 test/unittest/types/err.D_SYNTAX.badstruct.d  |  7 +++---
 test/unittest/types/err.D_SYNTAX.badstruct.r  |  2 +-
 test/unittest/types/err.unloaded_var.r        |  2 +-
 12 files changed, 73 insertions(+), 13 deletions(-)
 create mode 100644 test/unittest/lexer/tst.keyword-member.r
 create mode 100755 test/unittest/lexer/tst.keyword-member.r.p
 create mode 100644 test/unittest/types/err.D_CAST_INVAL.badcast.r
 create mode 100644 test/unittest/types/err.D_DECL_SCOPE.badenum.d
 create mode 100644 test/unittest/types/err.D_DECL_SCOPE.badstruct.d
test/unittest/lexer/tst.keyword-member.d +2 -0
index 0c3650e3..18d78c70 100644
@@ -11,6 +11,8 @@
  *      after -> and after ., even with comments interjected.
  */
 
+#pragma D option quiet
+
 BEGIN
 {
 	printf("%p\n", &(*(struct cgroup_root *)&`cgrp_dfl_root).cgrp.self);
test/unittest/lexer/tst.keyword-member.r new file +1 -0
new file mode 100644
index 00000000..808ef419
@@ -0,0 +1 @@
+All pointers are identical (as expected).
test/unittest/lexer/tst.keyword-member.r.p new file +22 -0
new file mode 100755
index 00000000..4eb25f23
@@ -0,0 +1,22 @@
+#!/usr/bin/gawk -f
+
+NR == 1 {
+	val = $1;
+}
+
+NF > 0 {
+	if ($1 != val) {
+		print "Output line " NR ": Expected " val ", got " $1;
+		fail++;
+	}
+}
+
+END {
+	if (fail) {
+		print fail " failures";
+		exit(1);
+	} else {
+		print "All pointers are identical (as expected).";
+		exit(0);
+	}
+}
test/unittest/types/err.D_CAST_INVAL.badcast.r new file +2 -0
new file mode 100644
index 00000000..0c62733f
@@ -0,0 +1,2 @@
+-- @@stderr --
+dtrace: failed to compile script test/unittest/types/err.D_CAST_INVAL.badcast.d: [D_CAST_INVAL] line 14: invalid cast expression: "void" to "struct task_struct"
test/unittest/types/err.D_DECL_SCOPE.badenum.d new file +19 -0
new file mode 100644
index 00000000..77e3d68d
@@ -0,0 +1,19 @@
+/*
+ * Oracle Linux DTrace.
+ * Copyright (c) 2006, 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:
+ *   Test a bogus enum declaration using an invalid identifer.
+ *
+ * SECTION: Type and Constant Definitions/Enumerations
+ */
+
+
+enum foo`bar
+{
+
+};
test/unittest/types/err.D_DECL_SCOPE.badstruct.d new file +17 -0
new file mode 100644
index 00000000..f8b1884d
@@ -0,0 +1,17 @@
+/*
+ * Oracle Linux DTrace.
+ * Copyright (c) 2006, 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:
+ *   Attempt a bogus struct declaration using an invalid identifer.
+ *
+ * SECTION: Structs and Unions/Structs
+ */
+
+struct foo`bar {
+
+};
test/unittest/types/err.D_SYNTAX.badenum.d +3 -4
index 77e3d68d..6717dd84 100644
@@ -1,19 +1,18 @@
 /*
  * Oracle Linux DTrace.
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2026, 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:
- *   Test a bogus enum declaration using an invalid identifer.
+ * ASSERTION: Test a bogus enum declaration using an invalid identifer.
  *
  * SECTION: Type and Constant Definitions/Enumerations
  */
 
 
-enum foo`bar
+enum foo.bar
 {
 
 };
test/unittest/types/err.D_SYNTAX.badenum.r +1 -1
index 834c2b1c..9a14d317 100644
@@ -1,2 +1,2 @@
 -- @@stderr --
-dtrace: failed to compile script test/unittest/types/err.D_SYNTAX.badenum.d: [D_SYNTAX] line 19: syntax error near "}"
+dtrace: failed to compile script test/unittest/types/err.D_SYNTAX.badenum.d: [D_SYNTAX] line 15: syntax error near "."
test/unittest/types/err.D_SYNTAX.badid.d +1 -2
index 23d026f3..8f234539 100644
@@ -6,8 +6,7 @@
  */
 
 /*
- * ASSERTION:
- *	Identifiers cannot begin with a digit
+ * ASSERTION: Identifiers cannot begin with a digit
  *
  * SECTION: Types, Operators, and Expressions/Identifier Names and Keywords
  */
test/unittest/types/err.D_SYNTAX.badstruct.d +3 -4
index f8b1884d..a4c8149c 100644
@@ -1,17 +1,16 @@
 /*
  * Oracle Linux DTrace.
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2026, 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:
- *   Attempt a bogus struct declaration using an invalid identifer.
+ * ASSERTION: Attempt a bogus struct declaration using an invalid identifer.
  *
  * SECTION: Structs and Unions/Structs
  */
 
-struct foo`bar {
+struct foo.bar {
 
 };
test/unittest/types/err.D_SYNTAX.badstruct.r +1 -1
index da798f0e..37ff0051 100644
@@ -1,2 +1,2 @@
 -- @@stderr --
-dtrace: failed to compile script test/unittest/types/err.D_SYNTAX.badstruct.d: [D_SYNTAX] line 17: syntax error near "}"
+dtrace: failed to compile script test/unittest/types/err.D_SYNTAX.badstruct.d: [D_SYNTAX] line 14: syntax error near "."
test/unittest/types/err.unloaded_var.r +1 -1
index ac7972c7..d8c59c5e 100644
@@ -1,2 +1,2 @@
 -- @@stderr --
-dtrace: failed to compile script test/unittest/types/err.unloaded_var.d: line 21: failed to resolve gfs2`gfs2_control_wq: Module is no longer loaded
+dtrace: failed to compile script test/unittest/types/err.unloaded_var.d: line 21: failed to resolve gfs2`gfs2_control_wq: Unknown module name
Signature · 7 lines
2.52.0


_______________________________________________
DTrace-devel mailing list
[email protected]
https://oss.oracle.com/mailman/listinfo/dtrace-devel