From patchwork Fri Jan 13 06:36:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 91263 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp50812qgi; Thu, 12 Jan 2017 22:37:37 -0800 (PST) X-Received: by 10.99.55.91 with SMTP id g27mr9122807pgn.65.1484289457290; Thu, 12 Jan 2017 22:37:37 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s21si11748749pfi.53.2017.01.12.22.37.33; Thu, 12 Jan 2017 22:37:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751208AbdAMGhR (ORCPT + 13 others); Fri, 13 Jan 2017 01:37:17 -0500 Received: from mail-pf0-f175.google.com ([209.85.192.175]:33997 "EHLO mail-pf0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751183AbdAMGhO (ORCPT ); Fri, 13 Jan 2017 01:37:14 -0500 Received: by mail-pf0-f175.google.com with SMTP id 127so26093367pfg.1 for ; Thu, 12 Jan 2017 22:37:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=9mli8LpTEht0iiRvIIcqIzsmF82tonuz9NSPVdNJ7EQ=; b=XQpkU5RCrvNlV8QyQuadRQvLD5zRzd1db5GlTPaMeNKMYDHb3H6lYwr/tlTOZhWShD leaFDQgELCIq9ICa6iIMGCYMdkYcvlcdqW/NhdZZ2hc7uxYPjX0OxkCmHiogosJ6yWPc K6Hf0sVNwGkTN2dMSoiSuSC24XwyDPtNhfpFs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=9mli8LpTEht0iiRvIIcqIzsmF82tonuz9NSPVdNJ7EQ=; b=a8HFpSTb7URtDKkdpDNZv1u9rhx4qHLdKN6o58HHAU8E76mSZB/c/gVSG1vYY5d6wv Fth0tWZnpC5kBoWVhs4rvm3zrBl7hscIsYODa3yQ2FHgiftUIHctlDeysSVUfFF0ruDV dC2OnIdQEqjpnCRsg7UHTmHVAO96n955lqwbh0ayNODuRfTdegDkVRiT+uyXoq1ZckMd zx3bEk5vrrZcw4KqD/apVGdoWEfbLIXE3pwgMYQgDQqauMLZ8H8C1mlpUrTlkHSw6i0t NTd0FRnjsHae/VpKww7LHrv58PojLRUTHWXchOINuEpafE8qg0cKHPQNesuhQke6e/4M jyiA== X-Gm-Message-State: AIkVDXJ/GO0Bx/2yN1MohLKlH0CpeH2CzLcgsMy0L/emTVJ0n9YHTs7Iu7/wmuDENGGVSzMm X-Received: by 10.98.63.210 with SMTP id z79mr21246342pfj.134.1484289429142; Thu, 12 Jan 2017 22:37:09 -0800 (PST) Received: from localhost ([122.172.128.56]) by smtp.gmail.com with ESMTPSA id t129sm26196953pgc.32.2017.01.12.22.37.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Jan 2017 22:37:08 -0800 (PST) From: Viresh Kumar To: Rafael Wysocki , Shuah Khan Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Vincent Guittot , linux-kselftest@vger.kernel.org, Viresh Kumar Subject: [PATCH 2/4] selftest: cpufreq: Add suspend/resume/hibernate support Date: Fri, 13 Jan 2017 12:06:46 +0530 Message-Id: <11499360abc3e627800e286050d9388395a2d1ff.1484289212.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.7.1.410.g6faf27b In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org This patch adds support to test basic suspend/resume and hibernation to the cpufreq selftests. Signed-off-by: Viresh Kumar --- tools/testing/selftests/cpufreq/cpufreq.sh | 40 ++++++++++++++++++++++++++++++ tools/testing/selftests/cpufreq/main.sh | 14 +++++++++-- 2 files changed, 52 insertions(+), 2 deletions(-) -- 2.7.1.410.g6faf27b -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/tools/testing/selftests/cpufreq/cpufreq.sh b/tools/testing/selftests/cpufreq/cpufreq.sh index 2b8b05aaa874..1ed3832030b4 100755 --- a/tools/testing/selftests/cpufreq/cpufreq.sh +++ b/tools/testing/selftests/cpufreq/cpufreq.sh @@ -199,3 +199,43 @@ cpufreq_basic_tests() # Test all governors shuffle_governors_for_all_cpus 1 } + +# Suspend/resume +# $1: "suspend" or "hibernate", $2: loop count +do_suspend() +{ + printf "** Test: Running ${FUNCNAME[0]}: Trying $1 for $2 loops **\n\n" + + # Is the directory available + if [ ! -d $SYSFS/power/ -o ! -f $SYSFS/power/state ]; then + printf "$SYSFS/power/state not available\n" + return 1 + fi + + if [ $1 = "suspend" ]; then + filename="mem" + elif [ $1 = "hibernate" ]; then + filename="disk" + else + printf "$1 is not a valid option\n" + return 1 + fi + + if [ -n $filename ]; then + present=$(cat $SYSFS/power/state | grep $filename) + + if [ -z "$present" ]; then + printf "Tried to $1 but $filename isn't present in $SYSFS/power/state\n" + return 1; + fi + + for i in `seq 1 $2`; do + printf "Starting $1\n" + echo $filename > $SYSFS/power/state + printf "Came out of $1\n" + + printf "Do basic tests after finishing $1 to verify cpufreq state\n\n" + cpufreq_basic_tests + done + fi +} diff --git a/tools/testing/selftests/cpufreq/main.sh b/tools/testing/selftests/cpufreq/main.sh index 3224652ccbd4..9ff662f67ea4 100755 --- a/tools/testing/selftests/cpufreq/main.sh +++ b/tools/testing/selftests/cpufreq/main.sh @@ -15,7 +15,9 @@ helpme() printf "Usage: $0 [-h] [-to args] [-h ] [-o ] - [-t ] + [-t ] \n" exit 2 } @@ -61,7 +63,7 @@ parse_arguments() helpme ;; - t) # --func_type (Function to perform: basic (default: basic)) + t) # --func_type (Function to perform: basic, suspend, hibernate (default: basic)) FUNC=$OPTARG ;; @@ -91,6 +93,14 @@ do_test() cpufreq_basic_tests ;; + "suspend") + do_suspend "suspend" 1 + ;; + + "hibernate") + do_suspend "hibernate" 1 + ;; + *) echo "Invalid [-f] function type" helpme