[DTrace-devel] [PATCH] Error out on unrecognized actions

Kris Van Hees kris.van.hees at oracle.com
Tue Nov 1 21:26:08 UTC 2022


On Thu, Sep 15, 2022 at 06:53:41PM -0400, eugene.loh--- via DTrace-devel wrote:
> From: Eugene Loh <eugene.loh at oracle.com>
> 
> Note that this patch causes a few spuriously passing tests now
> to fail.  So, they must be marked XFAIL.
> 
> One odd test is tst.clearavg2.d.  It was already marked XFAIL,
> with the message made even more specific in patch fb264ec9 ("test:
> Annotate tests that require missing features"), indicting clear().
> But the test had actually started passing a few patches earlier,
> in f256db8f ("Implement setopt()"), when the consumer was modified
> to skip over unrecognized DTRACEACT_LIBACT records.  So, the test
> had started to XPASS, an indication of its leniency.  With the
> current patch, that test now correctly XFAILs:  its behavior is
> now in line with its XFAIL.
> 
> Signed-off-by: Eugene Loh <eugene.loh at oracle.com>

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

> ---
>  libdtrace/dt_cg.c                      | 10 ++++++++++
>  libdtrace/dt_consume.c                 |  2 +-
>  test/unittest/tracemem/tst.init_task.d |  4 ++--
>  test/unittest/types/tst.complex.d      |  3 ++-
>  4 files changed, 15 insertions(+), 4 deletions(-)
> 
> diff --git a/libdtrace/dt_cg.c b/libdtrace/dt_cg.c
> index c4e49129..511e2af3 100644
> --- a/libdtrace/dt_cg.c
> +++ b/libdtrace/dt_cg.c
> @@ -1347,6 +1347,7 @@ dt_cg_act_clear(dt_pcb_t *pcb, dt_node_t *dnp, dtrace_actkind_t kind)
>  	 * AGGID = aid->di_id
>  	 */
>  	dt_cg_store_val(pcb, anp, DTRACEACT_LIBACT, NULL, DT_ACT_CLEAR);
> +	dnerror(dnp, D_UNKNOWN, "clear() is not implemented (yet)\n");
>  }
>  
>  /*
> @@ -1513,6 +1514,8 @@ dt_cg_act_ftruncate(dt_pcb_t *pcb, dt_node_t *dnp, dtrace_actkind_t kind)
>  static void
>  dt_cg_act_jstack(dt_pcb_t *pcb, dt_node_t *dnp, dtrace_actkind_t kind)
>  {
> +	dnerror(dnp, D_UNKNOWN, "jstack() is not implemented (yet)\n");
> +	/* FIXME: Needs implementation */
>  }
>  
>  static void
> @@ -1550,11 +1553,15 @@ dt_cg_act_normalize(dt_pcb_t *pcb, dt_node_t *dnp, dtrace_actkind_t kind)
>  static void
>  dt_cg_act_panic(dt_pcb_t *pcb, dt_node_t *dnp, dtrace_actkind_t kind)
>  {
> +	dnerror(dnp, D_UNKNOWN, "panic() is not implemented (yet)\n");
> +	/* FIXME: Needs implementation */
>  }
>  
>  static void
>  dt_cg_act_pcap(dt_pcb_t *pcb, dt_node_t *dnp, dtrace_actkind_t kind)
>  {
> +	dnerror(dnp, D_UNKNOWN, "pcap() is not implemented (yet)\n");
> +	/* FIXME: Needs implementation */
>  }
>  
>  static void
> @@ -1912,6 +1919,8 @@ dt_cg_act_trace(dt_pcb_t *pcb, dt_node_t *dnp, dtrace_actkind_t kind)
>  static void
>  dt_cg_act_tracemem(dt_pcb_t *pcb, dt_node_t *dnp, dtrace_actkind_t kind)
>  {
> +	dnerror(dnp, D_UNKNOWN, "tracemem() is not implemented (yet)\n");
> +	/* FIXME: Needs implementation */
>  }
>  
>  static void
> @@ -1960,6 +1969,7 @@ dt_cg_act_trunc(dt_pcb_t *pcb, dt_node_t *dnp, dtrace_actkind_t kind)
>  	 */
>  	dt_cg_store_val(pcb, trunc, DTRACEACT_LIBACT, NULL, DT_ACT_TRUNC);
>  #endif
> +	dnerror(dnp, D_UNKNOWN, "trunc() is not implemented (yet)\n");
>  }
>  
>  static void
> diff --git a/libdtrace/dt_consume.c b/libdtrace/dt_consume.c
> index 52ad9933..bc2c6285 100644
> --- a/libdtrace/dt_consume.c
> +++ b/libdtrace/dt_consume.c
> @@ -2365,7 +2365,7 @@ dt_consume_one_probe(dtrace_hdl_t *dtp, FILE *fp, char *data, uint32_t size,
>  				continue;
>  			}
>  			default:
> -				continue;
> +				return dt_set_errno(dtp, EDT_ERRABORT);
>  			}
>  		}
>  
> diff --git a/test/unittest/tracemem/tst.init_task.d b/test/unittest/tracemem/tst.init_task.d
> index 115da5d9..2e630385 100644
> --- a/test/unittest/tracemem/tst.init_task.d
> +++ b/test/unittest/tracemem/tst.init_task.d
> @@ -1,9 +1,10 @@
>  /*
>   * Oracle Linux DTrace.
> - * Copyright (c) 2006, 2020, Oracle and/or its affiliates. All rights reserved.
> + * Copyright (c) 2006, 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.
>   */
> +/* @@xfail: dtv2 - requires tracemem() */
>  
>  /*
>   * ASSERTION:
> @@ -13,7 +14,6 @@
>   * SECTION: Actions and Subroutines/tracemem()
>   */
>  
> -
>  BEGIN
>  {
>  	i = 1;
> diff --git a/test/unittest/types/tst.complex.d b/test/unittest/types/tst.complex.d
> index a1435185..b55f80ad 100644
> --- a/test/unittest/types/tst.complex.d
> +++ b/test/unittest/types/tst.complex.d
> @@ -1,9 +1,10 @@
>  /*
>   * Oracle Linux DTrace.
> - * Copyright (c) 2006, 2020, Oracle and/or its affiliates. All rights reserved.
> + * Copyright (c) 2006, 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.
>   */
> +/* @@xfail: dtv2 - requires tracemem() */
>  
>  /*
>   * ASSERTION:
> -- 
> 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