public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Shuah Khan <shuahkh@osg.samsung.com>
To: Naresh Kamboju <naresh.kamboju@linaro.org>,
	Tyler Baker <tyler.baker@linaro.org>
Cc: alexey.kodanev@oracle.com,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	lsk-team@linaro.org, Kevin Hilman <khilman@linaro.org>,
	Milosz Wasilewski <milosz.wasilewski@linaro.org>,
	Shuah Khan <shuahkh@osg.samsung.com>
Subject: Re: [PATCH] selftests/zram: Adding zram tests
Date: Thu, 13 Aug 2015 13:39:52 -0600	[thread overview]
Message-ID: <55CCF288.3020004@osg.samsung.com> (raw)
In-Reply-To: <CA+G9fYtdWhrrV=w14zVojuCLBLs8Z4kAHsc66EPHJqXTPPwQTQ@mail.gmail.com>

On 08/13/2015 01:21 PM, Naresh Kamboju wrote:
> Hi Shuah Khan,
> 
> On 23 July 2015 at 20:33, Shuah Khan <shuahkh@osg.samsung.com> wrote:
>> On 07/22/2015 06:00 PM, Tyler Baker wrote:
>>> Hi Naresh,
>>>
>>> On 7 July 2015 at 05:03,  <naresh.kamboju@linaro.org> wrote:
>>>> From: Naresh Kamboju <naresh.kamboju@linaro.org>
>>>>
>>>> zram_lib.sh: create library with initialization/cleanup functions
>>>> zram01.sh: creates general purpose ram disks with different filesystems
>>>> zram02.sh: creates block device for swap
>>>> README: ZRAM introduction and Kconfig required.
>>>> Makefile: To run zram tests
>>>
>>> (./zram01.sh && echo "selftests: zram01.sh [PASS]") || echo
>>> "selftests: zram01.sh [FAIL]"
>>> (./zram02.sh && echo "selftests: zram02.sh [PASS]") || echo
>>> "selftests: zram02.sh [FAIL]"
>>> (./zram_lib.sh && echo "selftests: zram_lib.sh [PASS]") || echo
>>> "selftests: zram_lib.sh [FAIL]"
>>>
>>> Above is the output from the run_kselftests.sh. Do we want to run
>>> zram_lib.sh as a test case as it just a library?
>>
>> Please make sure test doesn't fail when zram isn't configured.
>> i.e it should exit gracefully with a message saying zram isn't
>> configured. Please see below:
> 
> I agree with Shuah Khan comments.
> run_kselftests.sh is design to print results in PASS or FAIL.
> We need a way in run_kselftests.sh to print NO_CONFIG when it is not a
> real failure instead it is a Kconfig not enabled.
> 
>>

snip

>>>> +zram_load()
>>>> +{
>>>> +       # check zram module exists
>>>> +       MODULE_PATH=/lib/modules/`uname -r`/kernel/drivers/zram/zram.ko
>>>> +       if [ -f $MODULE_PATH ]; then
>>>> +               MODULE=1
>>>> +               echo "create '$dev_num' zram device(s)"
>>>> +               modprobe zram num_devices=$dev_num || \
>>>> +               echo "failed to insert zram module"
>>>> +
>>>> +               dev_num_created=$(ls /dev/zram* | wc -w)
>>>> +
>>>> +               if [ "$dev_num_created" -ne "$dev_num" ]; then
>>>> +                       echo "unexpected num of devices: $dev_num_created"
>>>> +                       ERR_CODE=-1
>>>> +               else
>>>> +                       echo "zram load module successful"
>>>> +               fi
>>>> +       elif [ -b /dev/zram0 ]; then
>>>> +               echo "/dev/zram0 device file found: OK"
>>>> +       else
>>>> +               echo "ERROR: No zram.ko module or no /dev/zram0 device found"
>>>> +               echo "$TCID : CONFIG_ZRAM is not set"
>>>> +               exit 1
>>>> +       fi
>>
>> In this case, when zram.ko module or no /dev/zram0 device found,
>> test should exit gracefully.
> 
> Here with this case, when test run manually it prints "CONFIG_ZRAM is
> not set" but with run_kselftests.sh script file it gonna FAIL with
> non-zero exit code. but it is not a real failure.
> How to handle this case ?
> 

Right. One way to do this is write wrapper script zram.sh that does
these checks first and then invokes the zram01.sh and zram02.sh
This way you can do the pre-reqs checks first and then run the tests.

Please take a look at tests that do this. e.g: net/test_bpf.sh

thanks,
-- Shuah

-- 
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
shuahkh@osg.samsung.com | (970) 217-8978

  reply	other threads:[~2015-08-13 19:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-07 12:03 [PATCH] selftests/zram: Adding zram tests naresh.kamboju
2015-07-23  0:00 ` Tyler Baker
2015-07-23 15:03   ` Shuah Khan
2015-08-13 19:21     ` Naresh Kamboju
2015-08-13 19:39       ` Shuah Khan [this message]
2015-08-13 19:08   ` Naresh Kamboju
2015-08-13 19:36     ` Shuah Khan
     [not found] ` <CADRr18PYhpcget82C1u_yODVpzLAt0W=DiexCRwn99Wjz5ZqJg@mail.gmail.com>
2015-07-27  1:46   ` Alex Shi
2015-08-14 11:44 ` Alexey Kodanev

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=55CCF288.3020004@osg.samsung.com \
    --to=shuahkh@osg.samsung.com \
    --cc=alexey.kodanev@oracle.com \
    --cc=khilman@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lsk-team@linaro.org \
    --cc=milosz.wasilewski@linaro.org \
    --cc=naresh.kamboju@linaro.org \
    --cc=tyler.baker@linaro.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