Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: 37f46601383a ("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>

authored by

Fushuai Wang and committed by
Shuah Khan
6e39903c 9ace4753

+17 -1
+17 -1
tools/testing/selftests/ftrace/test.d/00basic/trace_marker_raw.tc
··· 89 89 # The id must be four bytes, test that 3 bytes fails a write 90 90 if echo -n abc > ./trace_marker_raw ; then 91 91 echo "Too small of write expected to fail but did not" 92 + echo ${ORIG} > buffer_size_kb 92 93 exit_fail 93 94 fi 94 95 ··· 100 99 101 100 if write_buffer 0xdeadbeef $size ; then 102 101 echo "Too big of write expected to fail but did not" 102 + echo ${ORIG} > buffer_size_kb 103 103 exit_fail 104 104 fi 105 105 } 106 106 107 + ORIG=`cat buffer_size_kb` 108 + 109 + # test_multiple_writes test needs at least 12KB buffer 110 + NEW_SIZE=12 111 + 112 + if [ ${ORIG} -lt ${NEW_SIZE} ]; then 113 + echo ${NEW_SIZE} > buffer_size_kb 114 + fi 115 + 107 116 test_buffer 108 - test_multiple_writes 117 + if ! test_multiple_writes; then 118 + echo ${ORIG} > buffer_size_kb 119 + exit_fail 120 + fi 121 + 122 + echo ${ORIG} > buffer_size_kb