From: Vincent Donnefort <vdonnefort@google.com>
To: sashiko-reviews@lists.linux.dev
Cc: linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH v5 07/18] tracing/remotes: selftests: Add a test for the dmesg tracefs file
Date: Thu, 13 Aug 2026 15:06:15 +0100 [thread overview]
Message-ID: <an3PV-9CVSSj1eyb@google.com> (raw)
In-Reply-To: <20260812164040.19F761F000E9@smtp.kernel.org>
On Wed, Aug 12, 2026 at 04:40:39PM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
> - [Medium] The test script leaks a temporary file in `/tmp/` if the test aborts due to a failure (e.g., when a command fails under `set -e`).
> - [Medium] Unconditional write to the new `dmesg` tracefs file breaks the entire remote trace test suite on older kernels.
> - [Medium] The new `dmesg.tc` script lacks the necessary `# requires:` header for the `dmesg` tracefs file, causing it to fail instead of being skipped on older kernels.
> - [Low] The awk regular expression for matching dmesg timestamps contains an unescaped bracket, unintentionally creating a character class.
> --
>
> --- Patch [7]: [PATCH v5 07/18] tracing/remotes: selftests: Add a test for the dmesg tracefs file ---
> commit bd86167985384496571cc5a8f03ca97dd77d76fd
> Author: Vincent Donnefort <vdonnefort@google.com>
>
> tracing/remotes: selftests: Add a test for the dmesg tracefs file
>
> Exercise the newly introduced dmesg tracefs file that turns on and off
> the dmesg redirection.
>
> > diff --git a/tools/testing/selftests/ftrace/test.d/remotes/dmesg.tc b/tools/testing/selftests/ftrace/test.d/remotes/dmesg.tc
> > new file mode 100644
> > index 0000000000000..9d389f9d0fb78
> > --- /dev/null
> > +++ b/tools/testing/selftests/ftrace/test.d/remotes/dmesg.tc
> > @@ -0,0 +1,81 @@
> > +#!/bin/sh
> > +# SPDX-License-Identifier: GPL-2.0
> > +# description: Test trace remote dmesg redirection
> > +# requires: remotes/test
>
> [Severity: Medium]
> Does this script also need a "# requires: remotes/test/dmesg" declaration?
>
> Without this explicit dependency, running the test on an older kernel that
> lacks the dmesg tracefs file will cause it to fail abruptly due to set -e,
> rather than gracefully skipping it as unsupported.
>
> [ ... ]
>
> > + nr_events=128
> > + for i in $(seq 1 $nr_events); do
> > + echo $i > write_event
> > + done
> > +
> > + sleep 1
> > + output=$(mktemp /tmp/remote_test.XXXXXX)
>
> [Severity: Medium]
> Will this leak a temporary file in /tmp/ if the test aborts prematurely?
>
> The script is running with set -e, so if a validation step like check_trace
> fails, it will immediately exit before reaching the rm $output command.
>
> Should this use $TMPDIR instead, since the ftracetest framework cleans it up
> automatically?
sigh... I have s/TMPDIR/tmp/ temporarily (pun unintended) to debug the script...
I'll fix that!
>
> > + dmesg | awk -v ts=$last_ts '
> > + /^[ *[0-9]+\.[0-9]+\]/ {
>
> [Severity: Low]
> Does this regular expression match the bracket as intended?
>
> By failing to escape the first bracket (^[), this creates a character class
> that matches spaces, asterisks, brackets, or digits instead of a literal
> opening bracket.
>
> Could this be properly escaped as /^\[ *[0-9]+\.[0-9]+\]/ ?
Sure, I can escape "["
--
Vincent
>
> > + t=$0; sub(/^[[ \t]*/, "", t); sub(/].*/, "", t);
> > + if (t+0 > ts+0) print $0
> > + }' | grep "selftest id=" | sed 's/^[^]]*] //'> $output
>
> [ ... ]
>
> > diff --git a/tools/testing/selftests/ftrace/test.d/remotes/functions b/tools/testing/selftests/ftrace/test.d/remotes/functions
> > index 05224fac3653d..4a14aa72fdf09 100644
> > --- a/tools/testing/selftests/ftrace/test.d/remotes/functions
> > +++ b/tools/testing/selftests/ftrace/test.d/remotes/functions
> > @@ -8,6 +8,7 @@ setup_remote()
> >
> > cd remotes/$name/
> > echo 0 > tracing_on
> > + echo 0 > dmesg
>
> [Severity: Medium]
> Does this unconditional write break the test suite on older kernels?
>
> This setup function is used by all remote selftests. If the dmesg file does
> not exist, this echo will fail. Since the test scripts operate with set -e,
> this failure will cause the entire suite to crash on unsupported targets.
>
> Could we check for the file's existence before writing to it?
>
> > clear_trace
> > echo 7 > buffer_size_kb
> > echo 0 > events/enable
>
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20260812161340.2417322-1-vdonnefort@google.com?part=7
next prev parent reply other threads:[~2026-08-13 14:06 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-12 16:13 [PATCH v5 00/18] tracing/remotes: Add printk, dump_on_panic and boot parameters Vincent Donnefort
2026-08-12 16:13 ` [PATCH v5 01/18] tracing/remotes: Gate tracefs files opening on trace remote registration Vincent Donnefort
2026-08-12 16:31 ` sashiko-bot
2026-08-13 13:16 ` Vincent Donnefort
2026-08-12 16:13 ` [PATCH v5 02/18] tracing/remotes: Release tracefs,eventfs on registration failure Vincent Donnefort
2026-08-12 16:25 ` sashiko-bot
2026-08-13 13:25 ` Vincent Donnefort
2026-08-12 16:13 ` [PATCH v5 03/18] tracing/remotes: Use kstrtobool for boolean tracefs files Vincent Donnefort
2026-08-12 16:13 ` [PATCH v5 04/18] tracing/remotes: Use a single per-remote polling work Vincent Donnefort
2026-08-12 16:13 ` [PATCH v5 05/18] tracing/simple_ring_buffer: Add support for compressed length Vincent Donnefort
2026-08-12 16:42 ` sashiko-bot
2026-08-13 14:00 ` Vincent Donnefort
2026-08-12 16:13 ` [PATCH v5 06/18] tracing/remotes: Add dmesg tracefs file Vincent Donnefort
2026-08-12 16:42 ` sashiko-bot
2026-08-13 14:02 ` Vincent Donnefort
2026-08-12 16:13 ` [PATCH v5 07/18] tracing/remotes: selftests: Add a test for the " Vincent Donnefort
2026-08-12 16:40 ` sashiko-bot
2026-08-13 14:06 ` Vincent Donnefort [this message]
2026-08-12 16:13 ` [PATCH v5 08/18] tracing/remotes: selftests: Prefix hypervisor folder Vincent Donnefort
2026-08-12 16:52 ` sashiko-bot
2026-08-12 16:13 ` [PATCH v5 09/18] ring-buffer: Use irqsave for the reader lock in ring_buffer_poll_remote Vincent Donnefort
2026-08-12 16:13 ` [PATCH v5 10/18] ring-buffer: Use panic-friendly locking in ring_buffer_iter interface Vincent Donnefort
2026-08-12 16:54 ` sashiko-bot
[not found] ` <20260812161340.2417322-15-vdonnefort@google.com>
2026-08-12 17:02 ` [PATCH v5 14/18] tracing/remotes: selftests: Add a test for the dump_on_panic tracefs file sashiko-bot
[not found] ` <20260812161340.2417322-14-vdonnefort@google.com>
2026-08-12 17:08 ` [PATCH v5 13/18] tracing/remotes: Add " sashiko-bot
[not found] ` <20260812161340.2417322-17-vdonnefort@google.com>
2026-08-12 17:11 ` [PATCH v5 16/18] tracing/remotes: Add trace_remote cmdline options sashiko-bot
2026-08-13 14:21 ` Vincent Donnefort
[not found] ` <20260812161340.2417322-16-vdonnefort@google.com>
2026-08-12 17:13 ` [PATCH v5 15/18] tracing/remotes: Add poll_ms tracefs file sashiko-bot
2026-08-13 14:20 ` Vincent Donnefort
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=an3PV-9CVSSj1eyb@google.com \
--to=vdonnefort@google.com \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox