[DTrace-devel] [PATCH 1/2] Add diagnostics for tst.sid.sh
Kris Van Hees
kris.van.hees at oracle.com
Tue Jul 6 10:41:15 PDT 2021
On Fri, Jul 02, 2021 at 07:10:48PM -0400, eugene.loh at oracle.com wrote:
> From: Eugene Loh <eugene.loh at oracle.com>
>
> ---
> test/unittest/scripting/tst.sid.sh | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/test/unittest/scripting/tst.sid.sh b/test/unittest/scripting/tst.sid.sh
> index 7fe62d48..ed3245f8 100755
> --- a/test/unittest/scripting/tst.sid.sh
> +++ b/test/unittest/scripting/tst.sid.sh
> @@ -22,6 +22,7 @@ fi
> dtrace=$1
> bname=`basename $0`
> dfilename=$tmpdir/$bname.$$.d
> +ofilename=$tmpdir/$bname.$$.txt
I think we can do without this (see below)...
> ## Create .d file
> ##########################################################################
> @@ -32,6 +33,7 @@ cat > $dfilename <<-EOF
> BEGIN
> /\$sid != \$1/
> {
> + printf("actual: %d; expected: %d\n", \$sid, \$1);
How about printing the output for both cases? No harm in that and it also
shows us that the probe is actually doing its job.
> exit(1);
> }
>
> @@ -54,10 +56,13 @@ if [ $? -ne 0 ]; then
> exit 1
> fi
>
> -$dfilename $sessionid >/dev/null 2>&1
> +$dfilename $sessionid > $ofilename 2>&1
I would just get rid of the redirection and let it go to stdut (which is being
captured already in the log).
> if [ $? -ne 0 ]; then
> echo "Error in executing $dfilename" >&2
> + cat $ofilename
No need (see above).
> + ps -p $$ -o sid
> + echo expect $sessionid for pid $$
This should already be covered by the output from the D script, but I guess
there is value in printing the perspective from the shell just in case there
is something else odd going on. So, yes, good idea.
> exit 1
> fi
>
> --
> 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