blob: 790c9c3e83a8019af5821cc322af66228105bbf2 [file] [log] [blame]
Lisa Nguyenadf9df92015-01-25 18:16:45 -08001#!/bin/sh
Amit Daniel Kachhape9e50102012-03-26 16:38:23 +05302#
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
Lisa Nguyenadf9df92015-01-25 18:16:45 -080028. ../include/functions.sh
Amit Daniel Kachhape9e50102012-03-26 16:38:23 +053029
30CPU_HEAT_BIN=../utils/heat_cpu
hongbo.zhang9fec6ec2012-11-26 15:32:59 +080031cpu_pid=0
hongbo.zhang9fec6ec2012-11-26 15:32:59 +080032
33heater_kill() {
Sanjay Singh Rawatc7af87b2013-12-15 13:30:37 +053034 if [ $cpu_pid -ne 0 ]; then
hongbo.zhang9fec6ec2012-11-26 15:32:59 +080035 kill -9 $cpu_pid
36 fi
Hongbo Zhang40807512013-01-09 15:01:11 +080037 kill_glmark2
hongbo.zhang9fec6ec2012-11-26 15:32:59 +080038}
Amit Daniel Kachhape9e50102012-03-26 16:38:23 +053039
40check_temperature_change() {
Lisa Nguyen4e0b59a2015-01-25 17:46:40 -080041 dirpath=$THERMAL_PATH/$1
42 zone_name=$1
Amit Daniel Kachhape9e50102012-03-26 16:38:23 +053043 shift 1
44
Lisa Nguyen4e0b59a2015-01-25 17:46:40 -080045 init_temp=$(cat $dirpath/temp)
Amit Daniel Kachhape9e50102012-03-26 16:38:23 +053046 $CPU_HEAT_BIN &
Lisa Nguyenc190ca52016-07-25 21:46:51 -070047
48 get_os
49 if [ $? -eq 1 ]; then
50 cpu_pid=$(ps | grep heat_cpu| awk '{print $1}')
51 else
52 cpu_pid=$(ps | grep heat_cpu| awk '{print $2}')
53 fi
zhanghongbo4dbc9772012-05-11 15:07:56 +080054 test -z $cpu_pid && cpu_pid=0
Amit Daniel Kachhape9e50102012-03-26 16:38:23 +053055 check "start cpu heat binary" "test $cpu_pid -ne 0"
Hongbo Zhangd85f7bd2013-02-06 11:09:31 +080056 test $cpu_pid -eq 0 && return
Amit Daniel Kachhape9e50102012-03-26 16:38:23 +053057
Hongbo Zhang40807512013-01-09 15:01:11 +080058 start_glmark2
zhanghongbo4dbc9772012-05-11 15:07:56 +080059
Amit Daniel Kachhape9e50102012-03-26 16:38:23 +053060 sleep 5
Lisa Nguyen4e0b59a2015-01-25 17:46:40 -080061 final_temp=$(cat $dirpath/temp)
hongbo.zhang9fec6ec2012-11-26 15:32:59 +080062 heater_kill
Amit Daniel Kachhape9e50102012-03-26 16:38:23 +053063 check "temperature variation with load" "test $final_temp -gt $init_temp"
64}
65
Lisa Nguyen5a0c2ba2015-01-27 13:57:25 -080066trap "heater_kill; sigtrap" HUP INT TERM
hongbo.zhang9fec6ec2012-11-26 15:32:59 +080067
Lisa Nguyenddd07af2015-11-17 23:15:22 -080068check_for_thermal_zones
69if [ $? -ne 0 ]; then
Lisa Nguyend75a9832015-11-17 18:40:10 -080070 log_skip "No thermal zones found"
71else
Lisa Nguyencca3b382016-09-11 21:19:54 -070072 check_for_glmark2
73 if [ $? -ne 0 ]; then
74 log_skip "glmark2 not found"
75 else
76 for_each_thermal_zone check_temperature_change
77 fi
Lisa Nguyend75a9832015-11-17 18:40:10 -080078fi
Sanjay Singh Rawat3bf61942013-04-10 14:06:14 +053079test_status_show