public inbox for dtrace@lists.linux.dev
 help / color / mirror / Atom feed
From: eugene.loh@oracle.com
To: dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com
Subject: [PATCH] test: Use /usr/bin/perf for perf
Date: Mon, 20 Oct 2025 23:19:07 -0400	[thread overview]
Message-ID: <20251021031907.30226-1-eugene.loh@oracle.com> (raw)

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


             reply	other threads:[~2025-10-21  3:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-21  3:19 eugene.loh [this message]
2025-10-21  3:26 ` [PATCH] test: Use /usr/bin/perf for perf Kris Van Hees
2025-10-21 10:45 ` [DTrace-devel] " Sam James

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=20251021031907.30226-1-eugene.loh@oracle.com \
    --to=eugene.loh@oracle.com \
    --cc=dtrace-devel@oss.oracle.com \
    --cc=dtrace@lists.linux.dev \
    /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