blob: cf53a1ab087a166576a38aaf75ad52c1f42f6f3c [file] [log] [blame]
Amit Daniel Kachhape9e50102012-03-26 16:38:23 +05301#!/bin/bash
2#
3# PM-QA validation test suite for the power management on Linux
4#
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# Amit Daniel <amit.kachhap@linaro.org> (Samsung Electronics)
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#thermal_03
Amit Daniel Kachhape9e50102012-03-26 16:38:23 +053027
28source ../include/functions.sh
29source ../include/thermal_functions.sh
30
31CPU_HEAT_BIN=../utils/heat_cpu
hongbo.zhang9fec6ec2012-11-26 15:32:59 +080032cpu_pid=0
hongbo.zhang9fec6ec2012-11-26 15:32:59 +080033
34heater_kill() {
Sanjay Singh Rawatc7af87b2013-12-15 13:30:37 +053035 if [ $cpu_pid -ne 0 ]; then
hongbo.zhang9fec6ec2012-11-26 15:32:59 +080036 kill -9 $cpu_pid
37 fi
Hongbo Zhang40807512013-01-09 15:01:11 +080038 kill_glmark2
hongbo.zhang9fec6ec2012-11-26 15:32:59 +080039}
Amit Daniel Kachhape9e50102012-03-26 16:38:23 +053040
41check_temperature_change() {
42 local dirpath=$THERMAL_PATH/$1
43 local zone_name=$1
44 shift 1
45
Amit Daniel Kachhape9e50102012-03-26 16:38:23 +053046 local init_temp=$(cat $dirpath/temp)
47 $CPU_HEAT_BIN &
48 cpu_pid=$(ps | grep heat_cpu| awk '{print $1}')
zhanghongbo4dbc9772012-05-11 15:07:56 +080049 test -z $cpu_pid && cpu_pid=0
Amit Daniel Kachhape9e50102012-03-26 16:38:23 +053050 check "start cpu heat binary" "test $cpu_pid -ne 0"
Hongbo Zhangd85f7bd2013-02-06 11:09:31 +080051 test $cpu_pid -eq 0 && return
Amit Daniel Kachhape9e50102012-03-26 16:38:23 +053052
Hongbo Zhang40807512013-01-09 15:01:11 +080053 start_glmark2
zhanghongbo4dbc9772012-05-11 15:07:56 +080054
Amit Daniel Kachhape9e50102012-03-26 16:38:23 +053055 sleep 5
56 local final_temp=$(cat $dirpath/temp)
hongbo.zhang9fec6ec2012-11-26 15:32:59 +080057 heater_kill
Amit Daniel Kachhape9e50102012-03-26 16:38:23 +053058 check "temperature variation with load" "test $final_temp -gt $init_temp"
59}
60
hongbo.zhang9fec6ec2012-11-26 15:32:59 +080061trap "heater_kill; sigtrap" SIGHUP SIGINT SIGTERM
62
Amit Daniel Kachhape9e50102012-03-26 16:38:23 +053063for_each_thermal_zone check_temperature_change
Sanjay Singh Rawat3bf61942013-04-10 14:06:14 +053064test_status_show