Skip to content

Commit 6e39903

Browse files
Fushuai Wangshuahkh
authored andcommitted
selftests/tracing: Fix test_multiple_writes stall
When /sys/kernel/tracing/buffer_size_kb is less than 12KB, the test_multiple_writes test will stall and wait for more input due to insufficient buffer space. Check current buffer_size_kb value before the test. If it is less than 12KB, it temporarily increase the buffer to 12KB, and restore the original value after the tests are completed. Link: https://lore.kernel.org/r/20260109033620.25727-1-fushuai.wang@linux.dev Fixes: 37f4660 ("selftests/tracing: Add basic test for trace_marker_raw file") Suggested-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Fushuai Wang <wangfushuai@baidu.com> Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
1 parent 9ace475 commit 6e39903

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

tools/testing/selftests/ftrace/test.d/00basic/trace_marker_raw.tc

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ test_buffer() {
8989
# The id must be four bytes, test that 3 bytes fails a write
9090
if echo -n abc > ./trace_marker_raw ; then
9191
echo "Too small of write expected to fail but did not"
92+
echo ${ORIG} > buffer_size_kb
9293
exit_fail
9394
fi
9495

@@ -99,9 +100,24 @@ test_buffer() {
99100

100101
if write_buffer 0xdeadbeef $size ; then
101102
echo "Too big of write expected to fail but did not"
103+
echo ${ORIG} > buffer_size_kb
102104
exit_fail
103105
fi
104106
}
105107

108+
ORIG=`cat buffer_size_kb`
109+
110+
# test_multiple_writes test needs at least 12KB buffer
111+
NEW_SIZE=12
112+
113+
if [ ${ORIG} -lt ${NEW_SIZE} ]; then
114+
echo ${NEW_SIZE} > buffer_size_kb
115+
fi
116+
106117
test_buffer
107-
test_multiple_writes
118+
if ! test_multiple_writes; then
119+
echo ${ORIG} > buffer_size_kb
120+
exit_fail
121+
fi
122+
123+
echo ${ORIG} > buffer_size_kb

0 commit comments

Comments
 (0)