Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754315AbbHMTj4 (ORCPT ); Thu, 13 Aug 2015 15:39:56 -0400 Received: from lists.s-osg.org ([54.187.51.154]:57662 "EHLO lists.s-osg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754232AbbHMTjx (ORCPT ); Thu, 13 Aug 2015 15:39:53 -0400 Message-ID: <55CCF288.3020004@osg.samsung.com> Date: Thu, 13 Aug 2015 13:39:52 -0600 From: Shuah Khan Organization: Samsung Open Source Group User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-Version: 1.0 To: Naresh Kamboju , Tyler Baker CC: alexey.kodanev@oracle.com, "linux-kernel@vger.kernel.org" , lsk-team@linaro.org, Kevin Hilman , Milosz Wasilewski , Shuah Khan Subject: Re: [PATCH] selftests/zram: Adding zram tests References: <1436270600-15395-1-git-send-email-naresh.kamboju@linaro.org> <55B10259.7000804@osg.samsung.com> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3542 Lines: 94 On 08/13/2015 01:21 PM, Naresh Kamboju wrote: > Hi Shuah Khan, > > On 23 July 2015 at 20:33, Shuah Khan wrote: >> On 07/22/2015 06:00 PM, Tyler Baker wrote: >>> Hi Naresh, >>> >>> On 7 July 2015 at 05:03, wrote: >>>> From: Naresh Kamboju >>>> >>>> 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/