[DTrace-devel] [PATCH v2 03/12] Overhaul the stackdepth value test
eugene.loh at oracle.com
eugene.loh at oracle.com
Tue Jun 8 14:54:22 PDT 2021
From: Eugene Loh <eugene.loh at oracle.com>
This test checks the value of stackdepth by using stack() as a
consistency check. Address the following shortcomings:
1) The test fires in BEGIN, which no longer has a kernel stack.
2) The test incorrectly counts stack frames.
3) The test passes because neither stack() nor stackdepth is implemented!
(Currently, stack() always reports nothing and stackdepth always 0.)
4) An ERROR in the D script would cause the test to hang.
The corrected test will XFAIL until stack() and stackdepth are implemented.
Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
---
test/unittest/stackdepth/tst.value.d | 14 +++++++++++++-
test/unittest/stackdepth/tst.value.r.p | 8 +++++---
2 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/test/unittest/stackdepth/tst.value.d b/test/unittest/stackdepth/tst.value.d
index 857728bd..a729bd3f 100644
--- a/test/unittest/stackdepth/tst.value.d
+++ b/test/unittest/stackdepth/tst.value.d
@@ -1,10 +1,12 @@
/*
* Oracle Linux DTrace.
- * Copyright (c) 2006, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2021, 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.
*/
+/* @@xfail: dtv2 */
+#pragma D option destructive
#pragma D option quiet
/*
@@ -16,6 +18,11 @@
*/
BEGIN
+{
+ system("echo write something > /dev/null");
+}
+
+fbt::__vfs_write:entry
{
printf("DEPTH %d\n", stackdepth);
printf("TRACE BEGIN\n");
@@ -23,3 +30,8 @@ BEGIN
printf("TRACE END\n");
exit(0);
}
+
+ERROR
+{
+ exit(1);
+}
diff --git a/test/unittest/stackdepth/tst.value.r.p b/test/unittest/stackdepth/tst.value.r.p
index d5143e38..9b071181 100755
--- a/test/unittest/stackdepth/tst.value.r.p
+++ b/test/unittest/stackdepth/tst.value.r.p
@@ -1,6 +1,6 @@
#!/usr/bin/gawk -f
# Oracle Linux DTrace.
-# Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2016, 2021, 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.
@@ -12,12 +12,12 @@
getline;
count = 0;
while ($0 !~ /^TRACE END/) {
+ if (NF)
+ count++;
if (getline != 1) {
print "EOF or error while processing stack\n";
exit 0;
}
- if (NF)
- count++;
}
}
@@ -26,6 +26,8 @@ END {
printf "Stack depth too large (%d > %d)\n", depth, count;
else if (count > depth)
printf "Stack depth too small (%d < %d)\n", depth, count;
+ else if (count == 0)
+ printf "Stack depth is 0\n";
else
printf "Stack depth OK\n";
}
--
2.18.4
More information about the DTrace-devel
mailing list