[DTrace-devel] [PATCH] test: Add tests for option "aggrate"

Kris Van Hees kris.van.hees at oracle.com
Sat Apr 29 03:31:06 UTC 2023


On Sat, Mar 11, 2023 at 12:31:55PM -0500, eugene.loh--- via DTrace-devel wrote:
> From: Eugene Loh <eugene.loh at oracle.com>
> 
> Signed-off-by: Eugene Loh <eugene.loh at oracle.com>

Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>

> ---
>  test/unittest/options/tst.aggrate-fast.d | 31 ++++++++++++++++++++++++
>  test/unittest/options/tst.aggrate-fast.r | 17 +++++++++++++
>  test/unittest/options/tst.aggrate-slow.d | 30 +++++++++++++++++++++++
>  test/unittest/options/tst.aggrate-slow.r | 17 +++++++++++++
>  4 files changed, 95 insertions(+)
>  create mode 100644 test/unittest/options/tst.aggrate-fast.d
>  create mode 100644 test/unittest/options/tst.aggrate-fast.r
>  create mode 100644 test/unittest/options/tst.aggrate-slow.d
>  create mode 100644 test/unittest/options/tst.aggrate-slow.r
> 
> diff --git a/test/unittest/options/tst.aggrate-fast.d b/test/unittest/options/tst.aggrate-fast.d
> new file mode 100644
> index 00000000..17fe0225
> --- /dev/null
> +++ b/test/unittest/options/tst.aggrate-fast.d
> @@ -0,0 +1,31 @@
> +/*
> + * Oracle Linux DTrace.
> + * Copyright (c) 2023, 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.
> + */
> +
> +/*
> + * When the aggrate is faster than the switchrate, each printa() should
> + * reflect all of the counts so far.
> + */
> +
> +/* @@trigger: periodic_output */
> +/* @@sort */
> +
> +#pragma D option quiet
> +#pragma D option switchrate=100ms
> +#pragma D option aggrate=50ms
> +
> +syscall::write:entry
> +/pid == $target/
> +{
> +	@ = count();
> +	printa(@);
> +}
> +
> +syscall::write:entry
> +/pid == $target && n++ >= 7/
> +{
> +	exit(0);
> +}
> diff --git a/test/unittest/options/tst.aggrate-fast.r b/test/unittest/options/tst.aggrate-fast.r
> new file mode 100644
> index 00000000..a32cf7df
> --- /dev/null
> +++ b/test/unittest/options/tst.aggrate-fast.r
> @@ -0,0 +1,17 @@
> +                1
> +
> +                2
> +
> +                3
> +
> +                4
> +
> +                5
> +
> +                6
> +
> +                7
> +
> +                8
> +
> +
> diff --git a/test/unittest/options/tst.aggrate-slow.d b/test/unittest/options/tst.aggrate-slow.d
> new file mode 100644
> index 00000000..c4bac5e4
> --- /dev/null
> +++ b/test/unittest/options/tst.aggrate-slow.d
> @@ -0,0 +1,30 @@
> +/*
> + * Oracle Linux DTrace.
> + * Copyright (c) 2023, 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.
> + */
> +
> +/*
> + * When the aggrate is slower than the switchrate and the pace of printa()
> + * actions, multiple printa() should all reflect the same stale count.
> + */
> +/* @@trigger: periodic_output */
> +/* @@sort */
> +
> +#pragma D option quiet
> +#pragma D option switchrate=100ms
> +#pragma D option aggrate=4500ms
> +
> +syscall::write:entry
> +/pid == $target/
> +{
> +	@ = count();
> +	printa(@);
> +}
> +
> +syscall::write:entry
> +/pid == $target && n++ >= 7/
> +{
> +	exit(0);
> +}
> diff --git a/test/unittest/options/tst.aggrate-slow.r b/test/unittest/options/tst.aggrate-slow.r
> new file mode 100644
> index 00000000..6cbd6c2f
> --- /dev/null
> +++ b/test/unittest/options/tst.aggrate-slow.r
> @@ -0,0 +1,17 @@
> +                1
> +
> +                1
> +
> +                1
> +
> +                1
> +
> +                1
> +
> +                5
> +
> +                5
> +
> +                5
> +
> +
> -- 
> 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