From patchwork Tue Jul 3 15:23:28 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: 9794 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 D955523E23 for ; Tue, 3 Jul 2012 15:23:52 +0000 (UTC) Received: from mail-yx0-f180.google.com (mail-yx0-f180.google.com [209.85.213.180]) by fiordland.canonical.com (Postfix) with ESMTP id 8A150A18500 for ; Tue, 3 Jul 2012 15:23:52 +0000 (UTC) Received: by yenq6 with SMTP id q6so5845273yen.11 for ; Tue, 03 Jul 2012 08:23:52 -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=xz9WEwpYQL5NBNOSZ5PC7YQsfxynU27qn1fd5vWsrBI=; b=SJTW1y/mCAUz8C/hXb1WCB1t4cBSUPnkdizUxS91CoD7+R9CmFhGWCXQEUqRmZ77bD bjWoBa/OtD3IO0CsysHvsN8bXmTljYLe0sXk1QTv9frzGoUXQv6Yno6owepCEsrxovKa v32sUZIjCCcGKrLkKOouNGuZZgiVWqf6bZOwAYQgA2CHi4OErRV3xE4F7OBRoucm2uhH 90UworGc3Bv+yytLrkzlrawKob1S0wNVz0SwRkbxFr5wL25bgEYBb2r0QTdXyJIQRGGW GprxgQcFRV6vo82GQz9oQea3RVCb777XNVOOPb/0BOX7IC/nZxSBOoME2aFIytkIFdKq ih+g== Received: by 10.50.87.227 with SMTP id bb3mr8616891igb.57.1341329030180; Tue, 03 Jul 2012 08:23:50 -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 v20csp42327ibb; Tue, 3 Jul 2012 08:23:49 -0700 (PDT) Received: by 10.236.179.42 with SMTP id g30mr20876883yhm.77.1341329028883; Tue, 03 Jul 2012 08:23:48 -0700 (PDT) Received: from mail-gg0-f178.google.com (mail-gg0-f178.google.com [209.85.161.178]) by mx.google.com with ESMTPS id z25si4255920yhl.45.2012.07.03.08.23.48 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 03 Jul 2012 08:23:48 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.161.178 is neither permitted nor denied by best guess record for domain of rajagopal.venkat@linaro.org) client-ip=209.85.161.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.161.178 is neither permitted nor denied by best guess record for domain of rajagopal.venkat@linaro.org) smtp.mail=rajagopal.venkat@linaro.org Received: by ggcq6 with SMTP id q6so6377884ggc.37 for ; Tue, 03 Jul 2012 08:23:48 -0700 (PDT) Received: by 10.68.227.198 with SMTP id sc6mr7889147pbc.138.1341329028108; Tue, 03 Jul 2012 08:23:48 -0700 (PDT) Received: from localhost.localdomain ([115.184.127.188]) by mx.google.com with ESMTPS id ip5sm15769881pbc.3.2012.07.03.08.23.43 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 03 Jul 2012 08:23:47 -0700 (PDT) From: Rajagopal Venkat To: linaro-dev@lists.linaro.org Cc: patches@linaro.org, Rajagopal Venkat Subject: [PATCH v2] pm-qa: add powertop test cases Date: Tue, 3 Jul 2012 20:53:28 +0530 Message-Id: <1341329008-3341-1-git-send-email-rajagopal.venkat@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQnC+jJ4vjMP/uiBDk+P6ir3hSjmWCiNtdmoZFazhCnmsy5JXSwsF6AKUacCxA8yhEMB5wd1 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..cf243f1 --- /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_path=`command -v 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_path --$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 -1 $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...