[DTrace-devel] [PATCH v2] tst.alignring.d writes excessive output to test log

Kris Van Hees kris.van.hees at oracle.com
Wed Apr 20 21:40:58 UTC 2022


When I try this new version of the test, I get failures that seem to be
due to the (known) issues with timer probes on some kernel configurations.

Can you try this on the most recent UEK6 and UEK7 kernels and see what is
up?  Can we make this more reliable?  Do we care about this given that we
simply depend on the ring buffer implementation in the kernel and therefore
don't necessarily need to provide testing for it (we should be able to trust
that it works - we do not have a choice in whether we use it or not).

On Tue, Dec 07, 2021 at 02:22:32PM -0500, Eugene Loh via DTrace-devel wrote:
> ping for review (bug fix)
> 
> On 10/13/21 10:43 AM, eugene.loh at oracle.com wrote:
> > From: Eugene Loh <eugene.loh at oracle.com>
> > 
> > Orabug: 31927901
> > Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
> > ---
> >   test/unittest/buffering/tst.alignring.d  |  64 ---------
> >   test/unittest/buffering/tst.alignring.sh | 172 +++++++++++++++++++++++
> >   2 files changed, 172 insertions(+), 64 deletions(-)
> >   delete mode 100644 test/unittest/buffering/tst.alignring.d
> >   create mode 100755 test/unittest/buffering/tst.alignring.sh
> > 
> > diff --git a/test/unittest/buffering/tst.alignring.d b/test/unittest/buffering/tst.alignring.d
> > deleted file mode 100644
> > index a2f9d549..00000000
> > --- a/test/unittest/buffering/tst.alignring.d
> > +++ /dev/null
> > @@ -1,64 +0,0 @@
> > -/*
> > - * Oracle Linux DTrace.
> > - * Copyright (c) 2006, 2020, Oracle and/or its affiliates. All rights reserved.
> > - * Licensed under the Universal Permissive License v 1.0 as shown at
> > - * http://oss.oracle.com/licenses/upl.
> > - */
> > -
> > -/*
> > - * ASSERTION:
> > - *   Positive test for ring buffer policy.
> > - *
> > - * SECTION: Buffers and Buffering/ring Policy;
> > - *	Buffers and Buffering/Buffer Sizes;
> > - *	Options and Tunables/bufsize;
> > - *	Options and Tunables/bufpolicy
> > - */
> > -
> > -/* Incurs swapping, so
> > - *  @@timeout: 15
> > - */
> > -
> > -#pragma D option bufpolicy=ring
> > -#pragma D option bufsize=4k
> > -
> > -profile:::profile-1009hz
> > -{
> > -	printf("%x %x\n", (int)0xaaaa, (int)0xbbbb);
> > -}
> > -
> > -profile:::profile-1237hz
> > -{
> > -	printf("%x %x %x %x %x %x\n",
> > -	    (int)0xcccc,
> > -	    (int)0xdddd,
> > -	    (int)0xeeee,
> > -	    (int)0xffff,
> > -	    (int)0xabab,
> > -	    (int)0xacac);
> > -	printf("%x %x\n",
> > -	    (uint64_t)0xaabbaabbaabbaabb,
> > -	    (int)0xadad);
> > -}
> > -
> > -profile:::profile-1789hz
> > -{
> > -	printf("%x %x %x %x %x\n",
> > -	    (int)0xaeae,
> > -	    (int)0xafaf,
> > -	    (unsigned char)0xaa,
> > -	    (int)0xbcbc,
> > -	    (int)0xbdbd);
> > -}
> > -
> > -profile-1543hz
> > -{}
> > -
> > -profile-1361hz
> > -{}
> > -
> > -tick-1sec
> > -/i++ >= 10/
> > -{
> > -	exit(0);
> > -}
> > diff --git a/test/unittest/buffering/tst.alignring.sh b/test/unittest/buffering/tst.alignring.sh
> > new file mode 100755
> > index 00000000..999e67da
> > --- /dev/null
> > +++ b/test/unittest/buffering/tst.alignring.sh
> > @@ -0,0 +1,172 @@
> > +#!/bin/bash
> > +#
> > +# Oracle Linux DTrace.
> > +# Copyright (c) 2006, 2021, Oracle and/or its affiliates. All rights reserved.
> > +# Licensed under the Universal Permissive License v 1.0 as shown at
> > +# http://oss.oracle.com/licenses/upl.
> > +#
> > +# ASSERTION:
> > +#   Positive test for ring buffer policy.
> > +#
> > +# SECTION: Buffers and Buffering/ring Policy;
> > +#	Buffers and Buffering/Buffer Sizes;
> > +#	Options and Tunables/bufsize;
> > +#	Options and Tunables/bufpolicy
> > +#
> > +# Incurs swapping, so
> > +#  @@timeout: 15
> > +
> > +dtrace=$1
> > +
> > +DIRNAME="$tmpdir/buffering-alignring.$$.$RANDOM"
> > +mkdir -p $DIRNAME
> > +cd $DIRNAME
> > +
> > +# run DTrace
> > +
> > +$dtrace $dt_flags -o out.txt -n '
> > +#pragma D option bufpolicy=ring
> > +#pragma D option bufsize=4k
> > +
> > +profile:::profile-1009hz
> > +{
> > +	printf("%x %x\n", (int)0xaaaa, (int)0xbbbb);
> > +}
> > +
> > +profile:::profile-1237hz
> > +{
> > +	printf("%x %x %x %x %x %x\n",
> > +	    (int)0xcccc,
> > +	    (int)0xdddd,
> > +	    (int)0xeeee,
> > +	    (int)0xffff,
> > +	    (int)0xabab,
> > +	    (int)0xacac);
> > +	printf("%x %x\n",
> > +	    (uint64_t)0xaabbaabbaabbaabb,
> > +	    (int)0xadad);
> > +}
> > +
> > +profile:::profile-1789hz
> > +{
> > +	printf("%x %x %x %x %x\n",
> > +	    (int)0xaeae,
> > +	    (int)0xafaf,
> > +	    (unsigned char)0xaa,
> > +	    (int)0xbcbc,
> > +	    (int)0xbdbd);
> > +}
> > +
> > +profile-1543hz
> > +{}
> > +
> > +profile-1361hz
> > +{}
> > +
> > +tick-1sec
> > +/i++ >= 10/
> > +{
> > +	exit(0);
> > +}'
> > +if [ $? -ne 0 ]; then
> > +	echo "DTrace failed to run"
> > +	cat out.txt
> > +	exit 1
> > +fi
> > +
> > +# check output with awk
> > +
> > +NPROC=`getconf _NPROCESSORS_ONLN`
> > +
> > +awk -v NPROC=$NPROC '
> > +BEGIN {
> > +	# estimate final counts
> > +	n1009 = 10 * 1009 * NPROC;
> > +	n1237 = 10 * 1237 * NPROC;
> > +	n1361 = 10 * 1361 * NPROC;
> > +	n1543 = 10 * 1543 * NPROC;
> > +	n1789 = 10 * 1789 * NPROC;
> > +	nblank = n1009 + n1237 + n1789;
> > +
> > +	# initialize number of errors
> > +	nERRORs = 0;
> > +
> > +	# initialize numbers of lines found
> > +	iblank = iFUNC_NAME = iunexpected = 0;
> > +	i1237a = i1237b = i1361 = i1543 = i1789 = itick = 0;
> > +}
> > +
> > +# count lines
> > +NF == 0 { iblank++; next }
> > +/^ *FUNCTION:NAME$/ { iFUNC_NAME++; next }
> > +/^ *:profile-1009hz aaaa bbbb$/ { i1009++; next }
> > +/^ *:profile-1237hz cccc dddd eeee ffff abab acac$/ { i1237a++; next }
> > +/^aabbaabbaabbaabb adad$/ { i1237b++; next }
> > +/^ *:profile-1361hz $/ { i1361++; next }
> > +/^ *:profile-1543hz $/ { i1543++; next }
> > +/^ *:profile-1789hz aeae afaf aa bcbc bdbd$/ { i1789++; next }
> > +/^ *:tick-1sec $/ { itick++; next }
> > +{ iunexpected++; next }
> > +
> > +# done
> > +function check(xexpect, xactual, label) {
> > +	# allow a very big margin for underfiring
> > +	if (xactual < (10 * xexpect / 50) ||
> > +	    xactual > (51 * xexpect / 50)) {
> > +		print "ERROR:", label, "expect", xexpect, "actual", xactual;
> > +		nERRORS++;
> > +	}
> > +}
> > +END {
> > +	# print some diagnostic output
> > +	print NPROC, " procs"
> > +	print ":profile-1009hz expect", n1009, "actual", i1009
> > +	print ":profile-1237hz expect", n1237, "actual", i1237a, i1237b
> > +	print ":profile-1361hz expect", n1361, "actual", i1361
> > +	print ":profile-1543hz expect", n1543, "actual", i1543
> > +	print ":profile-1789hz expect", n1789, "actual", i1789
> > +	print iblank, "blank lines"
> > +
> > +	# check values
> > +	if (iunexpected != 0) {
> > +		print "ERROR: got", iunexpected, "unexpected lines";
> > +		nERRORS++;
> > +	}
> > +	if (iFUNC_NAME != 1) {
> > +		print "ERROR: FUNCTION:NAME expected once; got", iFUNC_NAME;
> > +		nERRORS++;
> > +	}
> > +	if (itick != 1) {
> > +		print "ERROR: tick-1sec expected once; got", itick;
> > +		nERRORS++;
> > +	}
> > +	if (i1237a != i1237b) {
> > +		print "ERROR: :profile-1237 continuation lines expect", i1237a, "actual", i1237b;
> > +		nERRORS++;
> > +	}
> > +	check(nblank, iblank, "blank lines");
> > +	check(n1009, i1009, ":profile-1009hz");
> > +	check(n1237, i1237a, ":profile-1237hz");
> > +	check(n1237, i1237b, ":profile-1237hz (continuation line)");
> > +	check(n1361, i1361, ":profile-1361hz");
> > +	check(n1543, i1543, ":profile-1543hz");
> > +	check(n1789, i1789, ":profile-1789hz");
> > +
> > +	# summarize and exit
> > +	if (nERRORS > 0) {
> > +		print "FAIL";
> > +		exit 1
> > +	} else {
> > +		print "SUCCESS";
> > +		exit 0
> > +	}
> > +}
> > +' out.txt
> > +if [ $? -ne 0 ]; then
> > +	echo "awk reports error"
> > +	cat out.txt
> > +	exit 1
> > +fi
> > +
> > +echo SUCCESS
> > +exit 0
> 
> _______________________________________________
> 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