[DTrace-devel] [PATCH] test: Allow duplicate usym/umod/uaddr if for different pids
eugene.loh at oracle.com
eugene.loh at oracle.com
Thu Dec 5 19:13:18 UTC 2024
From: Eugene Loh <eugene.loh at 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 at 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
More information about the DTrace-devel
mailing list