From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755705AbbI2HTC (ORCPT ); Tue, 29 Sep 2015 03:19:02 -0400 Received: from mail9.hitachi.co.jp ([133.145.228.44]:59779 "EHLO mail9.hitachi.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755462AbbI2HSx (ORCPT ); Tue, 29 Sep 2015 03:18:53 -0400 Message-ID: <560A3B58.9060403@hitachi.com> Date: Tue, 29 Sep 2015 16:18:48 +0900 From: Hiraku Toyooka User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-Version: 1.0 To: Mark Salyzyn , CC: Tony Luck , Kees Cook , , Anton Vorontsov , Shuah Khan , Colin Cross , Subject: Re: [PATCH 1/2] selftests/pstore: add pstore test script for pre-reboot References: <20150908110615.9783.69477.stgit@arietta> <20150908110617.9783.4635.stgit@arietta> <55EF6DC5.2080207@android.com> <55F782D0.6000501@hitachi.com> <560070D0.90709@android.com> In-Reply-To: <560070D0.90709@android.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.232.31.66] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.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