From patchwork Mon Jul 2 15:43:56 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: rajagopal.venkat@linaro.org X-Patchwork-Id: 9747 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 7634A23E47 for ; Mon, 2 Jul 2012 15:44:30 +0000 (UTC) Received: from mail-yw0-f50.google.com (mail-yw0-f50.google.com [209.85.213.50]) by fiordland.canonical.com (Postfix) with ESMTP id 26799A18272 for ; Mon, 2 Jul 2012 15:44:30 +0000 (UTC) Received: by yhjj63 with SMTP id j63so5182460yhj.37 for ; Mon, 02 Jul 2012 08:44:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:x-gm-message-state; bh=sf5hrizuvOiBP/Q9Xt7FyyoLKP9dSWr0nq3DQnf/Hs4=; b=TQ7wpQTicXL3f/E8hKMwM24eNaQEyELPkgZ5Qh2H558iDTUX9DnS0SVe+Vn1pzPlCI xnGMFufuyGOkleSYkdD/UPOOuk7xEwbXc1S7MtRFKJCGrqrIP8HDNz6SRXavI6L6ascj joYEJLNghJE+PzU0f4f+69koibva1Sf9IYHwrM5GTqyDq08pvuWOae1TxWpW6fE2/zaP 6udXG02DCe240cAoQWL5dk2DxZjseGexjZbtofQNeUhS1sap/P+6aoBcgjjZW0Urxa2N ndLc8kRqulfK8NDOdiLCXBhzFMIjWW4rwQv8+dC6k8zE1k10f7vGjGIQImzXqjIPi62v vD3Q== Received: by 10.50.193.196 with SMTP id hq4mr5714579igc.57.1341243869470; Mon, 02 Jul 2012 08:44:29 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.24.148 with SMTP id v20csp25236ibb; Mon, 2 Jul 2012 08:44:28 -0700 (PDT) Received: by 10.236.74.74 with SMTP id w50mr15795887yhd.34.1341243868075; Mon, 02 Jul 2012 08:44:28 -0700 (PDT) Received: from mail-yw0-f44.google.com (mail-yw0-f44.google.com [209.85.213.44]) by mx.google.com with ESMTPS id b26si9980561yhe.85.2012.07.02.08.44.27 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 02 Jul 2012 08:44:28 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.213.44 is neither permitted nor denied by best guess record for domain of rajagopal.venkat@linaro.org) client-ip=209.85.213.44; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.213.44 is neither permitted nor denied by best guess record for domain of rajagopal.venkat@linaro.org) smtp.mail=rajagopal.venkat@linaro.org Received: by yhq56 with SMTP id 56so5986126yhq.17 for ; Mon, 02 Jul 2012 08:44:27 -0700 (PDT) Received: by 10.68.194.234 with SMTP id hz10mr31023505pbc.126.1341243867147; Mon, 02 Jul 2012 08:44:27 -0700 (PDT) Received: from localhost.localdomain ([115.241.57.189]) by mx.google.com with ESMTPS id rd7sm13235511pbc.70.2012.07.02.08.44.23 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 02 Jul 2012 08:44:26 -0700 (PDT) From: Rajagopal Venkat To: linaro-dev@lists.linaro.org Cc: patches@linaro.org, Rajagopal Venkat Subject: [PATCH] pm-qa: add powertop test cases Date: Mon, 2 Jul 2012 21:13:56 +0530 Message-Id: <1341243836-3127-1-git-send-email-rajagopal.venkat@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQlBE1ppC4pRW6ZI1mcQEaiRCeVfcGJz0QJhjZ+z0VBwHF2UfSwfzFymAQl4kYrLCZTHemRN add powertop test cases into pm-qa. Run the powertop sanity test to check if tool is available. If yes, then run powertop in report generation mode and validate the output. Signed-off-by: Rajagopal Venkat --- Makefile | 1 + powertop/Makefile | 25 ++++++++++++++++++ powertop/powertop_01.sh | 58 ++++++++++++++++++++++++++++++++++++++++++ powertop/powertop_01.txt | 1 + powertop/powertop_sanity.sh | 35 +++++++++++++++++++++++++ powertop/powertop_sanity.txt | 1 + 6 files changed, 121 insertions(+) create mode 100644 powertop/Makefile create mode 100755 powertop/powertop_01.sh create mode 100644 powertop/powertop_01.txt create mode 100755 powertop/powertop_sanity.sh create mode 100644 powertop/powertop_sanity.txt diff --git a/Makefile b/Makefile index f85e5ac..1e73608 100644 --- a/Makefile +++ b/Makefile @@ -33,6 +33,7 @@ check: @(cd sched_mc; $(MAKE) check) # @(cd suspend; $(MAKE) check) # @(cd thermal; $(MAKE) check) +# @(cd powertop; $(MAKE) check) uncheck: @(cd cpufreq; $(MAKE) uncheck) diff --git a/powertop/Makefile b/powertop/Makefile new file mode 100644 index 0000000..412edb5 --- /dev/null +++ b/powertop/Makefile @@ -0,0 +1,25 @@ +# +# PM-QA validation test suite for the power management on Linux +# +# Copyright (C) 2011, Linaro Limited. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# Contributors: +# Rajagopal Venkat +# - initial API and implementation +# + +include ../Test.mk diff --git a/powertop/powertop_01.sh b/powertop/powertop_01.sh new file mode 100755 index 0000000..3427899 --- /dev/null +++ b/powertop/powertop_01.sh @@ -0,0 +1,58 @@ +#!/bin/bash +# +# PM-QA validation test suite for the power management on Linux +# +# Copyright (C) 2011, Linaro Limited. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# Contributors: +# Rajagopal Venkat +# - initial API and implementation +# + +# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Doc/QA/Scripts#powertop_01 + +source ../include/functions.sh + +run_powertop() { + + local bin_name=powertop + local report=csv + local seconds=10 + local iterations=2 + local report_name=PowerTOP*.csv + + # remove old reports if exists + rm -f $report_name + + # run powertop for $(iterations) in report generation mode + start_time=`date +%s` + sudo $bin_name --$report --time=$seconds --iteration=$iterations + end_time=`date +%s` + + # check if powertop run for desired time + let expected_time="$iterations * $seconds" + let actual_time="$end_time - $start_time" + + check "if powertop run for $expected_time sec" "test $actual_time -ge $expected_time" + + # check if $(iterations) number of reports are generated + check "if reports are generated" "test $(ls $report_name | wc -l) -eq $iterations" + + return 0 +} + +run_powertop diff --git a/powertop/powertop_01.txt b/powertop/powertop_01.txt new file mode 100644 index 0000000..0caa6f0 --- /dev/null +++ b/powertop/powertop_01.txt @@ -0,0 +1 @@ +run powertop for 2 iterations of 10sec each diff --git a/powertop/powertop_sanity.sh b/powertop/powertop_sanity.sh new file mode 100755 index 0000000..3ae3065 --- /dev/null +++ b/powertop/powertop_sanity.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# +# PM-QA validation test suite for the power management on Linux +# +# Copyright (C) 2011, Linaro Limited. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# Contributors: +# Rajagopal Venkat +# - initial API and implementation +# + +source ../include/functions.sh + +check_powertop() { + + local bin_name=powertop + + command -v $bin_name >/dev/null 2>&1 && return 1 || return 0 +} + +check_powertop diff --git a/powertop/powertop_sanity.txt b/powertop/powertop_sanity.txt new file mode 100644 index 0000000..1a182ae --- /dev/null +++ b/powertop/powertop_sanity.txt @@ -0,0 +1 @@ +powertop is not available. Skipping all tests...