From: Eugene Loh <eugene.loh@oracle.com>
To: Nick Alcock <nick.alcock@oracle.com>,
dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com
Subject: Re: [PATCH v7 5/6] usdt: new tests for USDT arg sanity with overlapping pid probes
Date: Thu, 7 Nov 2024 15:54:04 -0500 [thread overview]
Message-ID: <c7e23550-b87c-9750-e17f-20b7b060854c@oracle.com> (raw)
In-Reply-To: <20241106112942.264351-6-nick.alcock@oracle.com>
On 11/6/24 06:29, Nick Alcock wrote:
> This generalizes the existing tst.pidprobes.sh to check the args
> reported by the probe both with and without arg mapping in place.
>
> Everything seems to work.
That comment seems to be unnecessary.
Also, is there a "dtrace -lv" test for USDT args? (I'm not even sure if
that question makes sense.)
> Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
> ---
> .../usdt/{tst.pidprobes.sh => pidprobes.sh} | 56 +++++++++++++++----
Why the renaming? And, will "./runtest.sh" run pidprobes.sh without any
command-line args?
> test/unittest/usdt/tst.pidargmap.sh | 11 ++++
> test/unittest/usdt/tst.pidargs.sh | 11 ++++
> 3 files changed, 67 insertions(+), 11 deletions(-)
> rename test/unittest/usdt/{tst.pidprobes.sh => pidprobes.sh} (82%)
> create mode 100755 test/unittest/usdt/tst.pidargmap.sh
> create mode 100755 test/unittest/usdt/tst.pidargs.sh
>
> diff --git a/test/unittest/usdt/tst.pidprobes.sh b/test/unittest/usdt/pidprobes.sh
> similarity index 82%
> rename from test/unittest/usdt/tst.pidprobes.sh
> rename to test/unittest/usdt/pidprobes.sh
> index 25fee85537fc..aedc6256f195 100755
> --- a/test/unittest/usdt/tst.pidprobes.sh
> +++ b/test/unittest/usdt/pidprobes.sh
> @@ -5,9 +5,12 @@
> # Licensed under the Universal Permissive License v 1.0 as shown at
> # http://oss.oracle.com/licenses/upl.
> #
> -# This test verifies that USDT and pid probes can share underlying probes.
> +# This test verifies various properties of USDT and pid probes sharing
> +# underlying probes.
>
> dtrace=$1
> +usdt=$2
Why is there a usdt=$2? It seems that usdt is always "t" and you'd
expect that in test/unittest/usdt.
> +mapping=$3
>
> # Set up test directory.
>
> @@ -17,13 +20,21 @@ cd $DIRNAME
>
> # Create test source files.
>
> -cat > prov.d <<EOF
> +if [[ -z $mapping ]]; then
> + cat > prov.d <<EOF
> provider pyramid {
> probe entry(int, char, int, int);
> };
> EOF
> +else
> + cat > prov.d <<EOF
> +provider pyramid {
> + probe entry(int a, char b, int c, int d) : (int c, int d, int a, char b);
> +};
> +EOF
> +fi
>
> -cat > main.c <<EOF
> +cat > main.c <<'EOF'
> #include <stdio.h>
> #include "prov.h"
>
> @@ -48,7 +59,7 @@ EOF
>
> # Build the test program.
>
> -$dtrace -h -s prov.d
> +$dtrace $dt_flags -h -s prov.d
> if [ $? -ne 0 ]; then
> echo "failed to generate header file" >&2
> exit 1
> @@ -61,12 +72,12 @@ fi
> if [[ `uname -m` = "aarch64" ]]; then
> objdump -d main.o > disasm_foo.txt.before
> fi
> -$dtrace -G -64 -s prov.d main.o
> +$dtrace $dt_flags -G -64 -s prov.d main.o
> if [ $? -ne 0 ]; then
> echo "failed to create DOF" >&2
> exit 1
> fi
> -cc $test_cppflags -o main main.o prov.o
> +cc $test_ldflags -o main main.o prov.o
> if [ $? -ne 0 ]; then
> echo "failed to link final executable" >&2
> exit 1
> @@ -75,7 +86,7 @@ fi
> # Check that the program output is 0 when the USDT probe is not enabled.
> # That is, the PYRAMID_ENTRY_ENABLED() is-enabled checks should not pass.
>
> -./main > main.out
> +./main standalone > main.out
I'd vote against this change. Introducing a command-line arg that is
not used? Or, add it as a comment? But there is already a comment.
> echo "my result: 0" > main.out.expected
> if ! diff -q main.out main.out.expected > /dev/null; then
> echo '"my result"' looks wrong when not using DTrace
> @@ -88,11 +99,25 @@ fi
>
> # Run dtrace.
>
> -$dtrace $dt_flags -q -c ./main -o dtrace.out -n '
> +cat >> pidprobes.d <<'EOF'
> p*d$target::foo:
> {
> printf("%d %s:%s:%s:%s %x\n", pid, probeprov, probemod, probefunc, probename, uregs[R_PC]);
> -}' > main.out2
> +}
> +EOF
> +
> +if [[ -n $usdt ]]; then
> + echo 'pyramid$target::foo: {' >> pidprobes.d
> +
> + if [[ -n $mapping ]]; then
> + echo 'printf("%d %s:%s:%s:%s %i %i %i %c\n", pid, probeprov, probemod, probefunc, probename, args[0], args[1], args[2], args[3]);' >> pidprobes.d
> + else
> + echo 'printf("%d %s:%s:%s:%s %i %c %i %i\n", pid, probeprov, probemod, probefunc, probename, args[0], args[1], args[2], args[3]);' >> pidprobes.d
> + fi
> + echo '}' >> pidprobes.d
> +fi
> +
> +$dtrace $dt_flags -q -c ./main -o dtrace.out -s pidprobes.d > main.out2
> if [ $? -ne 0 ]; then
> echo "failed to run dtrace" >&2
> cat main.out2
> @@ -106,7 +131,7 @@ fi
> echo "my result: 10" > main.out2.expected
>
> if ! diff -q main.out2 main.out2.expected > /dev/null; then
> - echo '"my result"' looks wrong when using DTrace
> + echo '"my result"' looks wrong
Why? In particular, "when using DTrace" stands in contrast to the
earlier message 'echo '"my result"' looks wrong when not using DTrace'.
> echo === got ===
> cat main.out2
> echo === expected ===
> @@ -262,8 +287,17 @@ for pc in $pcs; do
> done
> echo $usdt_pcs | awk '{printf("'$pid' pyramid'$pid':main:foo:entry %x\n", $1);}' >> dtrace.out.expected
> echo $usdt_pcs | awk '{printf("'$pid' pyramid'$pid':main:foo:entry %x\n", $2);}' >> dtrace.out.expected
> +if [[ -n $usdt ]]; then
> + if [[ -z $mapping ]]; then
> + echo "$pid pyramid$pid:main:foo:entry 2 a 16 128" >> dtrace.out.expected
> + echo "$pid pyramid$pid:main:foo:entry 4 b 32 256" >> dtrace.out.expected
> + else
> + echo "$pid pyramid$pid:main:foo:entry 16 128 2 a" >> dtrace.out.expected
> + echo "$pid pyramid$pid:main:foo:entry 32 256 4 b" >> dtrace.out.expected
> + fi
> +fi
>
> -# Sort and check.
> +# Sort and check (dropping any wake-up firings from deferred probing).
I guess I do not get this. Where does any "dropping" take place?
>
> sort dtrace.out > dtrace.out.sorted
> sort dtrace.out.expected > dtrace.out.expected.sorted
> diff --git a/test/unittest/usdt/tst.pidargmap.sh b/test/unittest/usdt/tst.pidargmap.sh
> new file mode 100755
> index 000000000000..0c83f8703539
> --- /dev/null
> +++ b/test/unittest/usdt/tst.pidargmap.sh
> @@ -0,0 +1,11 @@
> +#!/bin/bash
> +#
> +# Oracle Linux DTrace.
> +# Copyright (c) 2024, 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.
> +#
> +# This test verifies that USDT and pid probes that share underlying probes
> +# do not apply arg mappings (incorrectly) to the pid probes.
How do we verify that mappings do not apply (incorrectly) to pid
probes? Is there supposed to be a check on pid probe args?
> +
> +exec $(dirname $_test)/pidprobes.sh $1 t t
> diff --git a/test/unittest/usdt/tst.pidargs.sh b/test/unittest/usdt/tst.pidargs.sh
> new file mode 100755
> index 000000000000..53cba7c39624
> --- /dev/null
> +++ b/test/unittest/usdt/tst.pidargs.sh
> @@ -0,0 +1,11 @@
> +#!/bin/bash
> +#
> +# Oracle Linux DTrace.
> +# Copyright (c) 2024, 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.
> +#
> +# This test verifies that USDT and pid probes that share underlying probes
> +# get the arguments correct for the USDT probes.
> +
> +exec $(dirname $_test)/pidprobes.sh $1 t ""
next prev parent reply other threads:[~2024-11-07 20:54 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-06 11:29 [PATCH v7 0/6] usdt typed args, translators and arg mapping Nick Alcock
2024-11-06 11:29 ` [PATCH v7 1/6] usdt: get arg types and xlations into DTrace from the DOF Nick Alcock
2024-11-06 11:29 ` [PATCH v7 2/6] dtprobed: stop skipping zero-tracepoint probes in dof_stash.c Nick Alcock
2024-11-06 11:29 ` [PATCH v7 3/6] cg: add argument mapping in the trampoline Nick Alcock
2024-11-06 11:29 ` [PATCH v7 4/6] usdt: typed args and arg mapping Nick Alcock
2024-11-06 11:29 ` [PATCH v7 5/6] usdt: new tests for USDT arg sanity with overlapping pid probes Nick Alcock
2024-11-07 20:54 ` Eugene Loh [this message]
2024-11-08 13:13 ` Nick Alcock
2024-11-08 13:13 ` [PATCH v8 " Nick Alcock
2024-11-08 18:30 ` [PATCH v7 " Eugene Loh
2024-11-08 20:21 ` Nick Alcock
2024-11-06 11:29 ` [PATCH v7 6/6] usdt: fix create_underlying error path Nick Alcock
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c7e23550-b87c-9750-e17f-20b7b060854c@oracle.com \
--to=eugene.loh@oracle.com \
--cc=dtrace-devel@oss.oracle.com \
--cc=dtrace@lists.linux.dev \
--cc=nick.alcock@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox