From patchwork Tue Jul 3 15:25:39 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: 9795 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 219FA23E23 for ; Tue, 3 Jul 2012 15:25:57 +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 C90B9A18500 for ; Tue, 3 Jul 2012 15:25:56 +0000 (UTC) Received: by yenq6 with SMTP id q6so5848277yen.11 for ; Tue, 03 Jul 2012 08:25:56 -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=T/hkgwhALNQZPVpsU5JFfm4Q7Sv6Z9KsTrguq3r8S61bQQ4odm9n4Om/GTEol/989D nw7ZaWCm4ElqE3OcuaH88T7Ja3PV/bKi2p11CSVtbdF9WS7Bpu2S+BBT4ug+XSaZ6pYn 6UMm2wqANTsqS2dvkaMLRdV/wSveByHB+1SGbOZ3bC1+twEea1gs8I2S1FVk/rwr3U2r a5cVD9J/wbE6Vlt9ggGZhcw6FT9PQeoy+nE8FYiQ07G9xizV7CCsVBzZMqknR63eufY+ 10/kKx54MSW/Pp/7GxYGC2usKnMFLhlKWT4pNBgxrWoMHrcSD/ndLHdNpIcMe09bpsQv BQHQ== Received: by 10.50.57.167 with SMTP id j7mr8547355igq.53.1341329156150; Tue, 03 Jul 2012 08:25:56 -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 v20csp42364ibb; Tue, 3 Jul 2012 08:25:55 -0700 (PDT) Received: by 10.68.191.201 with SMTP id ha9mr8064653pbc.75.1341329155328; Tue, 03 Jul 2012 08:25:55 -0700 (PDT) Received: from mail-pb0-f50.google.com (mail-pb0-f50.google.com [209.85.160.50]) by mx.google.com with ESMTPS id rd4si3801414pbc.100.2012.07.03.08.25.55 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 03 Jul 2012 08:25:55 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of rajagopal.venkat@linaro.org) client-ip=209.85.160.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of rajagopal.venkat@linaro.org) smtp.mail=rajagopal.venkat@linaro.org Received: by pbbrr4 with SMTP id rr4so11164142pbb.37 for ; Tue, 03 Jul 2012 08:25:55 -0700 (PDT) Received: by 10.68.233.225 with SMTP id tz1mr7763167pbc.4.1341329154839; Tue, 03 Jul 2012 08:25:54 -0700 (PDT) Received: from localhost.localdomain ([115.184.127.188]) by mx.google.com with ESMTPS id pt2sm15749395pbb.58.2012.07.03.08.25.51 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 03 Jul 2012 08:25:54 -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:55:39 +0530 Message-Id: <1341329139-3420-1-git-send-email-rajagopal.venkat@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQlv+QjR5DT4k1E1kOCPQTUygSD34lyUSvWhlP75uB1wL122ulDBLCPgelhQDWJG5ZOL9SCG 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...