[DTrace-devel] [PATCH] test: ensure bpflogsize tests can handle large logs

Kris Van Hees kris.van.hees at oracle.com
Mon Sep 25 14:13:12 UTC 2023


With recent kernel versions, the output from the BPF log can be too
much for the test to handle in reasonable time, and the test fails
with a timeout.  Since the test is only looking for data to match
near the end of the log, use tail to focus on just that.

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
---
 test/unittest/options/tst.bpflogsize-cmdline.sh | 2 +-
 test/unittest/options/tst.bpflogsize-pragma.sh  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/unittest/options/tst.bpflogsize-cmdline.sh b/test/unittest/options/tst.bpflogsize-cmdline.sh
index 2d85e12c..075dad59 100755
--- a/test/unittest/options/tst.bpflogsize-cmdline.sh
+++ b/test/unittest/options/tst.bpflogsize-cmdline.sh
@@ -76,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 [ `tail -100 tmp.out | sed s/$cursiz/nnnn/ | diff - D.out | wc -l` -eq 0 ]; then
 		echo okay: $cursiz is too small
 
 		# bump the size up and try again
diff --git a/test/unittest/options/tst.bpflogsize-pragma.sh b/test/unittest/options/tst.bpflogsize-pragma.sh
index 5d03b5f7..929e6201 100755
--- a/test/unittest/options/tst.bpflogsize-pragma.sh
+++ b/test/unittest/options/tst.bpflogsize-pragma.sh
@@ -76,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 [ `tail -100 tmp.out | sed s/$cursiz/nnnn/ | diff - D.out | wc -l` -eq 0 ]; then
 		echo okay: $cursiz is too small
 
 		# bump the size up and try again
-- 
2.40.1




More information about the DTrace-devel mailing list