From patchwork Mon Aug 31 11:41:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naresh Kamboju X-Patchwork-Id: 52888 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by patches.linaro.org (Postfix) with ESMTPS id 281F52127E for ; Mon, 31 Aug 2015 11:42:13 +0000 (UTC) Received: by labth1 with SMTP id th1sf39248041lab.2 for ; Mon, 31 Aug 2015 04:42:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=rcWlf6meDZWIIC46oTrDLlZhoXBnYnarROqZ7p1XorY=; b=bREfeY5pLHNxcSivzHprLO1bV9yMBIT+8WxFhON4Qq3jFRUmqMzfmJAPPH5zW2DznM SuJwYFnkplMOuC/J0j+jVgsRHXLcotyaZTVCewN9raJwrCqvcIB04cLDfvtSqXfEcxIo eLPiCF1P9xRlk9he2F4KUxJmHr0ZxYp2RJPMA7qCxNz81IywsqiT1pS6X6T4y+HLsApv Urw4REChU/1AR9rInVhDEmvN3WXfR2fWM9yeVLJRzXyqcZBpWPsyB1YTGH/vBh3mTF3Z OkYPoYrqtaufG5HcOsDvTC2p/LZg6nPs9ZzRHXDsUEXjK3WfXfqiPU2uRXZ9/g8P9sxe ZwgA== X-Gm-Message-State: ALoCoQmAJHHkxN0PLOagcjT65ZvugtI+vtGxdF8WJ+jo18lONFvXPRGW3rDvwKCINL/LRTpc6MRe X-Received: by 10.152.6.103 with SMTP id z7mr6168073laz.8.1441021332168; Mon, 31 Aug 2015 04:42:12 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.37.130 with SMTP id y2ls149679laj.101.gmail; Mon, 31 Aug 2015 04:42:11 -0700 (PDT) X-Received: by 10.152.6.162 with SMTP id c2mr5327174laa.1.1441021331862; Mon, 31 Aug 2015 04:42:11 -0700 (PDT) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id d2si12940821laa.142.2015.08.31.04.42.11 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 31 Aug 2015 04:42:11 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by laboe4 with SMTP id oe4so42966345lab.0 for ; Mon, 31 Aug 2015 04:42:11 -0700 (PDT) X-Received: by 10.152.22.99 with SMTP id c3mr10820411laf.32.1441021331743; Mon, 31 Aug 2015 04:42:11 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.151.194 with SMTP id us2csp1577675lbb; Mon, 31 Aug 2015 04:42:10 -0700 (PDT) X-Received: by 10.68.103.132 with SMTP id fw4mr37031379pbb.62.1441021330675; Mon, 31 Aug 2015 04:42:10 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q16si23437216pdl.240.2015.08.31.04.42.09; Mon, 31 Aug 2015 04:42:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752877AbbHaLmH (ORCPT + 28 others); Mon, 31 Aug 2015 07:42:07 -0400 Received: from mail-pa0-f50.google.com ([209.85.220.50]:32786 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752595AbbHaLmF (ORCPT ); Mon, 31 Aug 2015 07:42:05 -0400 Received: by padhy3 with SMTP id hy3so32470044pad.0 for ; Mon, 31 Aug 2015 04:42:04 -0700 (PDT) X-Received: by 10.66.150.66 with SMTP id ug2mr44556381pab.4.1441021324263; Mon, 31 Aug 2015 04:42:04 -0700 (PDT) Received: from localhost.localdomain ([122.169.163.37]) by smtp.gmail.com with ESMTPSA id fh10sm14326615pdb.95.2015.08.31.04.42.01 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 31 Aug 2015 04:42:03 -0700 (PDT) From: naresh.kamboju@linaro.org To: naresh.kamboju@linaro.org, linux-kernel@vger.kernel.org Cc: tyler.baker@linaro.org, milosz.wasilewski@linaro.org, shuahkh@osg.samsung.com, alexey.kodanev@oracle.com Subject: [PATCH 1/2] selftests/zram: must be run as root Date: Mon, 31 Aug 2015 17:11:55 +0530 Message-Id: <1441021316-20794-1-git-send-email-naresh.kamboju@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: naresh.kamboju@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Naresh Kamboju Adding new functionality check_prereqs() to check test must be run as root Signed-off-by: Naresh Kamboju --- tools/testing/selftests/zram/zram.sh | 12 ++++++++++++ tools/testing/selftests/zram/zram01.sh | 1 + tools/testing/selftests/zram/zram02.sh | 1 + tools/testing/selftests/zram/zram_lib.sh | 10 ++++++++++ 4 files changed, 24 insertions(+) diff --git a/tools/testing/selftests/zram/zram.sh b/tools/testing/selftests/zram/zram.sh index 6ea4b6a..20de9a7 100755 --- a/tools/testing/selftests/zram/zram.sh +++ b/tools/testing/selftests/zram/zram.sh @@ -1,6 +1,16 @@ #!/bin/bash TCID="zram.sh" +check_prereqs() +{ + local msg="skip all tests:" + + if [ $UID != 0 ]; then + echo $msg must be run as root >&2 + exit 0 + fi +} + run_zram () { echo "--------------------" echo "running zram tests" @@ -10,6 +20,8 @@ echo "" ./zram02.sh } +check_prereqs + # check zram module exists MODULE_PATH=/lib/modules/`uname -r`/kernel/drivers/block/zram/zram.ko if [ -f $MODULE_PATH ]; then diff --git a/tools/testing/selftests/zram/zram01.sh b/tools/testing/selftests/zram/zram01.sh index 2a2475d..b9566a6 100755 --- a/tools/testing/selftests/zram/zram01.sh +++ b/tools/testing/selftests/zram/zram01.sh @@ -79,6 +79,7 @@ zram_fill_fs() echo "zram compression ratio: $(echo "scale=2; $v / 100 " | bc):1: OK" } +check_prereqs zram_load zram_max_streams zram_compress_alg diff --git a/tools/testing/selftests/zram/zram02.sh b/tools/testing/selftests/zram/zram02.sh index 96e82dc..74569b8 100755 --- a/tools/testing/selftests/zram/zram02.sh +++ b/tools/testing/selftests/zram/zram02.sh @@ -37,6 +37,7 @@ zram_max_streams="2" zram_sizes="1048576" # 1M zram_mem_limits="1M" +check_prereqs zram_load zram_max_streams zram_set_disksizes diff --git a/tools/testing/selftests/zram/zram_lib.sh b/tools/testing/selftests/zram/zram_lib.sh index 3b6abf1..424e68e 100755 --- a/tools/testing/selftests/zram/zram_lib.sh +++ b/tools/testing/selftests/zram/zram_lib.sh @@ -20,6 +20,16 @@ dev_mounted=-1 trap INT +check_prereqs() +{ + local msg="skip all tests:" + + if [ $UID != 0 ]; then + echo $msg must be run as root >&2 + exit 0 + fi +} + zram_cleanup() { echo "zram cleanup"