blob: f502b8395fe167a9d5edad071319996a7c3d3b9a [file] [log] [blame]
Lisa Nguyenadf9df92015-01-25 18:16:45 -08001#!/bin/sh
Daniel Lezcano4b699782011-07-26 14:39:00 +02002#
Daniel Lezcano35fb1722011-10-03 13:56:11 +02003# PM-QA validation test suite for the power management on Linux
Daniel Lezcano4b699782011-07-26 14:39:00 +02004#
5# Copyright (C) 2011, Linaro Limited.
6#
7# This program is free software; you can redistribute it and/or
8# modify it under the terms of the GNU General Public License
9# as published by the Free Software Foundation; either version 2
10# of the License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program; if not, write to the Free Software
19# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20#
21# Contributors:
22# Daniel Lezcano <daniel.lezcano@linaro.org> (IBM Corporation)
23# - initial API and implementation
24#
25
Sanjay Singh Rawat912729b2013-08-21 20:18:40 +053026# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/PmQaSpecification#cpufreq_09
Daniel Lezcano4b699782011-07-26 14:39:00 +020027
Lisa Nguyenadf9df92015-01-25 18:16:45 -080028. ../include/functions.sh
Daniel Lezcano4b699782011-07-26 14:39:00 +020029
30CPUBURN=../utils/cpuburn
31
32check_powersave() {
33
34 local cpu=$1
35 local minfreq=$(get_min_frequency $cpu)
36 local curfreq=$(get_frequency $cpu)
37
38 set_governor $cpu powersave
39
40 wait_latency $cpu
41 curfreq=$(get_frequency $cpu)
42
43 check "'powersave' sets frequency to $(frequnit $minfreq)" "test \"$curfreq\" == \"$minfreq\""
44 if [ "$?" != "0" ]; then
45 return 1
46 fi
47
48 $CPUBURN $cpu &
49 pid=$!
50
51 wait_latency $cpu
52 curfreq=$(get_frequency $cpu)
53 kill $pid
54
55 check "'powersave' frequency $(frequnit $minfreq) is fixed" "test \"$curfreq\" == \"$minfreq\""
Sanjay Singh Rawatc7af87b2013-12-15 13:30:37 +053056 if [ "$?" -ne "0" ]; then
Daniel Lezcano4b699782011-07-26 14:39:00 +020057 return 1
58 fi
59
60 return 0
61}
62
63save_governors
64
hongbo.zhangba2cbcc2012-08-07 13:35:32 +080065supported=$(cat $CPU_PATH/cpu0/cpufreq/scaling_available_governors | grep "powersave")
zhanghongbo13a161c2012-08-17 19:06:33 +080066if [ -z "$supported" ]; then
hongbo.zhangba2cbcc2012-08-07 13:35:32 +080067 log_skip "powersave not supported"
Lisa Nguyend713d632014-08-20 17:26:04 -070068 return 0
hongbo.zhangba2cbcc2012-08-07 13:35:32 +080069fi
70
Daniel Lezcano4b699782011-07-26 14:39:00 +020071trap "restore_governors; sigtrap" SIGHUP SIGINT SIGTERM
72
73for_each_cpu check_powersave
74
75restore_governors
Sanjay Singh Rawat3bf61942013-04-10 14:06:14 +053076test_status_show