[DTrace-devel] [PATCH] test: Convert tick-* probes to BEGIN probes for default-action test

Kris Van Hees kris.van.hees at oracle.com
Fri Mar 3 04:26:41 UTC 2023


On Thu, Mar 02, 2023 at 05:37:03PM -0500, eugene.loh--- via DTrace-devel wrote:
> From: Eugene Loh <eugene.loh at oracle.com>
> 
> The tick-* mechanism can be fickle on some platforms.  Do not use
> it for this test, which is intended simply to check default actions.
> 
> Signed-off-by: Eugene Loh <eugene.loh at oracle.com>

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

> ---
>  test/unittest/actions/default/tst.default.d | 30 ++++++++++++---------
>  test/unittest/actions/default/tst.default.r | 11 ++++----
>  2 files changed, 23 insertions(+), 18 deletions(-)
> 
> diff --git a/test/unittest/actions/default/tst.default.d b/test/unittest/actions/default/tst.default.d
> index 6cb8be27..72e50443 100644
> --- a/test/unittest/actions/default/tst.default.d
> +++ b/test/unittest/actions/default/tst.default.d
> @@ -1,6 +1,6 @@
>  /*
>   * Oracle Linux DTrace.
> - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
> + * Copyright (c) 2020, 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.
>   */
> @@ -15,30 +15,34 @@
>   * SECTION: Actions and Subroutines/default
>   */
>  
> -/* should not trace, but should update n */
> +/* should not trace, but should set n=1 */
>  BEGIN
>  { n = 1; }
>  
> -/* should trace, "hello world" should appear */
> -tick-14
> -{ printf("hello world"); }
> +/* should trace, "hello world 1" should appear */
> +BEGIN
> +{ printf("hello world %d", n); }
>  
> -/* should not trace, but should update n */
> -tick-13
> +/* should not trace, but should update n+=2 */
> +BEGIN
>  { n += 2; }
>  
> -/* should trace */
> -tick-12
> +/* should trace, and n should be 1+2=3 */
> +BEGIN
> +{ printf("%d", n); }
> +
> +/* should trace, but not report anything */
> +BEGIN
>  { }
>  
> -/* should not trace, but should update n */
> -tick-11
> +/* should not trace, but should update n+=4 */
> +BEGIN
>  { n += 4; }
>  
>  /* should trace, and n should be 1+2+4=7 */
> -tick-10
> +BEGIN
>  { trace(n); }
>  
>  /* should trace */
> -tick-10
> +BEGIN
>  { exit(0) }
> diff --git a/test/unittest/actions/default/tst.default.r b/test/unittest/actions/default/tst.default.r
> index aa4500eb..becfad35 100644
> --- a/test/unittest/actions/default/tst.default.r
> +++ b/test/unittest/actions/default/tst.default.r
> @@ -1,8 +1,9 @@
>                     FUNCTION:NAME
> -                        :tick-14 hello world
> -                        :tick-12 
> -                        :tick-10           7
> -                        :tick-10 
> +                          :BEGIN hello world 1
> +                          :BEGIN 3
> +                          :BEGIN 
> +                          :BEGIN           7
> +                          :BEGIN 
>  
>  -- @@stderr --
> -dtrace: script 'test/unittest/actions/default/tst.default.d' matched 7 probes
> +dtrace: script 'test/unittest/actions/default/tst.default.d' matched 8 probes
> -- 
> 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