From: Kris Van Hees <kris.van.hees@oracle.com>
To: dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com
Subject: [PATCH 20/20] test: ensure expected output works for older and newer kernels
Date: Fri, 30 Oct 2026 19:37:06 +0000 [thread overview]
Message-ID: <463fcd5adbd3fd710d2579b5873bb6b5@oracle.com> (raw)
Older kernel BPF verifiers report -EFAULT whereras newer ones report
-E2BIG. Support both, and also make the tests more robust if code
generation might result in a less predictable jump count.
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
---
test/unittest/options/tst.bpflogsize-cmdline.sh | 9 ++++-----
test/unittest/options/tst.bpflogsize-pragma.sh | 9 ++++-----
2 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/test/unittest/options/tst.bpflogsize-cmdline.sh b/test/unittest/options/tst.bpflogsize-cmdline.sh
index c67dd280..994acb9a 100755
--- a/test/unittest/options/tst.bpflogsize-cmdline.sh
+++ b/test/unittest/options/tst.bpflogsize-cmdline.sh
@@ -39,7 +39,6 @@ cat > D.out << EOF
BPF verifier log is incomplete and is not reported.
Set DTrace option 'bpflogsize' to some greater size for more output.
(Current size is nnnn.)
-dtrace: could not enable tracing: BPF program load for 'dtrace:::BEGIN' failed: Bad address
EOF
# dump files
@@ -77,7 +76,7 @@ while [ $cursiz -lt $((1024 * 1024 * 1024)) ]; do
# Usually (at least in the default case),
# dtrace should fail because the BPF log size is too small.
# Output should match D.out.
- if [ `sed s/$cursiz/nnnn/ tmp.out | diff - D.out | wc -l` -eq 0 ]; then
+ if [ `sed -e s/$cursiz/nnnn/ -e '/^dtrace: /d' tmp.out | diff - D.out | wc -l` -eq 0 ]; then
echo okay: $cursiz is too small
# bump the size up and try again
@@ -88,7 +87,7 @@ while [ $cursiz -lt $((1024 * 1024 * 1024)) ]; do
echo "The default case is expected to have bpflogsize too small"
echo "and fail with the expected error."
echo "========== output (expected)"
- sed 's/nnnn/'$cursiz'/' D.out
+ sed -e 's/nnnn/'$cursiz'/' D.out
dump_files
exit 1
fi
@@ -111,11 +110,11 @@ while [ $cursiz -lt $((1024 * 1024 * 1024)) ]; do
echo ERROR: expected only one non-\"BPF:\" output line
status=1
fi
- if ! grep -q '^BPF: The sequence of 8193 jumps is too complex.' tmp.out; then
+ if ! grep -q '^BPF: The sequence of [1-9][0-9]* jumps is too complex.' tmp.out; then
echo ERROR: BPF error message is missing
status=1
fi
- if ! grep -q '^dtrace: could not enable tracing: BPF program load for '\''dtrace:::BEGIN'\'' failed: Bad address' tmp.out; then
+ if ! grep -q '^dtrace: ' tmp.out; then
echo ERROR: dtrace error message is missing
status=1
fi
diff --git a/test/unittest/options/tst.bpflogsize-pragma.sh b/test/unittest/options/tst.bpflogsize-pragma.sh
index 25cda675..342bb3b9 100755
--- a/test/unittest/options/tst.bpflogsize-pragma.sh
+++ b/test/unittest/options/tst.bpflogsize-pragma.sh
@@ -40,7 +40,6 @@ cat > D.out << EOF
BPF verifier log is incomplete and is not reported.
Set DTrace option 'bpflogsize' to some greater size for more output.
(Current size is nnnn.)
-dtrace: could not enable tracing: BPF program load for 'dtrace:::BEGIN' failed: Bad address
EOF
# dump files
@@ -77,7 +76,7 @@ while [ $cursiz -lt $((1024 * 1024 * 1024)) ]; do
# Usually (at least in the default case),
# dtrace should fail because the BPF log size is too small.
# Output should match D.out.
- if [ `sed s/$cursiz/nnnn/ tmp.out | diff - D.out | wc -l` -eq 0 ]; then
+ if [ `sed -e s/$cursiz/nnnn/ -e '/^dtrace: /d' tmp.out | diff - D.out | wc -l` -eq 0 ]; then
echo okay: $cursiz is too small
# bump the size up and try again
@@ -88,7 +87,7 @@ while [ $cursiz -lt $((1024 * 1024 * 1024)) ]; do
echo "The default case is expected to have bpflogsize too small"
echo "and fail with the expected error."
echo "========== output (expected)"
- sed 's/nnnn/'$cursiz'/' D.out
+ sed -e s/nnnn/$cursiz/ -e '/^dtrace: /d' D.out
dump_files
exit 1
fi
@@ -111,11 +110,11 @@ while [ $cursiz -lt $((1024 * 1024 * 1024)) ]; do
echo ERROR: expected only one non-\"BPF:\" output line
status=1
fi
- if ! grep -q '^BPF: The sequence of 8193 jumps is too complex.' tmp.out; then
+ if ! grep -q '^BPF: The sequence of [1-9][0-9]* jumps is too complex.' tmp.out; then
echo ERROR: BPF error message is missing
status=1
fi
- if ! grep -q '^dtrace: could not enable tracing: BPF program load for '\''dtrace:::BEGIN'\'' failed: Bad address' tmp.out; then
+ if ! grep -q '^dtrace: ' tmp.out; then
echo ERROR: dtrace error message is missing
status=1
fi
--
2.52.0
reply other threads:[~2026-10-30 19:38 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=463fcd5adbd3fd710d2579b5873bb6b5@oracle.com \
--to=kris.van.hees@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