All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hiraku Toyooka <hiraku.toyooka.gu@hitachi.com>
To: Mark Salyzyn <salyzyn@android.com>, <linux-kernel@vger.kernel.org>
Cc: Tony Luck <tony.luck@intel.com>,
	Kees Cook <keescook@chromium.org>, <linux-api@vger.kernel.org>,
	Anton Vorontsov <anton@enomsg.org>,
	Shuah Khan <shuahkh@osg.samsung.com>,
	Colin Cross <ccross@android.com>, <seiji.aguchi.tr@hitachi.com>
Subject: Re: [PATCH 1/2] selftests/pstore: add pstore test script for pre-reboot
Date: Tue, 29 Sep 2015 16:18:48 +0900	[thread overview]
Message-ID: <560A3B58.9060403@hitachi.com> (raw)
In-Reply-To: <560070D0.90709@android.com>

Hello,

I'm sorry for my late reply.

Mark Salyzyn wrote:
> Perfectly match is an issue, since something else might be using pmsg.
> For instance, one of the applications that uses this interface
> packetizes the messages so they can be picked out from other sources
> that do not comply with the header (count, magic number etc). In this
> case, should that daemon be active, your content would be ignores, but
> your content would also be buried, but can be needled out with grep.
>
> What you should do is grep for your string pattern within some
> acceptable regex, and one should be found and no other, and it should
> match perfectly. This would prevent another daemon's content from
> disrupting your test and causing a false negative.

OK. I think that the following method suit your intention.
By splitting unique test string into TEST_STRING_PATTERN part and UUID
part, we can check both the non-existence of previous content and the
unique match on reboot-comparison run.
I'll include this in v2.

# before crash
TEST_STRING_PATTERN="Testing pstore: uuid="
UUID=`cat /proc/sys/kernel/random/uuid`
echo "$TEST_STRING_PATTERN""$UUID" > /dev/pmsg0
echo "$UUID" > uuid

# after crash
prlog -n "Checking pmsg file properly keeps the content written before 
crash ... "
nr_matched=`grep -c "$TEST_STRING_PATTERN" pmsg-${backend}-0`
if [ $nr_matched -eq 1 ]; then
     grep -q "$TEST_STRING_PATTERN"`cat uuid` pmsg-${backend}-0
     if [ $? -eq 0 ]; then
         prlog "ok"
     else
         prlog "FAIL"
else
     prlog "FAIL"
fi


Best regards,
Hiraku Toyooka


WARNING: multiple messages have this Message-ID (diff)
From: Hiraku Toyooka <hiraku.toyooka.gu-FCd8Q96Dh0JBDgjK7y7TUQ@public.gmane.org>
To: Mark Salyzyn <salyzyn-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Tony Luck <tony.luck-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Kees Cook <keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
	linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Anton Vorontsov <anton-9xeibp6oKSgdnm+yROfE0A@public.gmane.org>,
	Shuah Khan <shuahkh-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>,
	Colin Cross <ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>,
	seiji.aguchi.tr-FCd8Q96Dh0JBDgjK7y7TUQ@public.gmane.org
Subject: Re: [PATCH 1/2] selftests/pstore: add pstore test script for pre-reboot
Date: Tue, 29 Sep 2015 16:18:48 +0900	[thread overview]
Message-ID: <560A3B58.9060403@hitachi.com> (raw)
In-Reply-To: <560070D0.90709-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>

Hello,

I'm sorry for my late reply.

Mark Salyzyn wrote:
> Perfectly match is an issue, since something else might be using pmsg.
> For instance, one of the applications that uses this interface
> packetizes the messages so they can be picked out from other sources
> that do not comply with the header (count, magic number etc). In this
> case, should that daemon be active, your content would be ignores, but
> your content would also be buried, but can be needled out with grep.
>
> What you should do is grep for your string pattern within some
> acceptable regex, and one should be found and no other, and it should
> match perfectly. This would prevent another daemon's content from
> disrupting your test and causing a false negative.

OK. I think that the following method suit your intention.
By splitting unique test string into TEST_STRING_PATTERN part and UUID
part, we can check both the non-existence of previous content and the
unique match on reboot-comparison run.
I'll include this in v2.

# before crash
TEST_STRING_PATTERN="Testing pstore: uuid="
UUID=`cat /proc/sys/kernel/random/uuid`
echo "$TEST_STRING_PATTERN""$UUID" > /dev/pmsg0
echo "$UUID" > uuid

# after crash
prlog -n "Checking pmsg file properly keeps the content written before 
crash ... "
nr_matched=`grep -c "$TEST_STRING_PATTERN" pmsg-${backend}-0`
if [ $nr_matched -eq 1 ]; then
     grep -q "$TEST_STRING_PATTERN"`cat uuid` pmsg-${backend}-0
     if [ $? -eq 0 ]; then
         prlog "ok"
     else
         prlog "FAIL"
else
     prlog "FAIL"
fi


Best regards,
Hiraku Toyooka

  reply	other threads:[~2015-09-29  7:19 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-08 11:06 [PATCH 0/2] selftests/pstore: add pstore test script Hiraku Toyooka
2015-09-08 11:06 ` [PATCH 1/2] selftests/pstore: add pstore test script for pre-reboot Hiraku Toyooka
2015-09-08 23:22   ` Mark Salyzyn
2015-09-08 23:22     ` Mark Salyzyn
2015-09-15  2:30     ` Hiraku Toyooka
2015-09-15  2:30       ` Hiraku Toyooka
2015-09-21 21:04       ` Mark Salyzyn
2015-09-29  7:18         ` Hiraku Toyooka [this message]
2015-09-29  7:18           ` Hiraku Toyooka
2015-09-08 23:37   ` Kees Cook
2015-09-08 23:37     ` Kees Cook
2015-09-15  2:31     ` Hiraku Toyooka
2015-09-15  2:31       ` Hiraku Toyooka
2015-09-16 12:02       ` 阿口誠司 / AGUCHI,SEIJI
2015-09-16 12:02         ` 阿口誠司 / AGUCHI,SEIJI
2015-09-17  5:54         ` Hiraku Toyooka
2015-09-17  5:54           ` Hiraku Toyooka
2015-09-08 11:06 ` [PATCH 2/2] selftests/pstore: add pstore test scripts going with reboot Hiraku Toyooka
2015-09-08 11:06   ` Hiraku Toyooka
2015-09-08 23:40   ` Kees Cook
2015-09-15  2:41     ` Hiraku Toyooka
2015-09-15  2:41       ` Hiraku Toyooka
2015-09-16 12:11       ` 阿口誠司 / AGUCHI,SEIJI
2015-09-16 12:11         ` 阿口誠司 / AGUCHI,SEIJI
2015-09-17  5:54         ` Hiraku Toyooka
2015-09-17  5:54           ` Hiraku Toyooka
2015-09-08 23:42 ` [PATCH 0/2] selftests/pstore: add pstore test script Kees Cook
2015-09-08 23:42   ` Kees Cook

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=560A3B58.9060403@hitachi.com \
    --to=hiraku.toyooka.gu@hitachi.com \
    --cc=anton@enomsg.org \
    --cc=ccross@android.com \
    --cc=keescook@chromium.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=salyzyn@android.com \
    --cc=seiji.aguchi.tr@hitachi.com \
    --cc=shuahkh@osg.samsung.com \
    --cc=tony.luck@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.