From patchwork Tue Aug 9 21:45:49 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 3331 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 42FBC2406C for ; Tue, 9 Aug 2011 21:46:07 +0000 (UTC) Received: from mail-qy0-f180.google.com (mail-qy0-f180.google.com [209.85.216.180]) by fiordland.canonical.com (Postfix) with ESMTP id B70BAA184C5 for ; Tue, 9 Aug 2011 21:46:06 +0000 (UTC) Received: by qyk31 with SMTP id 31so315801qyk.11 for ; Tue, 09 Aug 2011 14:46:06 -0700 (PDT) Received: by 10.229.68.97 with SMTP id u33mr5809427qci.159.1312926366084; Tue, 09 Aug 2011 14:46:06 -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.229.190.71 with SMTP id dh7cs60339qcb; Tue, 9 Aug 2011 14:46:05 -0700 (PDT) Received: from mr.google.com ([10.216.60.17]) by 10.216.60.17 with SMTP id t17mr6338405wec.24.1312926365506 (num_hops = 1); Tue, 09 Aug 2011 14:46:05 -0700 (PDT) Received: by 10.216.60.17 with SMTP id t17mr4479942wec.24.1312926364739; Tue, 09 Aug 2011 14:46:04 -0700 (PDT) Received: from mtagate7.uk.ibm.com (mtagate7.uk.ibm.com [194.196.100.167]) by mx.google.com with ESMTPS id v54si822353wec.5.2011.08.09.14.46.04 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 09 Aug 2011 14:46:04 -0700 (PDT) Received-SPF: neutral (google.com: 194.196.100.167 is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) client-ip=194.196.100.167; Authentication-Results: mx.google.com; spf=neutral (google.com: 194.196.100.167 is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) smtp.mail=daniel.lezcano@linaro.org Received: from d06nrmr1307.portsmouth.uk.ibm.com (d06nrmr1307.portsmouth.uk.ibm.com [9.149.38.129]) by mtagate7.uk.ibm.com (8.13.1/8.13.1) with ESMTP id p79Lk3Yv023596; Tue, 9 Aug 2011 21:46:03 GMT Received: from d06av06.portsmouth.uk.ibm.com (d06av06.portsmouth.uk.ibm.com [9.149.37.217]) by d06nrmr1307.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p79Lk34x2072772; Tue, 9 Aug 2011 22:46:03 +0100 Received: from d06av06.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av06.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p79Lk3T7027904; Tue, 9 Aug 2011 15:46:03 -0600 Received: from smtp.lab.toulouse-stg.fr.ibm.com (srv01.lab.toulouse-stg.fr.ibm.com [9.101.4.1]) by d06av06.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p79Lk3LY027901; Tue, 9 Aug 2011 15:46:03 -0600 Received: from localhost.localdomain (itv04751.uk.ibm.com [9.145.29.66]) by smtp.lab.toulouse-stg.fr.ibm.com (Postfix) with ESMTP id A0910210FB8; Tue, 9 Aug 2011 23:45:59 +0200 (CEST) From: Daniel Lezcano To: linaro-dev@lists.linaro.org Cc: paul.larson@linaro.org, amit.kucheria@linaro.org Subject: [PATCH 2/2] change the script name with the block name they refer to Date: Tue, 9 Aug 2011 23:45:49 +0200 Message-Id: <1312926349-25633-2-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1312926349-25633-1-git-send-email-daniel.lezcano@linaro.org> References: <1312926349-25633-1-git-send-email-daniel.lezcano@linaro.org> Signed-off-by: Daniel Lezcano --- cpufreq/cpufreq_01.sh | 32 +++++++++++++ cpufreq/cpufreq_02.sh | 32 +++++++++++++ cpufreq/cpufreq_03.sh | 51 +++++++++++++++++++++ cpufreq/cpufreq_04.sh | 54 ++++++++++++++++++++++ cpufreq/cpufreq_05.sh | 73 ++++++++++++++++++++++++++++++ cpufreq/cpufreq_06.sh | 117 +++++++++++++++++++++++++++++++++++++++++++++++++ cpufreq/cpufreq_07.sh | 91 ++++++++++++++++++++++++++++++++++++++ cpufreq/cpufreq_08.sh | 78 ++++++++++++++++++++++++++++++++ cpufreq/cpufreq_09.sh | 74 +++++++++++++++++++++++++++++++ cpufreq/test_01.sh | 32 ------------- cpufreq/test_02.sh | 32 ------------- cpufreq/test_03.sh | 51 --------------------- cpufreq/test_04.sh | 54 ---------------------- cpufreq/test_05.sh | 73 ------------------------------ cpufreq/test_06.sh | 117 ------------------------------------------------- cpufreq/test_07.sh | 91 -------------------------------------- cpufreq/test_08.sh | 78 -------------------------------- cpufreq/test_09.sh | 74 ------------------------------- sched_mc/sched_01.sh | 32 +++++++++++++ sched_mc/sched_02.sh | 38 ++++++++++++++++ sched_mc/sched_03.sh | 33 ++++++++++++++ sched_mc/sched_04.sh | 70 +++++++++++++++++++++++++++++ sched_mc/test_01.sh | 32 ------------- sched_mc/test_02.sh | 38 ---------------- sched_mc/test_03.sh | 33 -------------- sched_mc/test_04.sh | 70 ----------------------------- 26 files changed, 775 insertions(+), 775 deletions(-) create mode 100644 cpufreq/cpufreq_01.sh create mode 100644 cpufreq/cpufreq_02.sh create mode 100644 cpufreq/cpufreq_03.sh create mode 100644 cpufreq/cpufreq_04.sh create mode 100644 cpufreq/cpufreq_05.sh create mode 100644 cpufreq/cpufreq_06.sh create mode 100644 cpufreq/cpufreq_07.sh create mode 100644 cpufreq/cpufreq_08.sh create mode 100644 cpufreq/cpufreq_09.sh delete mode 100755 cpufreq/test_01.sh delete mode 100755 cpufreq/test_02.sh delete mode 100755 cpufreq/test_03.sh delete mode 100755 cpufreq/test_04.sh delete mode 100755 cpufreq/test_05.sh delete mode 100755 cpufreq/test_06.sh delete mode 100755 cpufreq/test_07.sh delete mode 100755 cpufreq/test_08.sh delete mode 100755 cpufreq/test_09.sh create mode 100644 sched_mc/sched_01.sh create mode 100644 sched_mc/sched_02.sh create mode 100644 sched_mc/sched_03.sh create mode 100644 sched_mc/sched_04.sh delete mode 100755 sched_mc/test_01.sh delete mode 100755 sched_mc/test_02.sh delete mode 100755 sched_mc/test_03.sh delete mode 100755 sched_mc/test_04.sh diff --git a/cpufreq/cpufreq_01.sh b/cpufreq/cpufreq_01.sh new file mode 100644 index 0000000..8cfbce9 --- /dev/null +++ b/cpufreq/cpufreq_01.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# +# PM-QA validation test suite for the power management on ARM +# +# 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: +# Daniel Lezcano (IBM Corporation) +# - initial API and implementation +# + +# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Doc/QA/Scripts#cpufreq_01 + +source ../include/functions.sh + +FILES="scaling_available_frequencies scaling_cur_freq scaling_setspeed" + +for_each_cpu check_cpufreq_files $FILES diff --git a/cpufreq/cpufreq_02.sh b/cpufreq/cpufreq_02.sh new file mode 100644 index 0000000..212b2eb --- /dev/null +++ b/cpufreq/cpufreq_02.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# +# PM-QA validation test suite for the power management on ARM +# +# 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: +# Daniel Lezcano (IBM Corporation) +# - initial API and implementation +# + +# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Doc/QA/Scripts#cpufreq_02 + +source ../include/functions.sh + +FILES="scaling_available_governors scaling_governor" + +for_each_cpu check_cpufreq_files $FILES diff --git a/cpufreq/cpufreq_03.sh b/cpufreq/cpufreq_03.sh new file mode 100644 index 0000000..256a5c2 --- /dev/null +++ b/cpufreq/cpufreq_03.sh @@ -0,0 +1,51 @@ +#!/bin/bash +# +# PM-QA validation test suite for the power management on ARM +# +# 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: +# Daniel Lezcano (IBM Corporation) +# - initial API and implementation +# + +# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Doc/QA/Scripts#cpufreq_03 + +source ../include/functions.sh + +check_governor() { + + local cpu=$1 + local newgov=$2 + + shift 2 + + local oldgov=$(get_governor $cpu) + + set_governor $cpu $newgov + + check "governor change to '$newgov'" "test \"$(get_governor $cpu)\" == \"$newgov\"" + + set_governor $cpu $oldgov +} + +if [ $(id -u) != 0 ]; then + log_skip "run as non-root" + exit 0 +fi + +for_each_cpu for_each_governor check_governor || exit 1 diff --git a/cpufreq/cpufreq_04.sh b/cpufreq/cpufreq_04.sh new file mode 100644 index 0000000..6fa81fa --- /dev/null +++ b/cpufreq/cpufreq_04.sh @@ -0,0 +1,54 @@ +#!/bin/bash +# +# PM-QA validation test suite for the power management on ARM +# +# 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: +# Daniel Lezcano (IBM Corporation) +# - initial API and implementation +# + +# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Doc/QA/Scripts#cpufreq_04 + +source ../include/functions.sh + +check_frequency() { + + local cpu=$1 + local newfreq=$2 + + shift 2 + + local oldgov=$(get_governor $cpu) + local oldfreq=$(get_frequency $cpu) + + set_governor $cpu userspace + set_frequency $cpu $newfreq + + check "setting frequency '$(frequnit $newfreq)'" "test \"$(get_frequency $cpu)\" == \"$newfreq\"" + + set_frequency $cpu $oldfreq + set_governor $cpu $oldgov +} + +if [ $(id -u) != 0 ]; then + log_skip "run as non-root" + exit 0 +fi + +for_each_cpu for_each_frequency check_frequency || exit 1 diff --git a/cpufreq/cpufreq_05.sh b/cpufreq/cpufreq_05.sh new file mode 100644 index 0000000..6ba938c --- /dev/null +++ b/cpufreq/cpufreq_05.sh @@ -0,0 +1,73 @@ +#!/bin/bash +# +# PM-QA validation test suite for the power management on ARM +# +# 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: +# Daniel Lezcano (IBM Corporation) +# - initial API and implementation +# + +# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Doc/QA/Scripts#cpufreq_05 + +source ../include/functions.sh + +if [ $(id -u) != 0 ]; then + log_skip "run as non-root" + exit 0 +fi + +save_governors + +trap restore_governors SIGHUP SIGINT SIGTERM + +switch_ondemand() { + local cpu=$1 + set_governor $cpu 'ondemand' +} + +switch_conservative() { + local cpu=$1 + set_governor $cpu 'conservative' +} + +switch_userspace() { + local cpu=$1 + set_governor $cpu 'userspace' +} + +for_each_cpu switch_ondemand +check "'ondemand' directory exists" "test -d $CPU_PATH/cpufreq/ondemand" + +for_each_cpu switch_conservative +check "'conservative' directory exists" "test -d $CPU_PATH/cpufreq/conservative" + +for_each_cpu switch_userspace +check "'ondemand' directory is not there" "test ! -d $CPU_PATH/cpufreq/ondemand" +check "'conservative' directory is not there" "test ! -d $CPU_PATH/cpufreq/conservative" + +# if more than one cpu, combine governors +nrcpus=$(ls $CPU_PATH | grep "cpu[0-9].*" | wc -l) +if [ $nrcpus > 0 ]; then + switch_ondemand cpu0 + switch_conservative cpu1 + check "'ondemand' directory exists" "test -d $CPU_PATH/cpufreq/ondemand" + check "'conservative' directory exists" "test -d $CPU_PATH/cpufreq/conservative" +fi + +restore_governors diff --git a/cpufreq/cpufreq_06.sh b/cpufreq/cpufreq_06.sh new file mode 100644 index 0000000..cb75e7f --- /dev/null +++ b/cpufreq/cpufreq_06.sh @@ -0,0 +1,117 @@ +#!/bin/bash +# +# PM-QA validation test suite for the power management on ARM +# +# 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: +# Daniel Lezcano (IBM Corporation) +# - initial API and implementation +# + +# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Doc/QA/Scripts#cpufreq_06 + +source ../include/functions.sh + +CPUCYCLE=../utils/cpucycle + +compute_freq_ratio() { + + local cpu=$1 + local freq=$2 + + set_frequency $cpu $freq + + result=$($CPUCYCLE $cpu) + if [ $? != 0 ]; then + return 1 + fi + + results[$index]=$(echo "scale=3;($result / $freq)" | bc -l) + index=$((index + 1)) +} + +compute_freq_ratio_sum() { + + res=${results[$index]} + sum=$(echo "($sum + $res)" | bc -l) + index=$((index + 1)) + +} + +__check_freq_deviation() { + + res=${results[$index]} + + # compute deviation + dev=$(echo "scale=3;((( $res - $avg ) / $avg) * 100 )" | bc -l) + + # change to absolute + dev=$(echo $dev | awk '{ print ($1 >= 0) ? $1 : 0 - $1}') + + index=$((index + 1)) + + res=$(echo "($dev > 5.0)" | bc -l) + if [ "$res" = "1" ]; then + return 1 + fi + + return 0 +} + +check_freq_deviation() { + + local cpu=$1 + local freq=$2 + + check "deviation for frequency $(frequnit $freq)" __check_freq_deviation + +} + +check_deviation() { + + local cpu=$1 + + set_governor $cpu userspace + + for_each_frequency $cpu compute_freq_ratio + + index=0 + sum=0 + + for_each_frequency $cpu compute_freq_ratio_sum + + avg=$(echo "scale=3;($sum / $index)" | bc -l) + + index=0 + for_each_frequency $cpu check_freq_deviation +} + +if [ $(id -u) != 0 ]; then + log_skip "run as non-root" + exit 0 +fi + +save_governors +save_frequencies + +trap "restore_frequencies; restore_governors; sigtrap" SIGHUP SIGINT SIGTERM + +for_each_cpu check_deviation + +restore_frequencies +restore_governors diff --git a/cpufreq/cpufreq_07.sh b/cpufreq/cpufreq_07.sh new file mode 100644 index 0000000..2fb4b53 --- /dev/null +++ b/cpufreq/cpufreq_07.sh @@ -0,0 +1,91 @@ +#!/bin/bash +# +# PM-QA validation test suite for the power management on ARM +# +# 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: +# Daniel Lezcano (IBM Corporation) +# - initial API and implementation +# + +# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Doc/QA/Scripts#cpufreq_07 + +source ../include/functions.sh + +CPUBURN=../utils/cpuburn + +check_ondemand() { + + local cpu=$1 + local maxfreq=$(get_max_frequency $cpu) + local minfreq=$(get_min_frequency $cpu) + local curfreq=$(get_frequency $cpu) + local pid= + + set_governor $cpu ondemand + + # wait for a quescient point + for i in $(seq 1 10); do + + if [ "$minfreq" == "$(get_frequency $cpu)" ]; then + + $CPUBURN $cpu & + pid=$! + + sleep 1 + wait_latency $cpu + curfreq=$(get_frequency $cpu) + kill $pid + + check "'ondemand' increase frequency on load" "test \"$curfreq\" == \"$maxfreq\"" + if [ "$?" != "0" ]; then + return 1 + fi + + sleep 1 + curfreq=$(get_frequency $cpu) + + check "'ondemand' decrease frequency on idle" "test \"$curfreq\" == \"$minfreq\"" + if [ "$?" != "0" ]; then + return 1 + fi + + return 0 + fi + + sleep 1 + + done + + log_skip "can not reach a quescient point for 'ondemand'" + + return 1 +} + +if [ $(id -u) != 0 ]; then + log_skip "run as non-root" + exit 0 +fi + +save_governors + +trap "restore_governors; sigtrap" SIGHUP SIGINT SIGTERM + +for_each_cpu check_ondemand + +restore_governors diff --git a/cpufreq/cpufreq_08.sh b/cpufreq/cpufreq_08.sh new file mode 100644 index 0000000..3f47613 --- /dev/null +++ b/cpufreq/cpufreq_08.sh @@ -0,0 +1,78 @@ +#!/bin/bash +# +# PM-QA validation test suite for the power management on ARM +# +# 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: +# Daniel Lezcano (IBM Corporation) +# - initial API and implementation +# + +# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Doc/QA/Scripts#cpufreq_08 + +source ../include/functions.sh + +CPUBURN=../utils/cpuburn + +check_frequency() { + local cpu=$1 + local freq=$2 + local curfreq= + local pid= + + $CPUBURN $cpu & + pid=$! + + set_frequency $cpu $freq + + wait_latency $cpu + curfreq=$(get_frequency $cpu) + kill $pid + + check "'userspace' $(frequnit $freq) is fixed" "test \"$curfreq\" == \"$freq\"" + if [ "$?" != "0" ]; then + return 1 + fi + + return 0 +} + +check_userspace() { + + local cpu=$1 + local maxfreq=$(get_max_frequency $cpu) + local minfreq=$(get_min_frequency $cpu) + local curfreq=$(get_frequency $cpu) + + set_governor $cpu userspace + + for_each_frequency $cpu check_frequency $minfreq +} + +save_governors + +if [ $(id -u) != 0 ]; then + log_skip "run as non-root" + exit 0 +fi + +trap "restore_governors; sigtrap" SIGHUP SIGINT SIGTERM + +for_each_cpu check_userspace + +restore_governors diff --git a/cpufreq/cpufreq_09.sh b/cpufreq/cpufreq_09.sh new file mode 100644 index 0000000..7fa8317 --- /dev/null +++ b/cpufreq/cpufreq_09.sh @@ -0,0 +1,74 @@ +#!/bin/bash +# +# PM-QA validation test suite for the power management on ARM +# +# 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: +# Daniel Lezcano (IBM Corporation) +# - initial API and implementation +# + +# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Doc/QA/Scripts#cpufreq_09 + +source ../include/functions.sh + +CPUBURN=../utils/cpuburn + +check_powersave() { + + local cpu=$1 + local minfreq=$(get_min_frequency $cpu) + local curfreq=$(get_frequency $cpu) + + set_governor $cpu powersave + + wait_latency $cpu + curfreq=$(get_frequency $cpu) + + check "'powersave' sets frequency to $(frequnit $minfreq)" "test \"$curfreq\" == \"$minfreq\"" + if [ "$?" != "0" ]; then + return 1 + fi + + $CPUBURN $cpu & + pid=$! + + wait_latency $cpu + curfreq=$(get_frequency $cpu) + kill $pid + + check "'powersave' frequency $(frequnit $minfreq) is fixed" "test \"$curfreq\" == \"$minfreq\"" + if [ "$?" != "0" ]; then + return 1 + fi + + return 0 +} + +save_governors + +if [ $(id -u) != 0 ]; then + log_skip "run as non-root" + exit 0 +fi + +trap "restore_governors; sigtrap" SIGHUP SIGINT SIGTERM + +for_each_cpu check_powersave + +restore_governors diff --git a/cpufreq/test_01.sh b/cpufreq/test_01.sh deleted file mode 100755 index 8cfbce9..0000000 --- a/cpufreq/test_01.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# -# PM-QA validation test suite for the power management on ARM -# -# 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: -# Daniel Lezcano (IBM Corporation) -# - initial API and implementation -# - -# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Doc/QA/Scripts#cpufreq_01 - -source ../include/functions.sh - -FILES="scaling_available_frequencies scaling_cur_freq scaling_setspeed" - -for_each_cpu check_cpufreq_files $FILES diff --git a/cpufreq/test_02.sh b/cpufreq/test_02.sh deleted file mode 100755 index 212b2eb..0000000 --- a/cpufreq/test_02.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# -# PM-QA validation test suite for the power management on ARM -# -# 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: -# Daniel Lezcano (IBM Corporation) -# - initial API and implementation -# - -# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Doc/QA/Scripts#cpufreq_02 - -source ../include/functions.sh - -FILES="scaling_available_governors scaling_governor" - -for_each_cpu check_cpufreq_files $FILES diff --git a/cpufreq/test_03.sh b/cpufreq/test_03.sh deleted file mode 100755 index 256a5c2..0000000 --- a/cpufreq/test_03.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# -# PM-QA validation test suite for the power management on ARM -# -# 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: -# Daniel Lezcano (IBM Corporation) -# - initial API and implementation -# - -# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Doc/QA/Scripts#cpufreq_03 - -source ../include/functions.sh - -check_governor() { - - local cpu=$1 - local newgov=$2 - - shift 2 - - local oldgov=$(get_governor $cpu) - - set_governor $cpu $newgov - - check "governor change to '$newgov'" "test \"$(get_governor $cpu)\" == \"$newgov\"" - - set_governor $cpu $oldgov -} - -if [ $(id -u) != 0 ]; then - log_skip "run as non-root" - exit 0 -fi - -for_each_cpu for_each_governor check_governor || exit 1 diff --git a/cpufreq/test_04.sh b/cpufreq/test_04.sh deleted file mode 100755 index 6fa81fa..0000000 --- a/cpufreq/test_04.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# -# PM-QA validation test suite for the power management on ARM -# -# 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: -# Daniel Lezcano (IBM Corporation) -# - initial API and implementation -# - -# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Doc/QA/Scripts#cpufreq_04 - -source ../include/functions.sh - -check_frequency() { - - local cpu=$1 - local newfreq=$2 - - shift 2 - - local oldgov=$(get_governor $cpu) - local oldfreq=$(get_frequency $cpu) - - set_governor $cpu userspace - set_frequency $cpu $newfreq - - check "setting frequency '$(frequnit $newfreq)'" "test \"$(get_frequency $cpu)\" == \"$newfreq\"" - - set_frequency $cpu $oldfreq - set_governor $cpu $oldgov -} - -if [ $(id -u) != 0 ]; then - log_skip "run as non-root" - exit 0 -fi - -for_each_cpu for_each_frequency check_frequency || exit 1 diff --git a/cpufreq/test_05.sh b/cpufreq/test_05.sh deleted file mode 100755 index 6ba938c..0000000 --- a/cpufreq/test_05.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/bash -# -# PM-QA validation test suite for the power management on ARM -# -# 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: -# Daniel Lezcano (IBM Corporation) -# - initial API and implementation -# - -# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Doc/QA/Scripts#cpufreq_05 - -source ../include/functions.sh - -if [ $(id -u) != 0 ]; then - log_skip "run as non-root" - exit 0 -fi - -save_governors - -trap restore_governors SIGHUP SIGINT SIGTERM - -switch_ondemand() { - local cpu=$1 - set_governor $cpu 'ondemand' -} - -switch_conservative() { - local cpu=$1 - set_governor $cpu 'conservative' -} - -switch_userspace() { - local cpu=$1 - set_governor $cpu 'userspace' -} - -for_each_cpu switch_ondemand -check "'ondemand' directory exists" "test -d $CPU_PATH/cpufreq/ondemand" - -for_each_cpu switch_conservative -check "'conservative' directory exists" "test -d $CPU_PATH/cpufreq/conservative" - -for_each_cpu switch_userspace -check "'ondemand' directory is not there" "test ! -d $CPU_PATH/cpufreq/ondemand" -check "'conservative' directory is not there" "test ! -d $CPU_PATH/cpufreq/conservative" - -# if more than one cpu, combine governors -nrcpus=$(ls $CPU_PATH | grep "cpu[0-9].*" | wc -l) -if [ $nrcpus > 0 ]; then - switch_ondemand cpu0 - switch_conservative cpu1 - check "'ondemand' directory exists" "test -d $CPU_PATH/cpufreq/ondemand" - check "'conservative' directory exists" "test -d $CPU_PATH/cpufreq/conservative" -fi - -restore_governors diff --git a/cpufreq/test_06.sh b/cpufreq/test_06.sh deleted file mode 100755 index cb75e7f..0000000 --- a/cpufreq/test_06.sh +++ /dev/null @@ -1,117 +0,0 @@ -#!/bin/bash -# -# PM-QA validation test suite for the power management on ARM -# -# 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: -# Daniel Lezcano (IBM Corporation) -# - initial API and implementation -# - -# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Doc/QA/Scripts#cpufreq_06 - -source ../include/functions.sh - -CPUCYCLE=../utils/cpucycle - -compute_freq_ratio() { - - local cpu=$1 - local freq=$2 - - set_frequency $cpu $freq - - result=$($CPUCYCLE $cpu) - if [ $? != 0 ]; then - return 1 - fi - - results[$index]=$(echo "scale=3;($result / $freq)" | bc -l) - index=$((index + 1)) -} - -compute_freq_ratio_sum() { - - res=${results[$index]} - sum=$(echo "($sum + $res)" | bc -l) - index=$((index + 1)) - -} - -__check_freq_deviation() { - - res=${results[$index]} - - # compute deviation - dev=$(echo "scale=3;((( $res - $avg ) / $avg) * 100 )" | bc -l) - - # change to absolute - dev=$(echo $dev | awk '{ print ($1 >= 0) ? $1 : 0 - $1}') - - index=$((index + 1)) - - res=$(echo "($dev > 5.0)" | bc -l) - if [ "$res" = "1" ]; then - return 1 - fi - - return 0 -} - -check_freq_deviation() { - - local cpu=$1 - local freq=$2 - - check "deviation for frequency $(frequnit $freq)" __check_freq_deviation - -} - -check_deviation() { - - local cpu=$1 - - set_governor $cpu userspace - - for_each_frequency $cpu compute_freq_ratio - - index=0 - sum=0 - - for_each_frequency $cpu compute_freq_ratio_sum - - avg=$(echo "scale=3;($sum / $index)" | bc -l) - - index=0 - for_each_frequency $cpu check_freq_deviation -} - -if [ $(id -u) != 0 ]; then - log_skip "run as non-root" - exit 0 -fi - -save_governors -save_frequencies - -trap "restore_frequencies; restore_governors; sigtrap" SIGHUP SIGINT SIGTERM - -for_each_cpu check_deviation - -restore_frequencies -restore_governors diff --git a/cpufreq/test_07.sh b/cpufreq/test_07.sh deleted file mode 100755 index 2fb4b53..0000000 --- a/cpufreq/test_07.sh +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/bash -# -# PM-QA validation test suite for the power management on ARM -# -# 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: -# Daniel Lezcano (IBM Corporation) -# - initial API and implementation -# - -# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Doc/QA/Scripts#cpufreq_07 - -source ../include/functions.sh - -CPUBURN=../utils/cpuburn - -check_ondemand() { - - local cpu=$1 - local maxfreq=$(get_max_frequency $cpu) - local minfreq=$(get_min_frequency $cpu) - local curfreq=$(get_frequency $cpu) - local pid= - - set_governor $cpu ondemand - - # wait for a quescient point - for i in $(seq 1 10); do - - if [ "$minfreq" == "$(get_frequency $cpu)" ]; then - - $CPUBURN $cpu & - pid=$! - - sleep 1 - wait_latency $cpu - curfreq=$(get_frequency $cpu) - kill $pid - - check "'ondemand' increase frequency on load" "test \"$curfreq\" == \"$maxfreq\"" - if [ "$?" != "0" ]; then - return 1 - fi - - sleep 1 - curfreq=$(get_frequency $cpu) - - check "'ondemand' decrease frequency on idle" "test \"$curfreq\" == \"$minfreq\"" - if [ "$?" != "0" ]; then - return 1 - fi - - return 0 - fi - - sleep 1 - - done - - log_skip "can not reach a quescient point for 'ondemand'" - - return 1 -} - -if [ $(id -u) != 0 ]; then - log_skip "run as non-root" - exit 0 -fi - -save_governors - -trap "restore_governors; sigtrap" SIGHUP SIGINT SIGTERM - -for_each_cpu check_ondemand - -restore_governors diff --git a/cpufreq/test_08.sh b/cpufreq/test_08.sh deleted file mode 100755 index 3f47613..0000000 --- a/cpufreq/test_08.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/bash -# -# PM-QA validation test suite for the power management on ARM -# -# 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: -# Daniel Lezcano (IBM Corporation) -# - initial API and implementation -# - -# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Doc/QA/Scripts#cpufreq_08 - -source ../include/functions.sh - -CPUBURN=../utils/cpuburn - -check_frequency() { - local cpu=$1 - local freq=$2 - local curfreq= - local pid= - - $CPUBURN $cpu & - pid=$! - - set_frequency $cpu $freq - - wait_latency $cpu - curfreq=$(get_frequency $cpu) - kill $pid - - check "'userspace' $(frequnit $freq) is fixed" "test \"$curfreq\" == \"$freq\"" - if [ "$?" != "0" ]; then - return 1 - fi - - return 0 -} - -check_userspace() { - - local cpu=$1 - local maxfreq=$(get_max_frequency $cpu) - local minfreq=$(get_min_frequency $cpu) - local curfreq=$(get_frequency $cpu) - - set_governor $cpu userspace - - for_each_frequency $cpu check_frequency $minfreq -} - -save_governors - -if [ $(id -u) != 0 ]; then - log_skip "run as non-root" - exit 0 -fi - -trap "restore_governors; sigtrap" SIGHUP SIGINT SIGTERM - -for_each_cpu check_userspace - -restore_governors diff --git a/cpufreq/test_09.sh b/cpufreq/test_09.sh deleted file mode 100755 index 7fa8317..0000000 --- a/cpufreq/test_09.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash -# -# PM-QA validation test suite for the power management on ARM -# -# 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: -# Daniel Lezcano (IBM Corporation) -# - initial API and implementation -# - -# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Doc/QA/Scripts#cpufreq_09 - -source ../include/functions.sh - -CPUBURN=../utils/cpuburn - -check_powersave() { - - local cpu=$1 - local minfreq=$(get_min_frequency $cpu) - local curfreq=$(get_frequency $cpu) - - set_governor $cpu powersave - - wait_latency $cpu - curfreq=$(get_frequency $cpu) - - check "'powersave' sets frequency to $(frequnit $minfreq)" "test \"$curfreq\" == \"$minfreq\"" - if [ "$?" != "0" ]; then - return 1 - fi - - $CPUBURN $cpu & - pid=$! - - wait_latency $cpu - curfreq=$(get_frequency $cpu) - kill $pid - - check "'powersave' frequency $(frequnit $minfreq) is fixed" "test \"$curfreq\" == \"$minfreq\"" - if [ "$?" != "0" ]; then - return 1 - fi - - return 0 -} - -save_governors - -if [ $(id -u) != 0 ]; then - log_skip "run as non-root" - exit 0 -fi - -trap "restore_governors; sigtrap" SIGHUP SIGINT SIGTERM - -for_each_cpu check_powersave - -restore_governors diff --git a/sched_mc/sched_01.sh b/sched_mc/sched_01.sh new file mode 100644 index 0000000..e0fd9aa --- /dev/null +++ b/sched_mc/sched_01.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# +# PM-QA validation test suite for the power management on ARM +# +# 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: +# Daniel Lezcano (IBM Corporation) +# - initial API and implementation +# + +# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Doc/QA/Scripts#sched_mc_01 + +source ../include/functions.sh + +FILES="sched_mc_power_savings" + +check_sched_mc_files $FILES diff --git a/sched_mc/sched_02.sh b/sched_mc/sched_02.sh new file mode 100644 index 0000000..36730a4 --- /dev/null +++ b/sched_mc/sched_02.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# +# PM-QA validation test suite for the power management on ARM +# +# 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: +# Daniel Lezcano (IBM Corporation) +# - initial API and implementation +# + +# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Doc/QA/Scripts#sched_mc_02 + +source ../include/functions.sh + +check_physical_package_id() { + + local package_id=$CPU_PATH/$1/topology/physical_package_id + local val=$(cat $package_id) + + check "topology is enabled" "test \"$val\" != \"-1\"" +} + +for_each_cpu check_physical_package_id || exit 1 diff --git a/sched_mc/sched_03.sh b/sched_mc/sched_03.sh new file mode 100644 index 0000000..b5a9c49 --- /dev/null +++ b/sched_mc/sched_03.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# +# PM-QA validation test suite for the power management on ARM +# +# 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: +# Daniel Lezcano (IBM Corporation) +# - initial API and implementation +# + +# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Doc/QA/Scripts#sched_mc_03 + +source ../include/functions.sh + +FILES="core_id core_siblings core_siblings_list physical_package_id \ +thread_siblings thread_siblings_list" + +for_each_cpu check_topology_files $FILES diff --git a/sched_mc/sched_04.sh b/sched_mc/sched_04.sh new file mode 100644 index 0000000..4d7cfc1 --- /dev/null +++ b/sched_mc/sched_04.sh @@ -0,0 +1,70 @@ +#!/bin/bash +# +# PM-QA validation test suite for the power management on ARM +# +# 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: +# Daniel Lezcano (IBM Corporation) +# - initial API and implementation +# + +# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Doc/QA/Scripts#sched_mc_04 + +source ../include/functions.sh + +check_change() { + local val=$1 + local path=$2 + + echo $val > $path +} + +check_invalid_change() { + + local val=$1 + local path=$2 + + echo $val > $path + if [ "$?" != "0" ]; then + return 0 + fi + + return 1 +} + +check_sched_mc_change() { + + local path=$CPU_PATH/sched_mc_power_savings + local oldval=$(cat $path) + + check "setting value to 0" check_change 0 $path + check "setting value to 1" check_change 1 $path + check "setting value to 2" check_change 2 $path + check "setting invalid value to 3" check_invalid_change 3 $path + check "setting invalid value to -1" check_invalid_change -1 $path + + echo $oldval > $path +} + +if [ $(id -u) != 0 ]; then + log_skip "run as non-root" + exit 0 +fi + +# check_sched_mc_files sched_mc_power_savings || exit 1 +check_sched_mc_change diff --git a/sched_mc/test_01.sh b/sched_mc/test_01.sh deleted file mode 100755 index e0fd9aa..0000000 --- a/sched_mc/test_01.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# -# PM-QA validation test suite for the power management on ARM -# -# 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: -# Daniel Lezcano (IBM Corporation) -# - initial API and implementation -# - -# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Doc/QA/Scripts#sched_mc_01 - -source ../include/functions.sh - -FILES="sched_mc_power_savings" - -check_sched_mc_files $FILES diff --git a/sched_mc/test_02.sh b/sched_mc/test_02.sh deleted file mode 100755 index 36730a4..0000000 --- a/sched_mc/test_02.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -# -# PM-QA validation test suite for the power management on ARM -# -# 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: -# Daniel Lezcano (IBM Corporation) -# - initial API and implementation -# - -# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Doc/QA/Scripts#sched_mc_02 - -source ../include/functions.sh - -check_physical_package_id() { - - local package_id=$CPU_PATH/$1/topology/physical_package_id - local val=$(cat $package_id) - - check "topology is enabled" "test \"$val\" != \"-1\"" -} - -for_each_cpu check_physical_package_id || exit 1 diff --git a/sched_mc/test_03.sh b/sched_mc/test_03.sh deleted file mode 100755 index b5a9c49..0000000 --- a/sched_mc/test_03.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -# -# PM-QA validation test suite for the power management on ARM -# -# 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: -# Daniel Lezcano (IBM Corporation) -# - initial API and implementation -# - -# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Doc/QA/Scripts#sched_mc_03 - -source ../include/functions.sh - -FILES="core_id core_siblings core_siblings_list physical_package_id \ -thread_siblings thread_siblings_list" - -for_each_cpu check_topology_files $FILES diff --git a/sched_mc/test_04.sh b/sched_mc/test_04.sh deleted file mode 100755 index 4d7cfc1..0000000 --- a/sched_mc/test_04.sh +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/bash -# -# PM-QA validation test suite for the power management on ARM -# -# 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: -# Daniel Lezcano (IBM Corporation) -# - initial API and implementation -# - -# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Doc/QA/Scripts#sched_mc_04 - -source ../include/functions.sh - -check_change() { - local val=$1 - local path=$2 - - echo $val > $path -} - -check_invalid_change() { - - local val=$1 - local path=$2 - - echo $val > $path - if [ "$?" != "0" ]; then - return 0 - fi - - return 1 -} - -check_sched_mc_change() { - - local path=$CPU_PATH/sched_mc_power_savings - local oldval=$(cat $path) - - check "setting value to 0" check_change 0 $path - check "setting value to 1" check_change 1 $path - check "setting value to 2" check_change 2 $path - check "setting invalid value to 3" check_invalid_change 3 $path - check "setting invalid value to -1" check_invalid_change -1 $path - - echo $oldval > $path -} - -if [ $(id -u) != 0 ]; then - log_skip "run as non-root" - exit 0 -fi - -# check_sched_mc_files sched_mc_power_savings || exit 1 -check_sched_mc_change