summaryrefslogtreecommitdiffstats
path: root/tools/perf/tests
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2021-02-08 21:09:06 +0100
committerArnaldo Carvalho de Melo <acme@redhat.com>2021-02-11 10:19:53 -0300
commitf32102aa3323a07af3a427f75e4f762263398cdd (patch)
treef00cb1328682445fc712f9fb44ba600d35d363f9 /tools/perf/tests
parentf624f6d0f6156f6a4caf0766781b42c17a293aa2 (diff)
downloadlinux-f32102aa3323a07af3a427f75e4f762263398cdd.tar.bz2
perf tests: Add daemon 'signal' command test
Add a test for the perf daemon 'signal' command. The test sends a signal to configured sessions and verifies the perf data files were generated accordingly. Committer testing: [root@five ~]# perf test daemon 76: daemon operations : Ok [root@five ~]# perf test -v daemon 76: daemon operations : --- start --- test child forked, pid 790017 test daemon list test daemon reconfig test daemon stop test daemon signal signal 12 sent to session 'test [790268]' signal 12 sent to session 'test [790268]' test child finished with 0 ---- end ---- daemon operations: Ok [root@five ~]# Signed-off-by: Jiri Olsa <jolsa@kernel.org> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Alexei Budankov <abudankov@huawei.com> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Michael Petlan <mpetlan@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: https://lore.kernel.org/r/20210208200908.1019149-23-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/tests')
-rwxr-xr-xtools/perf/tests/shell/daemon.sh40
1 files changed, 40 insertions, 0 deletions
diff --git a/tools/perf/tests/shell/daemon.sh b/tools/perf/tests/shell/daemon.sh
index 3b6b5aa5587c..2e414f2c9251 100755
--- a/tools/perf/tests/shell/daemon.sh
+++ b/tools/perf/tests/shell/daemon.sh
@@ -348,10 +348,50 @@ EOF
rm -f ${config}
}
+test_signal()
+{
+ echo "test daemon signal"
+
+ local config=$(mktemp /tmp/perf.daemon.config.XXX)
+ local base=$(mktemp -d /tmp/perf.daemon.base.XXX)
+
+ # prepare config
+ cat <<EOF > ${config}
+[daemon]
+base=BASE
+
+[session-test]
+run = -e cpu-clock --switch-output
+EOF
+
+ sed -i -e "s|BASE|${base}|" ${config}
+
+ # start daemon
+ daemon_start ${config} test
+
+ # send 2 signals
+ perf daemon signal --config ${config} --session test
+ perf daemon signal --config ${config}
+
+ # stop daemon
+ daemon_exit ${base} ${config}
+
+ # count is 2 perf.data for signals and 1 for perf record finished
+ count=`ls ${base}/session-test/ | grep perf.data | wc -l`
+ if [ ${count} -ne 3 ]; then
+ error=1
+ echo "FAILED: perf data no generated"
+ fi
+
+ rm -rf ${base}
+ rm -f ${config}
+}
+
error=0
test_list
test_reconfig
test_stop
+test_signal
exit ${error}