[DTrace-devel] [PATCH 2/4] test: XFAIL lockmem test if rawtp-arg-type uses CTF

Kris Van Hees kvanhees at kvh-deb-bpf.us.oracle.com
Tue Jan 30 16:22:34 UTC 2024


On Thu, Dec 14, 2023 at 05:21:17PM -0500, eugene.loh at oracle.com wrote:
> 
> To get rawtp arg types, we rely on CTF.  If CTF info is not available,
> we fall back on a "trial and error" method simply for the number of args.
> But we signal to the user if the trial-and-error method is failing due
> to lockmem limits.
> 
> This test checked for that failure mode.  The test was skipped if
> lockmem limits are not observed on the test system.
> 
> Skip the test also if CTF info *IS* available.
> 
> Signed-off-by: Eugene Loh <eugene.loh at oracle.com>

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

> ---
>  .../providers/rawtp/err.lockmem-too-low.r     |  4 ++
>  .../providers/rawtp/err.lockmem-too-low.sh    | 37 +++++++++++++++++--
>  2 files changed, 38 insertions(+), 3 deletions(-)
>  create mode 100644 test/unittest/providers/rawtp/err.lockmem-too-low.r
> 
> diff --git a/test/unittest/providers/rawtp/err.lockmem-too-low.r b/test/unittest/providers/rawtp/err.lockmem-too-low.r
> new file mode 100644
> index 00000000..60818976
> --- /dev/null
> +++ b/test/unittest/providers/rawtp/err.lockmem-too-low.r
> @@ -0,0 +1,4 @@
> +dtrace: invalid probe specifier rawtp:::sched_process_fork: Cannot retrieve argument count:
> +	The kernel locked-memory limit is possibly too low.  Set a
> +	higher limit with the DTrace option '-xlockmem=N'.  Or, use
> +	'ulimit -l N' (Kbytes).  Or, make N the string 'unlimited'.
> diff --git a/test/unittest/providers/rawtp/err.lockmem-too-low.sh b/test/unittest/providers/rawtp/err.lockmem-too-low.sh
> index 47aab344..760f9821 100755
> --- a/test/unittest/providers/rawtp/err.lockmem-too-low.sh
> +++ b/test/unittest/providers/rawtp/err.lockmem-too-low.sh
> @@ -1,11 +1,23 @@
>  #!/bin/bash
>  #
>  # Oracle Linux DTrace.
> -# Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
> +# 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.
>  #
>  
> +# The mechanism for discovering rawtp arg types relies first on CTF.
> +# If CTF information is not available, we fall back to a "trial-and-error"
> +# method, which really only tells us the number of args.  And that
> +# method simply cannot work if trials error due to lockmem limits.
> +# If lockmem limits are encountered, we want to signal that problem to the
> +# user.
> +#
> +# This test checks that failure mode.  Therefore, two conditions
> +# must be met for this test to work.  First, lockmem limits must be
> +# respected.  Second, no CTF information should be available, so that
> +# the trial-and-error method will be invoked.
> +
>  dtrace=$1
>  
>  # Determine whether the system respects setting the lockmem limit as root.
> @@ -16,9 +28,28 @@ if $dtrace -xlockmem=1 -n 'BEGIN { exit(0); }' &> /dev/null; then
>  fi
>  
>  $dtrace -xlockmem=1 -lvn rawtp:::sched_process_fork |& \
> -    awk '{ print; }
> +    awk 'BEGIN {
> +	     err = 0;  # lockmem error messages
> +	     CTF = 0;  # arg types indicating CTF info
> +	     try = 0;  # arg types indicating trial-and-error
> +	 }
> +
> +	 { print; }
> +
>  	 /Cannot retrieve argument count/ { err++; }
>  	 /lockmem/ { err++; }
> -	 END { exit(err == 2 ? 1 : 0); }'
> +	 /^	*args\[[01]\]: struct task_struct \*$/ { CTF++ }
> +	 /^	*args\[[01]\]: uint64_t$/ { try++ }
> +
> +	 END {
> +	     # Skip this test if CTF info was found.
> +	     if (err == 0 && CTF == 2 && try == 0) exit(67);
> +
> +	     # Report the expected fail if error message is found.
> +	     if (err == 2 && CTF == 0 && try == 0) exit(1);
> +
> +	     # Indicate the expected fail did not occur.
> +	     exit(0);
> +	 }'
>  
>  exit $?
> -- 
> 2.18.4
> 
> 



More information about the DTrace-devel mailing list