From: eugene.loh@oracle.com
To: dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com
Subject: [PATCH 3/5] test: Fix some ustackdepth tests
Date: Wed, 1 Oct 2025 02:24:16 -0400 [thread overview]
Message-ID: <20251001062418.6902-3-eugene.loh@oracle.com> (raw)
In-Reply-To: <20251001062418.6902-1-eugene.loh@oracle.com>
From: Eugene Loh <eugene.loh@oracle.com>
Fix these issues.
Issue 1.
In commit e48bf6a23 ("Add support for built-in variable ustackdepth"),
tests ustackdepth2 and ustackdepth_big were introduced and their .r and
.r.p files were links to those of the stackdepth2 test.
In commit 842eabc0e
("test: caller and stackdepth tests for fbt provider"), the stackdepth2
test was explicitly renamed "fbt" since tests for many providers were
being introduced. The links of the earlier patch were not updated.
Issue 2.
The ustackdepth_big test modified perf_event_max_stack. If the test
were interrupted, the value was not restored.
Issue 3.
That ustackdepth_big test only checked that the stackdepth was
consistent with the reported stack. While this check is good, it missed
the point of the test, which is that the system limit could be
increased.
Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
---
.../variables/bvar/tst.ustackdepth2.r | 2 +-
.../variables/bvar/tst.ustackdepth2.r.p | 2 +-
.../variables/bvar/tst.ustackdepth_big.r | 1 -
.../variables/bvar/tst.ustackdepth_big.r.p | 1 -
.../variables/bvar/tst.ustackdepth_big.sh | 34 +++++++++++++++++--
5 files changed, 34 insertions(+), 6 deletions(-)
mode change 120000 => 100644 test/unittest/variables/bvar/tst.ustackdepth2.r
delete mode 120000 test/unittest/variables/bvar/tst.ustackdepth_big.r
delete mode 120000 test/unittest/variables/bvar/tst.ustackdepth_big.r.p
diff --git a/test/unittest/variables/bvar/tst.ustackdepth2.r b/test/unittest/variables/bvar/tst.ustackdepth2.r
deleted file mode 120000
index 5cc8498f8..000000000
--- a/test/unittest/variables/bvar/tst.ustackdepth2.r
+++ /dev/null
@@ -1 +0,0 @@
-tst.stackdepth2.r
\ No newline at end of file
diff --git a/test/unittest/variables/bvar/tst.ustackdepth2.r b/test/unittest/variables/bvar/tst.ustackdepth2.r
new file mode 100644
index 000000000..3bd29b8ed
--- /dev/null
+++ b/test/unittest/variables/bvar/tst.ustackdepth2.r
@@ -0,0 +1 @@
+Stack depth OK
diff --git a/test/unittest/variables/bvar/tst.ustackdepth2.r.p b/test/unittest/variables/bvar/tst.ustackdepth2.r.p
index 8320b603c..e50f12822 120000
--- a/test/unittest/variables/bvar/tst.ustackdepth2.r.p
+++ b/test/unittest/variables/bvar/tst.ustackdepth2.r.p
@@ -1 +1 @@
-tst.stackdepth2.r.p
\ No newline at end of file
+check_stackdepth_to_stack.awk
\ No newline at end of file
diff --git a/test/unittest/variables/bvar/tst.ustackdepth_big.r b/test/unittest/variables/bvar/tst.ustackdepth_big.r
deleted file mode 120000
index b6a2d6bcd..000000000
--- a/test/unittest/variables/bvar/tst.ustackdepth_big.r
+++ /dev/null
@@ -1 +0,0 @@
-tst.ustackdepth2.r
\ No newline at end of file
diff --git a/test/unittest/variables/bvar/tst.ustackdepth_big.r.p b/test/unittest/variables/bvar/tst.ustackdepth_big.r.p
deleted file mode 120000
index 0e8338907..000000000
--- a/test/unittest/variables/bvar/tst.ustackdepth_big.r.p
+++ /dev/null
@@ -1 +0,0 @@
-tst.ustackdepth2.r.p
\ No newline at end of file
diff --git a/test/unittest/variables/bvar/tst.ustackdepth_big.sh b/test/unittest/variables/bvar/tst.ustackdepth_big.sh
index 777940ec8..e84850c02 100755
--- a/test/unittest/variables/bvar/tst.ustackdepth_big.sh
+++ b/test/unittest/variables/bvar/tst.ustackdepth_big.sh
@@ -14,11 +14,19 @@
dtrace=$1
+POSTPROC=$PWD/test/unittest/variables/bvar/check_stackdepth_to_stack.awk
+TRIGGER=$PWD/test/triggers/ustack-tst-bigstack-spin
+
+DIRNAME=$tmpdir/ustackdepth_big.$$.$RANDOM
+mkdir -p $DIRNAME
+cd $DIRNAME
+
orig_maxstack=`sysctl -n kernel.perf_event_max_stack`
echo kernel.perf_event_max_stack was $orig_maxstack
+trap "sysctl kernel.perf_event_max_stack=$orig_maxstack" QUIT EXIT
sysctl kernel.perf_event_max_stack=200
-$dtrace $dt_flags -c test/triggers/ustack-tst-bigstack-spin -qn '
+$dtrace $dt_flags -c $TRIGGER -qn '
profile-1
/pid == $target/
{
@@ -32,7 +40,7 @@ ERROR
{
exit(1);
}
-'
+' > D.out
if [ $? -ne 0 ]; then
echo DTrace failure
exit 1
@@ -41,4 +49,26 @@ fi
sleep 2
sysctl kernel.perf_event_max_stack=$orig_maxstack
+$POSTPROC D.out > awk.out
+if [ $? -ne 0 ]; then
+ echo post processing failure
+ exit 1
+fi
+
+if echo "Stack depth OK" | diff -q - awk.out; then
+ mydepth=`gawk '/DEPTH/ { print $2 }' D.out`
+ if [ $mydepth -gt $orig_maxstack ]; then
+ echo success depth $mydepth exceeded original limit $orig_maxstack
+ exit 0
+ else
+ echo ERROR: $mydepth does not exceed original limit $orig_maxstack
+ cat D.out
+ exit 1
+ fi
+else
+ echo "ERROR: stack depth does not match stack"
+ cat D.out
+ exit 1
+fi
+
exit 0
--
2.47.3
next prev parent reply other threads:[~2025-10-01 6:24 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-01 6:24 [PATCH 1/5] test: Use a more ubiquitous probe for return()-action tests eugene.loh
2025-10-01 6:24 ` [PATCH 2/5] test: Adjust skip file for lockmem problem eugene.loh
2025-10-03 3:52 ` Kris Van Hees
2025-10-01 6:24 ` eugene.loh [this message]
2025-10-03 4:07 ` [PATCH 3/5] test: Fix some ustackdepth tests Kris Van Hees
2025-10-09 16:29 ` Kris Van Hees
2025-10-09 21:11 ` Eugene Loh
2025-10-01 6:24 ` [PATCH 4/5] test: Fix antiquated reference to dtrace_ustackdepth_max eugene.loh
2025-10-03 3:56 ` Kris Van Hees
2025-10-01 6:24 ` [PATCH 5/5] test: Remove antiquated special case for aarch64 eugene.loh
2025-10-03 3:55 ` Kris Van Hees
2025-10-03 3:50 ` [PATCH 1/5] test: Use a more ubiquitous probe for return()-action tests Kris Van Hees
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251001062418.6902-3-eugene.loh@oracle.com \
--to=eugene.loh@oracle.com \
--cc=dtrace-devel@oss.oracle.com \
--cc=dtrace@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox