* [PATCH] test: Use /usr/bin/perf for perf
@ 2025-10-21 3:19 eugene.loh
2025-10-21 3:26 ` Kris Van Hees
2025-10-21 10:45 ` [DTrace-devel] " Sam James
0 siblings, 2 replies; 3+ messages in thread
From: eugene.loh @ 2025-10-21 3:19 UTC (permalink / raw)
To: dtrace, dtrace-devel
From: Eugene Loh <eugene.loh@oracle.com>
The testsuite package has a dependency on the perf package. But that
package installs perf in /usr/bin. Meanwhile, there is a /sbin/perf,
which is likely to appear earlier in the search path for dtrace users.
That perf is a wrapper for an executable that might not exist, causing
some silent, unexpected behaviors with the test suite.
Change references to "perf" to be explicitly "/usr/bin/perf".
Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
---
test/unittest/cpc/tst.branches.x | 4 ++--
test/unittest/cpc/tst.instructions.x | 4 ++--
test/utils/cpc_get_events.sh | 4 ++--
test/utils/perf_count_event.sh | 4 ++--
4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/test/unittest/cpc/tst.branches.x b/test/unittest/cpc/tst.branches.x
index 4b235055d..a19d1bc6d 100755
--- a/test/unittest/cpc/tst.branches.x
+++ b/test/unittest/cpc/tst.branches.x
@@ -1,11 +1,11 @@
#!/bin/bash
#
# Oracle Linux DTrace.
-# Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2023, 2025, 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.
-if ! perf list hw | grep -qw branches; then
+if ! /usr/bin/perf list hw | grep -qw branches; then
echo 'no "branches" event on this system'
exit 2
fi
diff --git a/test/unittest/cpc/tst.instructions.x b/test/unittest/cpc/tst.instructions.x
index c3a2ede34..3c1e47b75 100755
--- a/test/unittest/cpc/tst.instructions.x
+++ b/test/unittest/cpc/tst.instructions.x
@@ -1,11 +1,11 @@
#!/bin/bash
#
# Oracle Linux DTrace.
-# Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2023, 2025, 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.
-if ! perf list hw | grep -qw instructions; then
+if ! /usr/bin/perf list hw | grep -qw instructions; then
echo 'no "instructions" event on this system'
exit 2
fi
diff --git a/test/utils/cpc_get_events.sh b/test/utils/cpc_get_events.sh
index 80d3584b2..cc833fbb9 100755
--- a/test/utils/cpc_get_events.sh
+++ b/test/utils/cpc_get_events.sh
@@ -1,7 +1,7 @@
#!/bin/bash
#
# Oracle Linux DTrace.
-# Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2023, 2025, 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.
@@ -13,7 +13,7 @@ eventnamelist="cpu-clock"
$(dirname $0)/cpc_temp_skip_bug.sh > /dev/null
if [ $? -eq 0 ]; then
for eventname in branches instructions; do
- if perf list hw | grep -qw $eventname; then
+ if /usr/bin/perf list hw | grep -qw $eventname; then
eventnamelist="$eventnamelist $eventname"
fi
done
diff --git a/test/utils/perf_count_event.sh b/test/utils/perf_count_event.sh
index 957363e55..bc1441f32 100755
--- a/test/utils/perf_count_event.sh
+++ b/test/utils/perf_count_event.sh
@@ -1,7 +1,7 @@
#!/bin/bash
#
# Oracle Linux DTrace.
-# Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2023, 2025, 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.
@@ -20,7 +20,7 @@ shift
# If the output is no good, report -1.
# If the output is time in msec, convert to nsec.
# Otherwise, just report the count.
-perf stat -e $event --no-big-num -x\ $utils/$* |& gawk '
+/usr/bin/perf stat -e $event --no-big-num -x\ $utils/$* |& gawk '
/^[^0-9]/ { print -1; exit 1 }
/ msec / { print int(1000000. * $1); exit 0 }
{ print $1; exit 0 }'
--
2.47.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] test: Use /usr/bin/perf for perf
2025-10-21 3:19 [PATCH] test: Use /usr/bin/perf for perf eugene.loh
@ 2025-10-21 3:26 ` Kris Van Hees
2025-10-21 10:45 ` [DTrace-devel] " Sam James
1 sibling, 0 replies; 3+ messages in thread
From: Kris Van Hees @ 2025-10-21 3:26 UTC (permalink / raw)
To: eugene.loh; +Cc: dtrace, dtrace-devel
On Mon, Oct 20, 2025 at 11:19:07PM -0400, eugene.loh@oracle.com wrote:
> From: Eugene Loh <eugene.loh@oracle.com>
>
> The testsuite package has a dependency on the perf package. But that
> package installs perf in /usr/bin. Meanwhile, there is a /sbin/perf,
> which is likely to appear earlier in the search path for dtrace users.
> That perf is a wrapper for an executable that might not exist, causing
> some silent, unexpected behaviors with the test suite.
>
> Change references to "perf" to be explicitly "/usr/bin/perf".
>
> Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
> ---
> test/unittest/cpc/tst.branches.x | 4 ++--
> test/unittest/cpc/tst.instructions.x | 4 ++--
> test/utils/cpc_get_events.sh | 4 ++--
> test/utils/perf_count_event.sh | 4 ++--
> 4 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/test/unittest/cpc/tst.branches.x b/test/unittest/cpc/tst.branches.x
> index 4b235055d..a19d1bc6d 100755
> --- a/test/unittest/cpc/tst.branches.x
> +++ b/test/unittest/cpc/tst.branches.x
> @@ -1,11 +1,11 @@
> #!/bin/bash
> #
> # Oracle Linux DTrace.
> -# Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
> +# Copyright (c) 2023, 2025, 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.
>
> -if ! perf list hw | grep -qw branches; then
> +if ! /usr/bin/perf list hw | grep -qw branches; then
> echo 'no "branches" event on this system'
> exit 2
> fi
> diff --git a/test/unittest/cpc/tst.instructions.x b/test/unittest/cpc/tst.instructions.x
> index c3a2ede34..3c1e47b75 100755
> --- a/test/unittest/cpc/tst.instructions.x
> +++ b/test/unittest/cpc/tst.instructions.x
> @@ -1,11 +1,11 @@
> #!/bin/bash
> #
> # Oracle Linux DTrace.
> -# Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
> +# Copyright (c) 2023, 2025, 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.
>
> -if ! perf list hw | grep -qw instructions; then
> +if ! /usr/bin/perf list hw | grep -qw instructions; then
> echo 'no "instructions" event on this system'
> exit 2
> fi
> diff --git a/test/utils/cpc_get_events.sh b/test/utils/cpc_get_events.sh
> index 80d3584b2..cc833fbb9 100755
> --- a/test/utils/cpc_get_events.sh
> +++ b/test/utils/cpc_get_events.sh
> @@ -1,7 +1,7 @@
> #!/bin/bash
> #
> # Oracle Linux DTrace.
> -# Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
> +# Copyright (c) 2023, 2025, 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.
>
> @@ -13,7 +13,7 @@ eventnamelist="cpu-clock"
> $(dirname $0)/cpc_temp_skip_bug.sh > /dev/null
> if [ $? -eq 0 ]; then
> for eventname in branches instructions; do
> - if perf list hw | grep -qw $eventname; then
> + if /usr/bin/perf list hw | grep -qw $eventname; then
> eventnamelist="$eventnamelist $eventname"
> fi
> done
> diff --git a/test/utils/perf_count_event.sh b/test/utils/perf_count_event.sh
> index 957363e55..bc1441f32 100755
> --- a/test/utils/perf_count_event.sh
> +++ b/test/utils/perf_count_event.sh
> @@ -1,7 +1,7 @@
> #!/bin/bash
> #
> # Oracle Linux DTrace.
> -# Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
> +# Copyright (c) 2023, 2025, 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.
>
> @@ -20,7 +20,7 @@ shift
> # If the output is no good, report -1.
> # If the output is time in msec, convert to nsec.
> # Otherwise, just report the count.
> -perf stat -e $event --no-big-num -x\ $utils/$* |& gawk '
> +/usr/bin/perf stat -e $event --no-big-num -x\ $utils/$* |& gawk '
> /^[^0-9]/ { print -1; exit 1 }
> / msec / { print int(1000000. * $1); exit 0 }
> { print $1; exit 0 }'
> --
> 2.47.3
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [DTrace-devel] [PATCH] test: Use /usr/bin/perf for perf
2025-10-21 3:19 [PATCH] test: Use /usr/bin/perf for perf eugene.loh
2025-10-21 3:26 ` Kris Van Hees
@ 2025-10-21 10:45 ` Sam James
1 sibling, 0 replies; 3+ messages in thread
From: Sam James @ 2025-10-21 10:45 UTC (permalink / raw)
To: eugene.loh--- via DTrace-devel; +Cc: dtrace, eugene.loh
"eugene.loh--- via DTrace-devel" <dtrace-devel@oss.oracle.com> writes:
> From: Eugene Loh <eugene.loh@oracle.com>
>
> The testsuite package has a dependency on the perf package. But that
> package installs perf in /usr/bin. Meanwhile, there is a /sbin/perf,
> which is likely to appear earlier in the search path for dtrace users.
> That perf is a wrapper for an executable that might not exist, causing
> some silent, unexpected behaviors with the test suite.
Just for my own curiosity: what exactly is /sbin/perf? I've never heard
of this "collision" before, so want to know if I should be aware of it
in other contexts.
>
> Change references to "perf" to be explicitly "/usr/bin/perf".
>
> Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
> ---
> test/unittest/cpc/tst.branches.x | 4 ++--
> test/unittest/cpc/tst.instructions.x | 4 ++--
> test/utils/cpc_get_events.sh | 4 ++--
> test/utils/perf_count_event.sh | 4 ++--
> 4 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/test/unittest/cpc/tst.branches.x b/test/unittest/cpc/tst.branches.x
> index 4b235055d..a19d1bc6d 100755
> --- a/test/unittest/cpc/tst.branches.x
> +++ b/test/unittest/cpc/tst.branches.x
> @@ -1,11 +1,11 @@
> #!/bin/bash
> #
> # Oracle Linux DTrace.
> -# Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
> +# Copyright (c) 2023, 2025, 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.
>
> -if ! perf list hw | grep -qw branches; then
> +if ! /usr/bin/perf list hw | grep -qw branches; then
> echo 'no "branches" event on this system'
> exit 2
> fi
> diff --git a/test/unittest/cpc/tst.instructions.x b/test/unittest/cpc/tst.instructions.x
> index c3a2ede34..3c1e47b75 100755
> --- a/test/unittest/cpc/tst.instructions.x
> +++ b/test/unittest/cpc/tst.instructions.x
> @@ -1,11 +1,11 @@
> #!/bin/bash
> #
> # Oracle Linux DTrace.
> -# Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
> +# Copyright (c) 2023, 2025, 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.
>
> -if ! perf list hw | grep -qw instructions; then
> +if ! /usr/bin/perf list hw | grep -qw instructions; then
> echo 'no "instructions" event on this system'
> exit 2
> fi
> diff --git a/test/utils/cpc_get_events.sh b/test/utils/cpc_get_events.sh
> index 80d3584b2..cc833fbb9 100755
> --- a/test/utils/cpc_get_events.sh
> +++ b/test/utils/cpc_get_events.sh
> @@ -1,7 +1,7 @@
> #!/bin/bash
> #
> # Oracle Linux DTrace.
> -# Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
> +# Copyright (c) 2023, 2025, 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.
>
> @@ -13,7 +13,7 @@ eventnamelist="cpu-clock"
> $(dirname $0)/cpc_temp_skip_bug.sh > /dev/null
> if [ $? -eq 0 ]; then
> for eventname in branches instructions; do
> - if perf list hw | grep -qw $eventname; then
> + if /usr/bin/perf list hw | grep -qw $eventname; then
> eventnamelist="$eventnamelist $eventname"
> fi
> done
> diff --git a/test/utils/perf_count_event.sh b/test/utils/perf_count_event.sh
> index 957363e55..bc1441f32 100755
> --- a/test/utils/perf_count_event.sh
> +++ b/test/utils/perf_count_event.sh
> @@ -1,7 +1,7 @@
> #!/bin/bash
> #
> # Oracle Linux DTrace.
> -# Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
> +# Copyright (c) 2023, 2025, 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.
>
> @@ -20,7 +20,7 @@ shift
> # If the output is no good, report -1.
> # If the output is time in msec, convert to nsec.
> # Otherwise, just report the count.
> -perf stat -e $event --no-big-num -x\ $utils/$* |& gawk '
> +/usr/bin/perf stat -e $event --no-big-num -x\ $utils/$* |& gawk '
> /^[^0-9]/ { print -1; exit 1 }
> / msec / { print int(1000000. * $1); exit 0 }
> { print $1; exit 0 }'
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-10-21 10:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-21 3:19 [PATCH] test: Use /usr/bin/perf for perf eugene.loh
2025-10-21 3:26 ` Kris Van Hees
2025-10-21 10:45 ` [DTrace-devel] " Sam James
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox