mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1] perf tests diff: Fixes to variable expansion and stdout
@ 2025-03-12  0:18 Ian Rogers
  2025-03-18 18:02 ` Namhyung Kim
  0 siblings, 1 reply; 2+ messages in thread
From: Ian Rogers @ 2025-03-12  0:18 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Ian Rogers, Adrian Hunter, Kan Liang, linux-perf-users,
	linux-kernel

When make_data fails its error message needs to go to stderr rather
than stdout and the stdout value is captured in a variable.  Quote the
$err value so that it is always a valid input for test.  This error is
commonly encountered if no sample data is gathered by the test.

Signed-off-by: Ian Rogers <irogers@google.com>
---
 tools/perf/tests/shell/diff.sh | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/perf/tests/shell/diff.sh b/tools/perf/tests/shell/diff.sh
index 14b87af88703..e05a5dc49479 100755
--- a/tools/perf/tests/shell/diff.sh
+++ b/tools/perf/tests/shell/diff.sh
@@ -39,13 +39,13 @@ make_data() {
   file="$1"
   if ! perf record -o "${file}" ${testprog} 2> /dev/null
   then
-    echo "Workload record [Failed record]"
+    echo "Workload record [Failed record]" >&2
     echo 1
     return
   fi
   if ! perf report -i "${file}" -q | grep -q "${testsym}"
   then
-    echo "Workload record [Failed missing output]"
+    echo "Workload record [Failed missing output]" >&2
     echo 1
     return
   fi
@@ -55,12 +55,12 @@ make_data() {
 test_two_files() {
   echo "Basic two file diff test"
   err=$(make_data "${perfdata1}")
-  if [ $err != 0 ]
+  if [ "$err" != 0 ]
   then
     return
   fi
   err=$(make_data "${perfdata2}")
-  if [ $err != 0 ]
+  if [ "$err" != 0 ]
   then
     return
   fi
@@ -77,12 +77,12 @@ test_two_files() {
 test_three_files() {
   echo "Basic three file diff test"
   err=$(make_data "${perfdata1}")
-  if [ $err != 0 ]
+  if [ "$err" != 0 ]
   then
     return
   fi
   err=$(make_data "${perfdata2}")
-  if [ $err != 0 ]
+  if [ "$err" != 0 ]
   then
     return
   fi
-- 
2.49.0.rc0.332.g42c0ae87b1-goog


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v1] perf tests diff: Fixes to variable expansion and stdout
  2025-03-12  0:18 [PATCH v1] perf tests diff: Fixes to variable expansion and stdout Ian Rogers
@ 2025-03-18 18:02 ` Namhyung Kim
  0 siblings, 0 replies; 2+ messages in thread
From: Namhyung Kim @ 2025-03-18 18:02 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Adrian Hunter,
	Kan Liang, linux-perf-users, linux-kernel, Ian Rogers

On Tue, 11 Mar 2025 17:18:41 -0700, Ian Rogers wrote:
> When make_data fails its error message needs to go to stderr rather
> than stdout and the stdout value is captured in a variable.  Quote the
> $err value so that it is always a valid input for test.  This error is
> commonly encountered if no sample data is gathered by the test.
> 
> 
Applied to perf-tools-next, thanks!

Best regards,
Namhyung



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-03-18 18:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-12  0:18 [PATCH v1] perf tests diff: Fixes to variable expansion and stdout Ian Rogers
2025-03-18 18:02 ` Namhyung Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®