[DTrace-devel] [PATCH] test: Loosen tolerance for switchrate test

Kris Van Hees kris.van.hees at oracle.com
Wed May 31 06:20:30 UTC 2023


On Wed, May 31, 2023 at 01:19:54AM -0400, eugene.loh--- via DTrace-devel wrote:
> From: Eugene Loh <eugene.loh at oracle.com>
> 
> The timing expected for the switchrate test is rather approximate.
> We want a "short" switchrate to run in a "short" amount of time and
> a "long" one to run "long."  That's about it.
> 
> The actual times observed tend to be a little higher than the expected
> times.  On some systems (ARM OL9?), the discrepancy is slightly higher.
> This test, however, is simply concerned with whether the switchrate
> option is working.
> 
> Loosen the tolerance for the test.
> 
> 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.switchrate.sh | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/test/unittest/options/tst.switchrate.sh b/test/unittest/options/tst.switchrate.sh
> index 98cb7341..e47d78d9 100755
> --- a/test/unittest/options/tst.switchrate.sh
> +++ b/test/unittest/options/tst.switchrate.sh
> @@ -16,17 +16,17 @@ dtrace=$1
>  # very long switchrate.
>  
>  status=0
> -for nexpect in 1 10; do
> +for nexpect in 1 16; do
>  	# Run the "instantaneous" D script with the prescribed switchrate.
>  	# Time it.  Round to the nearest number of seconds with int(t+0.5).
> -	# Go ahead and lop off a second just because we expect the script
> -	# to take *some* time.
>  	nactual=`/usr/bin/time -f "%e" \
>  	    $dtrace -xswitchrate=${nexpect}sec -qn 'BEGIN { exit(0) }' \
> -	    |& awk 'NF != 0 {print int($1 + 0.5) - 1}'`
> +	    |& awk 'NF != 0 {print int($1 + 0.5)}'`
>  
>  	# Check the actual number of seconds to the expected value.
> -	test/utils/check_result.sh $nactual $nexpect 1
> +	# Actually, the actual time might be a few seconds longer than expected.
> +	# So pad $nexpect.
> +	test/utils/check_result.sh $nactual $(($nexpect + 3)) 4
>  	status=$(($status + $?))
>  done
>  
> -- 
> 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