From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
James Clark <james.clark@linaro.org>,
Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
Clark Williams <williams@redhat.com>,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH v1 10/17] perf tests record: Exercise more record options
Date: Tue, 24 Nov 2026 15:45:57 -0300 [thread overview]
Message-ID: <20261124184604.24983-11-acme@kernel.org> (raw)
In-Reply-To: <20261124184604.24983-1-acme@kernel.org>
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Add the dry-run, no samples, buildid, synthesis, sampling, buffering,
aio, affinity, delay, overwrite, callchain, mmap pages and clockid
variants.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/tests/shell/record_options.sh | 173 +++++++++++++++++++++++
1 file changed, 173 insertions(+)
create mode 100755 tools/perf/tests/shell/record_options.sh
diff --git a/tools/perf/tests/shell/record_options.sh b/tools/perf/tests/shell/record_options.sh
new file mode 100755
index 0000000000000000..b2bf51b5dc44c189
--- /dev/null
+++ b/tools/perf/tests/shell/record_options.sh
@@ -0,0 +1,173 @@
+#!/bin/bash
+# perf record option tests
+# SPDX-License-Identifier: GPL-2.0
+
+set -e
+
+temp_dir=$(mktemp -d /tmp/__perf_test_record_opts.XXXXXX)
+err=0
+
+cleanup() {
+ rm -rf "${temp_dir}"
+
+ trap - EXIT TERM INT
+}
+
+trap_cleanup() {
+ echo "Unexpected signal in ${FUNCNAME[1]}"
+ cleanup
+ exit 1
+}
+trap trap_cleanup EXIT TERM INT
+
+test_record() {
+ local desc="$1" out="$2"
+
+ shift 2
+ echo "Record ${desc}"
+ if ! perf record -q -e cpu-clock -c 1 "$@" -o "${temp_dir}/${out}" -- sleep 0.1
+ then
+ echo "Record ${desc} [Failed: perf record failed]"
+ err=1
+ return
+ fi
+ if ! perf report -i "${temp_dir}/${out}" -q 2> /dev/null | grep -q sleep
+ then
+ echo "Record ${desc} [Failed: no samples]"
+ err=1
+ return
+ fi
+ echo "Record ${desc} [Success]"
+}
+
+test_timestamp_filename() {
+ echo "Record timestamp filename"
+ if ! perf record -q -e cpu-clock -c 1 --timestamp-filename \
+ -o "${temp_dir}/tsfn" -- sleep 0.1
+ then
+ echo "Record timestamp filename [Failed: perf record failed]"
+ err=1
+ return
+ fi
+ if ! ls "${temp_dir}/tsfn".* > /dev/null 2>&1
+ then
+ echo "Record timestamp filename [Failed: no timestamped file]"
+ err=1
+ return
+ fi
+ echo "Record timestamp filename [Success]"
+}
+
+test_switch_output() {
+ echo "Record switch output"
+ if ! perf record -q -e cpu-clock -c 1 --switch-output=size=64K \
+ -o "${temp_dir}/sw" -- sleep 0.2
+ then
+ echo "Record switch output [Failed: perf record failed]"
+ err=1
+ return
+ fi
+ if ! ls "${temp_dir}/sw".* > /dev/null 2>&1
+ then
+ echo "Record switch output [Failed: no switched files]"
+ err=1
+ return
+ fi
+ echo "Record switch output [Success]"
+}
+
+test_clockid() {
+ echo "Record clockid"
+ if ! perf record -q -e cpu-clock -c 1 -k CLOCK_MONOTONIC \
+ -o "${temp_dir}/clock" -- sleep 0.1
+ then
+ echo "Record clockid [Failed: perf record failed]"
+ err=1
+ return
+ fi
+ if ! perf script -i "${temp_dir}/clock" -F tod 2> /dev/null | \
+ grep -qE '^[0-9]{4}-[0-9]{2}-[0-9]{2}'
+ then
+ echo "Record clockid [Failed: no wall clock timestamps]"
+ err=1
+ return
+ fi
+ echo "Record clockid [Success]"
+}
+
+test_record_option() {
+ local desc="$1"
+
+ shift 1
+ echo "Record option ${desc}"
+ rm -f "${temp_dir}/${desc}.data"
+ if ! perf record -q -e cpu-clock -c 1 "$@" -o "${temp_dir}/${desc}.data" -- sleep 0.1
+ then
+ echo "Record option ${desc} [Failed: perf record failed]"
+ err=1
+ return
+ fi
+ if [ ! -s "${temp_dir}/${desc}.data" ]
+ then
+ echo "Record option ${desc} [Failed: no data recorded]"
+ err=1
+ return
+ fi
+ echo "Record option ${desc} [Success]"
+}
+
+test_dry_run() {
+ echo "Record option dry run"
+ if ! perf record -q -e cpu-clock -c 1 --dry-run \
+ -o "${temp_dir}/dry-run.data" -- sleep 0.1
+ then
+ echo "Record option dry run [Failed: perf record failed]"
+ err=1
+ return
+ fi
+ if [ -e "${temp_dir}/dry-run.data" ]
+ then
+ echo "Record option dry run [Failed: recorded data]"
+ err=1
+ return
+ fi
+ echo "Record option dry run [Success]"
+}
+
+test_record "aio" "aio" --aio=2
+test_record "threads core" "threads-core" --threads=core
+test_record "threads package" "threads-package" --threads=package
+test_record "threads numa" "threads-numa" --threads=numa
+test_record "affinity" "affinity" --affinity=cpu
+test_record "mmap flush" "mmap-flush" --mmap-flush=1
+test_record "max size" "max-size" --max-size=1M
+test_record "timestamp boundary" "ts-boundary" --timestamp-boundary
+test_record "user callchains" "callchains" --user-callchains --call-graph fp
+test_timestamp_filename
+test_switch_output
+test_clockid
+test_dry_run
+test_record_option no-samples -n
+test_record_option buildid-all --buildid-all
+test_record_option buildid-mmap --buildid-mmap
+test_record_option synth-no --synth no
+test_record_option synth-task --synth task
+test_record_option synth-mmap --synth mmap
+test_record_option sample-cpu --sample-cpu
+test_record_option weight -W
+test_record_option raw-samples -R
+test_record_option no-buffering --no-buffering
+test_record_option no-bpf-event --no-bpf-event
+test_record_option proc-map-timeout --proc-map-timeout 100
+test_record_option num-thread-synthesize --num-thread-synthesize 1
+test_record_option aio-one --aio=1
+test_record_option affinity-node --affinity=node
+test_record_option delay -D 10
+test_record_option tail-synthesize --tail-synthesize
+test_record_option overwrite --overwrite
+test_record_option data -d
+test_record_option mmap-pages -m 4,8
+test_record_option clockid-monotonic-raw -k CLOCK_MONOTONIC_RAW
+
+cleanup
+exit $err
--
2.56.0
next prev parent reply other threads:[~2026-11-24 18:46 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 18:45 [PATCH v1 00/17] perf tests: Add coverage for the untested perf subcommands Arnaldo Carvalho de Melo
2026-11-24 18:45 ` [PATCH v1 01/17] perf tests top: Pin the ring buffer size Arnaldo Carvalho de Melo
2026-11-24 19:01 ` sashiko-bot
2026-11-24 18:45 ` [PATCH v1 02/17] perf tests sched: Exercise the sched views and options Arnaldo Carvalho de Melo
2026-11-24 18:58 ` sashiko-bot
2026-11-24 18:45 ` [PATCH v1 03/17] perf tests help: Add a basic perf help test Arnaldo Carvalho de Melo
2026-11-24 18:45 ` [PATCH v1 04/17] perf tests config: Exercise the config file and list options Arnaldo Carvalho de Melo
2026-11-24 18:45 ` [PATCH v1 05/17] perf tests script: Exercise the list, fields and dump options Arnaldo Carvalho de Melo
2026-11-24 18:54 ` sashiko-bot
2026-11-24 18:45 ` [PATCH v1 06/17] perf tests sort: Exercise the report and diff sort keys Arnaldo Carvalho de Melo
2026-11-24 19:02 ` sashiko-bot
2026-11-24 18:45 ` [PATCH v1 07/17] perf tests diff: Exercise the output options Arnaldo Carvalho de Melo
2026-11-24 18:57 ` sashiko-bot
2026-11-24 18:45 ` [PATCH v1 08/17] perf tests annotate: Exercise the output and filter options Arnaldo Carvalho de Melo
2026-11-24 18:45 ` [PATCH v1 09/17] perf tests report: Exercise the output and format options Arnaldo Carvalho de Melo
2026-11-24 18:45 ` Arnaldo Carvalho de Melo [this message]
2026-11-24 19:03 ` [PATCH v1 10/17] perf tests record: Exercise more record options sashiko-bot
2026-11-24 18:45 ` [PATCH v1 11/17] perf tests trace: Exercise the tracing options Arnaldo Carvalho de Melo
2026-11-24 19:02 ` sashiko-bot
2026-11-24 18:45 ` [PATCH v1 12/17] perf tests timechart: Exercise the report options Arnaldo Carvalho de Melo
2026-11-24 18:46 ` [PATCH v1 13/17] perf tests kmem: Add a basic perf kmem test Arnaldo Carvalho de Melo
2026-11-24 18:57 ` sashiko-bot
2026-11-24 18:46 ` [PATCH v1 14/17] perf tests bench: Add smoke tests for perf bench Arnaldo Carvalho de Melo
2026-11-24 19:03 ` sashiko-bot
2026-11-24 18:46 ` [PATCH v1 15/17] perf tests lock: Exercise perf lock report and info Arnaldo Carvalho de Melo
2026-11-24 18:46 ` [PATCH v1 16/17] perf tests probe: Exercise the variable and line listing Arnaldo Carvalho de Melo
2026-11-24 19:00 ` sashiko-bot
2026-11-24 18:46 ` [PATCH v1 17/17] perf tests report: Exercise the TUI browsers Arnaldo Carvalho de Melo
2026-11-24 19:01 ` sashiko-bot
2026-11-24 19:03 ` [PATCH v1 00/17] perf tests: Add coverage for the untested perf subcommands sashiko-bot
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=20261124184604.24983-11-acme@kernel.org \
--to=acme@kernel.org \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=tglx@linutronix.de \
--cc=williams@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.