Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Joe Lawrence <joe.lawrence@redhat.com>
To: Petr Mladek <pmladek@suse.com>
Cc: "Naresh Kamboju" <naresh.kamboju@linaro.org>,
	"Michael Ellerman" <mpe@ellerman.id.au>,
	"open list:KERNEL SELFTEST FRAMEWORK"
	<linux-kselftest@vger.kernel.org>,
	"open list" <linux-kernel@vger.kernel.org>,
	"Kees Cook" <keescook@chromium.org>,
	"Anders Roxell" <anders.roxell@linaro.org>,
	"Daniel Díaz" <daniel.diaz@linaro.org>,
	"Justin Cook" <justin.cook@linaro.org>,
	lkft-triage@lists.linaro.org, "Miroslav Benes" <mbenes@suse.cz>,
	"Shuah Khan" <shuah@kernel.org>
Subject: Re: [PATCH 1/2] selftests/lkdtm: Don't clear dmesg when running tests
Date: Fri, 26 Jun 2020 09:38:43 -0400	[thread overview]
Message-ID: <762d9ca5-82f3-588c-b147-b0954a764ea7@redhat.com> (raw)
In-Reply-To: <20200626080252.GL8444@alley>

On 6/26/20 4:02 AM, Petr Mladek wrote:
> On Wed 2020-06-24 16:12:47, Joe Lawrence wrote:
>> On Wed, Jun 24, 2020 at 10:39:55AM +0200, Petr Mladek wrote:
>>> On Tue 2020-06-23 23:48:36, Joe Lawrence wrote:
>>>> On 6/22/20 4:51 AM, Naresh Kamboju wrote:
>>>>> On Fri, 8 May 2020 at 12:23, Michael Ellerman <mpe@ellerman.id.au> wrote:
>>>>>>
>>>>>> It is Very Rude to clear dmesg in test scripts. That's because the
>>>>>> script may be part of a larger test run, and clearing dmesg
>>>>>> potentially destroys the output of other tests.
>>>>>>
>>>>>> We can avoid using dmesg -c by saving the content of dmesg before the
>>>>>> test, and then using diff to compare that to the dmesg afterward,
>>>>>> producing a log with just the added lines.
>>>>>>
>>>>>>>>> diff --git a/tools/testing/selftests/lkdtm/run.sh b/tools/testing/selftests/lkdtm/run.sh
>>>>>> index dadf819148a4..0b409e187c7b 100755
>>>>>> --- a/tools/testing/selftests/lkdtm/run.sh
>>>>>> +++ b/tools/testing/selftests/lkdtm/run.sh
>>>>>>    # Record and dump the results
>>>>>> -dmesg -c >"$LOG"
>>>>>> +dmesg | diff --changed-group-format='%>' --unchanged-group-format='' "$DMESG" - > "$LOG" || true
>>>>>
>>>>> We are facing problems with the diff `=%>` part of the option.
>>>>> This report is from the OpenEmbedded environment.
>>>>> We have the same problem from livepatch_testcases.
>>>>>
>>>>> # selftests lkdtm BUG.sh
>>>>> lkdtm: BUG.sh_ #
>>>>> # diff unrecognized option '--changed-group-format=%>'
>>>>> unrecognized: option_'--changed-group-format=%>' #
>>>>> # BusyBox v1.27.2 (2020-03-30 164108 UTC) multi-call binary.
>>>>> v1.27.2: (2020-03-30_164108 #
> 
>> I did a bit more hacking to work that awk script into the livepatching
>> tests.  The changes aren't too bad and coding it ourselves lets us drop
>> the temporary dmesg file business.  If this looks good, I can send out
>> as a real patch, but then that raises a few questions:
> 
> The patch worked and I agree that it is not that bad.
> 
> Well, what about using "comm" as proposed by Michael in the other
> mail? It seems to be part of coreutils and should be everywhere.
> 
> I guess that many people, including me, are not fluent in awk.
> So, I am slightly in favor of the "comm" approach ;-)
> 

comm is definitely simpler and for some reason I forgot about the 
leading timestamps (again!) dismissing it thinking that the inputs 
weren't sorted.  But luckily they are and if Naresh or anyone can 
confirm that comm is well supported in the BusyBox testing environment, 
then using that is fine w/me.

-- Joe


  reply	other threads:[~2020-06-26 13:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-08  6:53 [PATCH 1/2] selftests/lkdtm: Don't clear dmesg when running tests Michael Ellerman
2020-05-08  6:53 ` [PATCH 2/2] selftests/lkdtm: Use grep -E instead of egrep Michael Ellerman
2020-05-08  7:30   ` Kees Cook
2020-05-08  7:30 ` [PATCH 1/2] selftests/lkdtm: Don't clear dmesg when running tests Kees Cook
2020-06-22  8:51 ` Naresh Kamboju
2020-06-24  3:48   ` Joe Lawrence
2020-06-24  8:39     ` Petr Mladek
2020-06-24 20:12       ` Joe Lawrence
2020-06-26  8:02         ` Petr Mladek
2020-06-26 13:38           ` Joe Lawrence [this message]
2020-06-26 15:51             ` Naresh Kamboju
2020-06-25  6:16   ` Kees Cook
2020-06-26 15:50     ` Naresh Kamboju

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=762d9ca5-82f3-588c-b147-b0954a764ea7@redhat.com \
    --to=joe.lawrence@redhat.com \
    --cc=anders.roxell@linaro.org \
    --cc=daniel.diaz@linaro.org \
    --cc=justin.cook@linaro.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=lkft-triage@lists.linaro.org \
    --cc=mbenes@suse.cz \
    --cc=mpe@ellerman.id.au \
    --cc=naresh.kamboju@linaro.org \
    --cc=pmladek@suse.com \
    --cc=shuah@kernel.org \
    /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