[DTrace-devel] [PATCH] test: Add clear() sanity check to tst.clearavg2.d
Kris Van Hees
kris.van.hees at oracle.com
Thu Sep 15 05:42:22 UTC 2022
I think it would be better to flag an error when a libact operstion is
encountered that we do not support. In other words, make the default cse
become:
return dt_set_errno(dtp, EDT_ERRABORT);
or soemthing like that.
On Wed, Sep 14, 2022 at 07:05:41PM -0400, eugene.loh--- via DTrace-devel wrote:
> From: Eugene Loh <eugene.loh at oracle.com>
>
> With the port to BPF, aggregation clear() does not yet work. This
> is reflected in the XFAIL status of tst.clearavg2.d. Further, with
> fb264ec9 "test: Annotate tests that require missing features"
> the XFAIL message is more precise, citing the missing support.
>
> However, a few patches earlier, in f256db8f "Implement setopt()",
> the consumer is "fixed" to skip over unrecognized DTRACEACT_LIBACT
> records. This is enough to make tst.clearavg2.d XPASS, since the
> test is not very stringent.
>
> It is a little unclear what, exactly, the test is checking, but
> modify the test so that it checks printa() in this sequence:
>
> avg(nonzero) // sanity check on clear()
> clear()
> printa() // check clear()/printa()
> avg(0)
> printa() // check avg(0)/printa()
>
> Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
> ---
> test/unittest/aggs/tst.clearavg2.d | 30 +++++++++++++++++++-----------
> test/unittest/aggs/tst.clearavg2.r | 14 +-------------
> 2 files changed, 20 insertions(+), 24 deletions(-)
>
> diff --git a/test/unittest/aggs/tst.clearavg2.d b/test/unittest/aggs/tst.clearavg2.d
> index 3d918502..88827014 100644
> --- a/test/unittest/aggs/tst.clearavg2.d
> +++ b/test/unittest/aggs/tst.clearavg2.d
> @@ -1,6 +1,6 @@
> /*
> * Oracle Linux DTrace.
> - * Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved.
> + * Copyright (c) 2007, 2022, 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.
> */
> @@ -14,28 +14,36 @@
> * NOTES:
> * Verifies that printing a clear()'d aggregation with an avg()
> * aggregation function of 0 doesn't cause divide-by-zero problems.
> - *
> + * The rate settings and delays are intended to work around
> + * producer-consumer timing issues.
> */
>
> #pragma D option quiet
> #pragma D option switchrate=50ms
> #pragma D option aggrate=1ms
>
> -tick-100ms
> -/(x++ % 5) == 0/
> +tick-1s
> +/++n == 1/
> {
> - @time = avg(0);
> + /* use avg() with nonzero data to check clear() */
> + @ = avg(10);
> + @ = avg(20);
> + printa(" %@d\n", @);
> }
>
> -tick-100ms
> -/x > 5 && x <= 20/
> +tick-1s
> +/n == 2/
> {
> - printa(" %@d\n", @time);
> - clear(@time);
> + /* check clear() / printa() */
> + clear(@);
> + printa(" %@d\n", @);
> }
>
> -tick-100ms
> -/x > 20/
> +tick-1s
> +/n == 3/
> {
> + /* check avg(0) / printa() */
> + @ = avg(0);
> + printa(" %@d\n", @);
> exit(0);
> }
> diff --git a/test/unittest/aggs/tst.clearavg2.r b/test/unittest/aggs/tst.clearavg2.r
> index 7cceedda..1a8eb708 100644
> --- a/test/unittest/aggs/tst.clearavg2.r
> +++ b/test/unittest/aggs/tst.clearavg2.r
> @@ -1,16 +1,4 @@
> - 0
> - 0
> - 0
> - 0
> - 0
> - 0
> - 0
> - 0
> - 0
> - 0
> - 0
> - 0
> - 0
> + 15
> 0
> 0
>
> --
> 2.18.4
>
>
> _______________________________________________
> 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