blob: 4bb3982fcbfc560e9b77272ff3b04e305ad575a6 [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
26# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Doc/QA/Scripts#thermal_03
27
28source ../include/functions.sh
29source ../include/thermal_functions.sh
30
31CPU_HEAT_BIN=../utils/heat_cpu
32GPU_HEAT_BIN=glmark2
33
34check_temperature_change() {
35 local dirpath=$THERMAL_PATH/$1
36 local zone_name=$1
37 shift 1
38
39 local cpu_pid=0
40 local gpu_pid=0
41 local init_temp=$(cat $dirpath/temp)
42 $CPU_HEAT_BIN &
43 cpu_pid=$(ps | grep heat_cpu| awk '{print $1}')
44 check "start cpu heat binary" "test $cpu_pid -ne 0"
45
46 $GPU_HEAT_BIN &
47 gpu_pid=$(ps | grep $GPU_HEAT_BIN| awk '{print $1}')
48 check "start gpu heat binary" "test $gpu_pid -ne 0"
49 sleep 5
50 local final_temp=$(cat $dirpath/temp)
Amit Daniel Kachhap1fe389c2012-04-04 15:14:38 +053051 if [ $cpu_pid != 0 ]; then
Amit Daniel Kachhape9e50102012-03-26 16:38:23 +053052 kill -9 $cpu_pid
53 fi
Amit Daniel Kachhap1fe389c2012-04-04 15:14:38 +053054 if [ $gpu_pid != 0 ]; then
Amit Daniel Kachhape9e50102012-03-26 16:38:23 +053055 kill -9 $gpu_pid
56 fi
57 check "temperature variation with load" "test $final_temp -gt $init_temp"
58}
59
60for_each_thermal_zone check_temperature_change