summaryrefslogtreecommitdiff
path: root/tools/perf/tests/shell
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2026-09-28 23:58:37 -0700
committerArnaldo Carvalho de Melo <acme@redhat.com>2026-09-29 20:53:09 +0200
commit4b34e3ad4cbb91ff5d6f99bb9c7dd85694c15bec (patch)
tree936dd688f33fb65cadc8bd25c859172915c37f78 /tools/perf/tests/shell
parent66d7274859b983a018ea672ef4790ce9b5c715d9 (diff)
perf python event_analyzing_sample: Default to in-memory SQLite database
When -d/--db is not specified, event_analyzing_sample.py created a temporary file in /tmp via tempfile.mkstemp() and deleted it in trace_end(). As noted during review, creating the database in a shared /tmp directory does not reserve SQLite's auxiliary sidecar filenames (-journal or -wal), and a temporary on-disk file is unnecessary when the caller did not ask to persist the database. Default to sqlite3.connect(":memory:") when db_path is not provided, removing the temporary file creation and cleanup logic, and test both the default in-memory mode and explicit -d file mode in test_event_analyzing_sample_python.sh. Fixes: eeb70645a8097437 ("perf python: Port event_analyzing_sample to perf module") Assisted-by: Antigravity:gemini-3.1-pro Signed-off-by: Ian Rogers <irogers@google.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/tests/shell')
-rwxr-xr-xtools/perf/tests/shell/test_event_analyzing_sample_python.sh8
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/perf/tests/shell/test_event_analyzing_sample_python.sh b/tools/perf/tests/shell/test_event_analyzing_sample_python.sh
index 5f0a41080acf..cddb12b67698 100755
--- a/tools/perf/tests/shell/test_event_analyzing_sample_python.sh
+++ b/tools/perf/tests/shell/test_event_analyzing_sample_python.sh
@@ -45,8 +45,14 @@ test_file_mode() {
exit 2
fi
- # Run the script
+ # Run the script with default (:memory:) database and with explicit -d path
if ! perf script event_analyzing_sample -i "${temp_data}" \
+ > "${temp_dir}/perf.mem.out" 2>&1 || \
+ ! grep -q "Statistics about the general events" "${temp_dir}/perf.mem.out" || \
+ grep -q "Error creating/inserting event" "${temp_dir}/perf.mem.out"; then
+ echo "Default in-memory database mode test failed."
+ err=1
+ elif ! perf script event_analyzing_sample -i "${temp_data}" \
-d "${temp_db}" > "${temp_dir}/perf.out" 2>&1; then
echo "File mode test failed."
err=1