* [PATCH 20/20] test: ensure expected output works for older and newer kernels
@ 2026-10-30 19:37 Kris Van Hees
0 siblings, 0 replies; only message in thread
From: Kris Van Hees @ 2026-10-30 19:37 UTC (permalink / raw)
To: dtrace, dtrace-devel
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-30 19:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-30 19:37 [PATCH 20/20] test: ensure expected output works for older and newer kernels Kris Van Hees
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox