From: Kris Van Hees <kris.van.hees@oracle.com>
To: eugene.loh@oracle.com
Cc: dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com
Subject: Re: [PATCH] test: Allow duplicate usym/umod/uaddr if for different pids
Date: Mon, 6 Jan 2025 16:04:25 -0500 [thread overview]
Message-ID: <Z3xFWS+WEviQKMtl@oracle.com> (raw)
In-Reply-To: <20241205191318.18587-1-eugene.loh@oracle.com>
On Thu, Dec 05, 2024 at 02:13:18PM -0500, eugene.loh@oracle.com wrote:
> From: Eugene Loh <eugene.loh@oracle.com>
>
> In 83da884cbdc5 ("Preface usym/umod/uaddr with pid"), a bug was fixed
> in which addresses in the same module (or function) might be mapped to
> multiple agg entries. This fix helped the associated tests run much
> more successfully. Nonetheless, tests would sometimes still fail.
>
> Another problem is that the tests themselves were overly narrow. It
> is fine for a module (or function) to appear multiple times in the
> aggregation output... if those entries correspond to different pids.
>
> Further, odd behaviors can result for some of the processes running on
> a system.
>
> Change the tests to add a "pid" agg key. Filter on only a few, select
> pids. Distinguish agg entries by pid.
>
> There are still occasional time outs observed with these tests,
> presumably because the tick-2s probe is not firing (when profile-1234hz
> is running).
>
> Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
> ---
> test/unittest/profile-n/tst.ufunc.sh | 12 ++++++++----
> test/unittest/profile-n/tst.umod.sh | 11 ++++++++---
> test/unittest/profile-n/tst.usym.sh | 11 ++++++++---
> 3 files changed, 24 insertions(+), 10 deletions(-)
>
> diff --git a/test/unittest/profile-n/tst.ufunc.sh b/test/unittest/profile-n/tst.ufunc.sh
> index 243822407..f5174a1e2 100755
> --- a/test/unittest/profile-n/tst.ufunc.sh
> +++ b/test/unittest/profile-n/tst.ufunc.sh
> @@ -11,10 +11,14 @@ tmpfile=$tmpdir/tst.profile_ufunc.$$
> script()
> {
> $dtrace $dt_flags -qs /dev/stdin <<EOF
> + BEGIN
> + {
> + printf("dtrace is %d\n", \$pid);
> + }
> profile-1234hz
> /arg1 != 0/
> {
> - @[ufunc(arg1)] = count();
> + @[ufunc(arg1), pid] = count();
> }
>
> tick-2s
> @@ -52,9 +56,9 @@ if ! grep -q 'bash`[a-zA-Z_]' $tmpfile; then
> status=1
> fi
>
> -# Check that functions are unique. (Exclude shared libraries and unresolved addresses.)
> -if gawk '!/^ *(ld-linux-|lib|([^`]*`)?0x)/ {print $1}' $tmpfile | \
> - sort | uniq -c | grep -qv " 1 "; then
> +# Check that functions are unique for each pid that interests us.
> +dtpid=`awk '/^dtrace is [0-9]*$/ { print $3 }' $tmpfile`
> +if gawk '$2 == '$child' || $2 == '$dtpid' {print $1, $2}' $tmpfile | sort | uniq -c | grep -qv " 1 "; then
> echo ERROR: duplicate ufunc
> status=1
> fi
> diff --git a/test/unittest/profile-n/tst.umod.sh b/test/unittest/profile-n/tst.umod.sh
> index 45d2b1e9b..7cfe2a073 100755
> --- a/test/unittest/profile-n/tst.umod.sh
> +++ b/test/unittest/profile-n/tst.umod.sh
> @@ -11,10 +11,14 @@ tmpfile=$tmpdir/tst.profile_umod.$$
> script()
> {
> $dtrace $dt_flags -qs /dev/stdin <<EOF
> + BEGIN
> + {
> + printf("dtrace is %d\n", \$pid);
> + }
> profile-1234hz
> /arg1 != 0/
> {
> - @[umod(arg1)] = count();
> + @[umod(arg1), pid] = count();
> }
>
> tick-2s
> @@ -52,8 +56,9 @@ if ! grep -wq 'bash' $tmpfile; then
> status=1
> fi
>
> -# Check that modules are unique. (Exclude shared libraries and unresolved addresses.)
> -if gawk '!/^ *lib/ && !/^ *ld-.*\.so / && !/^ *0x/ {print $1}' $tmpfile | sort | uniq -c | grep -qv " 1 "; then
> +# Check that modules are unique for each pid that interests us.
> +dtpid=`awk '/^dtrace is [0-9]*$/ { print $3 }' $tmpfile`
> +if gawk '$2 == '$child' || $2 == '$dtpid' {print $1, $2}' $tmpfile | sort | uniq -c | grep -qv " 1 "; then
> echo ERROR: duplicate umod
> status=1
> fi
> diff --git a/test/unittest/profile-n/tst.usym.sh b/test/unittest/profile-n/tst.usym.sh
> index 634e633b3..8e373b976 100755
> --- a/test/unittest/profile-n/tst.usym.sh
> +++ b/test/unittest/profile-n/tst.usym.sh
> @@ -11,10 +11,14 @@ tmpfile=$tmpdir/tst.profile_usym.$$
> script()
> {
> $dtrace $dt_flags -qs /dev/stdin <<EOF
> + BEGIN
> + {
> + printf("dtrace is %d\n", \$pid);
> + }
> profile-1234hz
> /arg1 != 0/
> {
> - @[usym(arg1)] = count();
> + @[usym(arg1), pid] = count();
> }
>
> tick-2s
> @@ -52,8 +56,9 @@ if ! grep -q 'bash`[a-zA-Z_]' $tmpfile; then
> status=1
> fi
>
> -# Check that symbols are unique. (Exclude shared libraries and unresolved addresses.)
> -if gawk '!/^ *lib/ && !/^ *0x/ {print $1}' $tmpfile | sort | uniq -c | grep -qv " 1 "; then
> +# Check that symbols are unique for each pid that interests us.
> +dtpid=`awk '/^dtrace is [0-9]*$/ { print $3 }' $tmpfile`
> +if gawk '$2 == '$child' || $2 == '$dtpid' {print $1, $2}' $tmpfile | sort | uniq -c | grep -qv " 1 "; then
> echo ERROR: duplicate usym
> status=1
> fi
> --
> 2.43.5
>
next prev parent reply other threads:[~2025-01-06 21:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-05 19:13 [PATCH] test: Allow duplicate usym/umod/uaddr if for different pids eugene.loh
2025-01-06 21:04 ` Kris Van Hees [this message]
2025-01-06 23:44 ` Kris Van Hees
2025-02-25 21:09 ` Kris Van Hees
2025-02-27 21:32 ` Eugene Loh
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=Z3xFWS+WEviQKMtl@oracle.com \
--to=kris.van.hees@oracle.com \
--cc=dtrace-devel@oss.oracle.com \
--cc=dtrace@lists.linux.dev \
--cc=eugene.loh@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