From patchwork Mon Jan 26 10:41:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 5708341 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7BEC29F2ED for ; Mon, 26 Jan 2015 10:42:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8ECE320125 for ; Mon, 26 Jan 2015 10:42:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 24A1620123 for ; Mon, 26 Jan 2015 10:42:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754333AbbAZKmM (ORCPT ); Mon, 26 Jan 2015 05:42:12 -0500 Received: from mailout4.samsung.com ([203.254.224.34]:58041 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752595AbbAZKmL (ORCPT ); Mon, 26 Jan 2015 05:42:11 -0500 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NIS00KLB5QAEF30@mailout4.samsung.com> for linux-pm@vger.kernel.org; Mon, 26 Jan 2015 19:42:10 +0900 (KST) X-AuditID: cbfee61b-f79d76d0000024d6-c3-54c61a025207 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 9B.F1.09430.20A16C45; Mon, 26 Jan 2015 19:42:10 +0900 (KST) Received: from mcdsrvbld02.digital.local ([106.116.37.23]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NIS00ILA5P29690@mmp1.samsung.com>; Mon, 26 Jan 2015 19:42:10 +0900 (KST) From: Lukasz Majewski To: Viresh Kumar Cc: Eduardo Valentin , Linux PM list , Lukasz Majewski , Abhilash Kesavan , Abhilash Kesavan , Chanwoo Choi , Thomas Abraham , Kevin Hilman , Kevin Hilman , a.nitecki@samsung.com, Lukasz Majewski Subject: [PATCH 2/3] cpufreq: tests: Provide test to check if all supported governors are working Date: Mon, 26 Jan 2015 11:41:23 +0100 Message-id: <1422268884-26173-2-git-send-email-l.majewski@samsung.com> X-Mailer: git-send-email 1.7.10.4 In-reply-to: <1422268884-26173-1-git-send-email-l.majewski@samsung.com> References: <1422268884-26173-1-git-send-email-l.majewski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrLLMWRmVeSWpSXmKPExsVy+t9jAV0mqWMhBtvncVs8XrOYyeL0hG2s Fte/PGe1mH/lGqvFmr9KFk83P2ay+Hp4BaPFm0fcFm8ebma0+Nx7hNGiYxmjxcavHg48Hjtn 3WX32LSqk83jzrU9bB7rpr1l9ujbsorR4/MmuQC2KC6blNSczLLUIn27BK6MDUd/sRYslKiY f6+LpYHxnXAXIyeHhICJxMW9a5kgbDGJC/fWs3UxcnEICSxilLi4bzU7hNPFJNF5ECTDycEm oCfx+e5ToA4ODhEBLYmXN1NBapgFdjBLNGw6xgISFxZIlujdzQhSziKgKjH97F4WEJtXwE1i TddRZohlihLdzyaAjeQUcJdYtmo+K4gtBFTT9Pw28wRG3gWMDKsYRVMLkguKk9JzjfSKE3OL S/PS9ZLzczcxggPxmfQOxlUNFocYBTgYlXh4NRqPhgixJpYVV+YeYpTgYFYS4RXlOxYixJuS WFmVWpQfX1Sak1p8iFGag0VJnFfJvi1ESCA9sSQ1OzW1ILUIJsvEwSnVwJi880jin99TnASe x5XOPhk/ZdutnsTlK9M/pU75mijrxXp5BSe3KvNlKYUtz/4IHrq/w+ElS2CQzjTJGM8D+cc0 evYlBV0RcF147KySkHe31/njZ9YziIjPdi1rVlgwv+LX8cygm/umdJe7+wmandi/weTZp6Ur D6ecSS1ofjntblhYQ0tJ0jElluKMREMt5qLiRABj4PDwQAIAAA== Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This test checks if all compiled in cpufreq governors can be enabled. Signed-off-by: Lukasz Majewski --- tools/testing/cpufreq/governors_switch.sh | 92 +++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100755 tools/testing/cpufreq/governors_switch.sh diff --git a/tools/testing/cpufreq/governors_switch.sh b/tools/testing/cpufreq/governors_switch.sh new file mode 100755 index 0000000..16bd88c --- /dev/null +++ b/tools/testing/cpufreq/governors_switch.sh @@ -0,0 +1,92 @@ +#!/bin/bash +# +# This file provides a simple mean to test if all declared governors +# at "scaling_available_governors" can be set and if "scaling_governor" +# returns this value. +# +# Usage: ./governors_switch +# Requisite: None +# +# 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, you can access it online at +# http://www.gnu.org/licenses/gpl-2.0.html. +# +# Copyright (C) Samsung Electronics, 2015 +# +# Author: Lukasz Majewski + +set +x +T_PATCH=/sys/devices/system/cpu/cpu0/cpufreq + +ERRORS=0 + +function restore_gov { + echo "SET GOVERNOR: $OLD_GOV" + echo $OLD_GOV > $T_PATCH/scaling_governor +} + +function die { + printf " \33[31m FAILED \33[0m \n" + restore_gov + exit $1 +} + + +echo "######################################" +printf "\33[35mGovernors permutation test\33[0m\n" +echo "######################################" +OLD_GOV=`cat $T_PATCH/scaling_governor` +echo "CURRENT GOVERNOR: $OLD_GOV" + +GOVS=`cat $T_PATCH/scaling_available_governors` +echo "Available governors: $GOVS" + +GOVS_ARRAY=($GOVS) +GOVS_ARRAY_ELEM=${#GOVS_ARRAY[@]} +echo "Number of elements: $GOVS_ARRAY_ELEM" + +if [ $GOVS_ARRAY_ELEM -le 1 ]; +then + echo "Only one governor present - NO testing" + exit 0 +fi + +TMP=$GOVS_ARRAY + +for gov in ${GOVS_ARRAY[@]} +do + printf "\33[35mGOV:\t $gov\n\33[0m" + + for f in ${GOVS_ARRAY[@]} + do + echo $gov > $T_PATCH/scaling_governor || die $? + printf "\t $f " + echo $f > $T_PATCH/scaling_governor || die $? + + CURRENT_GOV=`cat $T_PATCH/scaling_governor` + if [ $CURRENT_GOV == $f ]; then + printf "\t\33[32m OK \33[0m \n" + else + printf "\t\33[31m CURRENT GOV: $CURRENT_GOV \33[0m \n" + ERRORS=$(( $ERRORS + 1 )) + fi + done +done + +echo "######################################" +echo "ERRORS: $ERRORS" +echo "######################################" + +restore_gov + +exit 0;