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

Kris Van Hees kris.van.hees at oracle.com
Tue Oct 10 04:43:15 UTC 2023


On Mon, Oct 09, 2023 at 06:30:31PM -0400, Eugene Loh via DTrace-devel wrote:
> I'm afraid I don't get this one.  The patch can make a difference only if
> tmp.out is over 100 lines long.  But in that case, it surely cannot match
> D.out.  So...?

The 100 is just an arbitrary value that is certain to be more than the amount
of lines in D.out.  Obviously, just the number of lines in D.out can be used
as well.  Or a test could be added for the number of lines being greater than
D.out and already report failure for that.  All possible.

I went for this option because it is valid (tail -100 does the right thing if
the file is less than 100 lines), it is a minimal change to the test, and just
for the heck of it... if BPF were to at some point dump incomplete logs that
end with this error, it would be (again) a minimal change to accomodate that.

But...

Apparently something changed at the kernel side where the tests work again as
expected without this patch, so I am pulling it (for now).  If it starts
failing again and that becomes a stable issue, I'll revisit this.

> On 9/25/23 10:13, Kris Van Hees via DTrace-devel wrote:
> > 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.
> > 
> > diff --git 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
> > diff --git 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
> 
> _______________________________________________
> DTrace-devel mailing list
> DTrace-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/dtrace-devel



More information about the DTrace-devel mailing list