Skip to contentSkip to conversation

perf test: Remove the temporary trace record file when the test fails

PATCH In review Howard Chu 2 participants 2 messages Apr 5, 2025 – Apr 10, 2025 perf events

lore
Share & tools
lore

Howard Chu

author
#0 lore raw

PATCH 1/1 perf test: Remove the temporary trace record file when the test fails

Even if there's no nanosleep in the trace record file, it doesn't mean the file itself doesn't exist. Remove the temporary file since the test frequently fails on my machine and leaves behind many uncleaned temporary files.

---
 tools/perf/tests/shell/trace_record_replay.sh | 1 +
 1 file changed, 1 insertion(+)
tools/perf/tests/shell/trace_record_replay.sh +1 -0
index 6b4ed863c1ef..555537dc6cfa 100755
@@ -15,6 +15,7 @@ file=$(mktemp /tmp/temporary_file.XXXXX)
 perf trace record -o ${file} sleep 1 || exit 1
 if ! perf trace -i ${file} 2>&1 | grep nanosleep; then
 	echo "Failed: cannot find *nanosleep syscall"
+	rm -f ${file}
 	exit 1
 fi
 
Signature · 1 line
2.45.2
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Howard Chu

Even if there's no nanosleep in the trace record file, it doesn't mean the file itself doesn't exist. Remove the temporary file since the test frequently fails on my machine and leaves behind many uncleaned temporary files.

Thanks,
Namhyung

Quoted 19 lines
---
 tools/perf/tests/shell/trace_record_replay.sh | 1 +
 1 file changed, 1 insertion(+)
tools/perf/tests/shell/trace_record_replay.sh +1 -0
index 6b4ed863c1ef..555537dc6cfa 100755
@@ -15,6 +15,7 @@ file=$(mktemp /tmp/temporary_file.XXXXX)
 perf trace record -o ${file} sleep 1 || exit 1
 if ! perf trace -i ${file} 2>&1 | grep nanosleep; then
 	echo "Failed: cannot find *nanosleep syscall"
+	rm -f ${file}
 	exit 1
 fi
 
Signature · 1 line
2.45.2