Index | Thread | Search

From:
Martin Pieuchot <mpi@openbsd.org>
Subject:
Re: regress/btrace: Add test for undefined arguments
To:
Christian Ludwig <christian_ludwig@genua.de>
Cc:
tech@openbsd.org
Date:
Mon, 5 Feb 2024 16:32:28 +0100

Download raw body.

Thread
On 02/02/24(Fri) 16:24, Christian Ludwig wrote:
> This is a test case for the fix in btrace.c,v 1.83 that exercises the
> use of undefined probe arguments.

Thanks, I committed it with the tweaks below.

> ---
>  regress/usr.sbin/btrace/Makefile | 4 ++--
>  regress/usr.sbin/btrace/argn.bt  | 6 ++++++
>  regress/usr.sbin/btrace/argn.ok  | 1 +
>  3 files changed, 9 insertions(+), 2 deletions(-)
>  create mode 100644 regress/usr.sbin/btrace/argn.bt
>  create mode 100644 regress/usr.sbin/btrace/argn.ok
> 
> diff --git a/regress/usr.sbin/btrace/Makefile b/regress/usr.sbin/btrace/Makefile
> index 6f0bb76d387..8bbe7a2c8d3 100644
> --- a/regress/usr.sbin/btrace/Makefile
> +++ b/regress/usr.sbin/btrace/Makefile
> @@ -4,8 +4,8 @@ BTRACE?=		 /usr/sbin/btrace
>  ALLOWDT!=		sysctl -n kern.allowdt 2>/dev/null
>  
>  # scripts that don't need /dev/dt
> -BT_LANG_SCRIPTS=	arithm beginend beginend-argn boolean comments delete \
> -			exit histempty if \
> +BT_LANG_SCRIPTS=	argn arithm beginend beginend-argn boolean comments \
> +			delete exit histempty if \
>  			map mapclear mapempty mapsyntax mapzero map-unnamed \
>  			maxoperand min+max+sum multismts nsecs+var \
>  			precedence print read-map-after-clear staticv-empty \

This is a list of tests than can be run w/o being root.  As soon as a
kernel probe is used, like in this case, we need to be able to open
/dev/dt.

I added the script to BT_KERN_SCRIPTS.

> diff --git a/regress/usr.sbin/btrace/argn.bt b/regress/usr.sbin/btrace/argn.bt
> new file mode 100644
> index 00000000000..0477806fb80
> --- /dev/null
> +++ b/regress/usr.sbin/btrace/argn.bt
> @@ -0,0 +1,6 @@
> +interval:hz:1
	      ^^^

I changed the rate to be 100 to speed up the execution of the test.

> +{
> +	printf("%d %s %d %s %d %s %d %s %d %s\n",
> +	       arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
> +	exit();
> +}
> diff --git a/regress/usr.sbin/btrace/argn.ok b/regress/usr.sbin/btrace/argn.ok
> new file mode 100644
> index 00000000000..d3e1a999aba
> --- /dev/null
> +++ b/regress/usr.sbin/btrace/argn.ok
> @@ -0,0 +1 @@
> +0 0 0 0 0 0 0 0 0 0
> -- 
> 2.34.1
>