From patchwork Tue Jul 3 14:53:23 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: 9793 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 5A3C923E4F for ; Tue, 3 Jul 2012 14:53:41 +0000 (UTC) Received: from mail-yw0-f52.google.com (mail-yw0-f52.google.com [209.85.213.52]) by fiordland.canonical.com (Postfix) with ESMTP id 0704FA18492 for ; Tue, 3 Jul 2012 14:53:40 +0000 (UTC) Received: by yhpp61 with SMTP id p61so6681072yhp.11 for ; Tue, 03 Jul 2012 07:53:40 -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=baQwLhvHN7pGFTo/Wj8/0rSu8Mse7toE3fDuwOocP6M=; b=kBLjX3BQTVHTDuHB9psjtdodmQ7wbCOhO/FnEOUnvR4icXYxhn30yd6gP64NTcTJfi M05eA6aMOVvkjLw44Rulx2Bjqx5tcylyhM86OufH0FiQkUWYl3wBHmhaIFz1m4KeTUAG /iAEf7YDSZ1a3LRwhIMmYuCuv7vkG26gU0RzFLgZGka8NNk8XiJDI+DciqcSTwdjq3pw +tzdng7XcpAIp78kqsgt0jbQiOL21LIiuN+DlUpnTRS9sneqp/6SOM6rJGdRqwCk7WE2 /fHC9J3/uAf/7we5m3riwC5HZjTFhMSSZGXgHpnB0epyRKR25tYieNUsZFYDKRHujhy4 aKcg== Received: by 10.50.57.167 with SMTP id j7mr8425838igq.53.1341327220264; Tue, 03 Jul 2012 07:53:40 -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 v20csp41736ibb; Tue, 3 Jul 2012 07:53:39 -0700 (PDT) Received: by 10.66.73.133 with SMTP id l5mr29799721pav.74.1341327219071; Tue, 03 Jul 2012 07:53:39 -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 ot3si27704792pbc.11.2012.07.03.07.53.38 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 03 Jul 2012 07:53:39 -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 rr4so11119920pbb.37 for ; Tue, 03 Jul 2012 07:53:38 -0700 (PDT) Received: by 10.68.220.231 with SMTP id pz7mr7606610pbc.110.1341327217892; Tue, 03 Jul 2012 07:53:37 -0700 (PDT) Received: from localhost.localdomain ([115.184.127.188]) by mx.google.com with ESMTPS id pr10sm6299226pbb.23.2012.07.03.07.53.34 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 03 Jul 2012 07:53:37 -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:23:23 +0530 Message-Id: <1341327203-2853-1-git-send-email-rajagopal.venkat@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQmQQO98JLV2Z08HQPfie/3IL2mr+fz0LkZDIsqB6NqvtA8Wjvq3Gs0yEZTw4V1ZUieEGHbB 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...