Re: [PATCH 14/14] ringbuffer/selftest: Add basic selftest to test chaning subbuf order

From: Mathieu Desnoyers
Date: Sun Dec 10 2023 - 09:26:19 EST


On 2023-12-09 22:54, Steven Rostedt wrote:
[...]
+get_buffer_data_size() {
+ sed -ne 's/^.*data.*size:\([0-9][0-9]*\).*/\1/p' events/header_page
+}
+
+a="1234567890"
+
+make_str() {
+ cnt=$1
+ s=""
+ while [ $cnt -gt 10 ]; do
+ s="${s}${a}"
+ cnt=$((cnt-10))
+ done
+ while [ $cnt -gt 0 ]; do
+ s="${s}X"
+ cnt=$((cnt-1))
+ done
+ echo -n $s
+}
+
+test_buffer() {
+
+ size=`get_buffer_data_size`
+
+ str=`make_str $size`
+
+ echo $str > trace_marker
+
+ grep -q $a trace

This test has no clue if the record was truncated or not.

It basically repeats the string

"1234567890" until it fills the subbuffer size and pads with
XXXX as needed as trace marker payload, but the grep looks for the
"1234567890" pattern only.

The test should be extended to validate whether the trace marker
payload was truncated or not, otherwise it is of limited value.

Thanks,

Mathieu


--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com