]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
perf test: Additional pipe tests with pipe output written to a file
authorIan Rogers <irogers@google.com>
Thu, 29 Aug 2024 15:01:54 +0000 (08:01 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 30 Aug 2024 12:24:27 +0000 (09:24 -0300)
Additional pipe tests where piped files are written to disk. This
means that spotting a file name of "-" isn't a sufficient "is pipe?"
test.

Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nick Terrell <terrelln@fb.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Yanteng Si <siyanteng@loongson.cn>
Cc: Yicong Yang <yangyicong@hisilicon.com>
Link: https://lore.kernel.org/r/20240829150154.37929-9-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/tests/shell/pipe_test.sh

index ad10012fdc298dd013c3319b7d7703a39230a036..a3c94b4182c20ec61f4fa453f18ea43a3eaffa97 100755 (executable)
@@ -11,6 +11,7 @@ sym="noploop"
 skip_test_missing_symbol ${sym}
 
 data=$(mktemp /tmp/perf.data.XXXXXX)
+data2=$(mktemp /tmp/perf.data2.XXXXXX)
 prog="perf test -w noploop"
 err=0
 
@@ -19,6 +20,8 @@ set -e
 cleanup() {
   rm -rf "${data}"
   rm -rf "${data}".old
+  rm -rf "${data2}"
+  rm -rf "${data2}".old
 
   trap - EXIT TERM INT
 }
@@ -49,6 +52,14 @@ test_record_report() {
     return
   fi
 
+  perf record -g -e task-clock:u -o - ${prog} > ${data}
+  if ! perf report -i ${data} --task | grep -q ${task}
+  then
+    echo "Record+report pipe test [Failed - cannot find the test file in the perf report #3]"
+    err=1
+    return
+  fi
+
   echo "Record+report pipe test [Success]"
 }
 
@@ -86,6 +97,21 @@ test_inject_bids() {
     return
   fi
 
+  perf record -e task-clock:u -o - ${prog} > ${data}
+  if ! perf inject ${inject_opt} -i ${data} | perf report -i - | grep -q ${sym}; then
+    echo "Inject ${inject_opt} build-ids test [Failed - cannot find noploop function in pipe #5]"
+    err=1
+    return
+  fi
+
+  perf record -e task-clock:u -o - ${prog} > ${data}
+  perf inject ${inject_opt} -i ${data} -o ${data2}
+  if ! perf report -i ${data2} | grep -q ${sym}; then
+    echo "Inject ${inject_opt} build-ids test [Failed - cannot find noploop function in pipe #6]"
+    err=1
+    return
+  fi
+
   echo "Inject ${inject_opt} build-ids test [Success]"
 }