Amit Daniel Kachhap | d57a91c | 2012-03-26 17:06:54 +0530 | [diff] [blame] | 1 | #!/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_06 |
| 27 | |
| 28 | source ../include/functions.sh |
| 29 | source ../include/thermal_functions.sh |
| 30 | |
Hongbo Zhang | 974802b | 2013-02-04 19:22:58 +0800 | [diff] [blame] | 31 | if [ "$thermal_try_max" -eq 0 ]; then |
hongbo.zhang | 82fbd05 | 2012-11-26 16:29:47 +0800 | [diff] [blame] | 32 | log_skip "test of trip points being crossed" |
| 33 | exit 0 |
| 34 | fi |
| 35 | |
Amit Daniel Kachhap | d57a91c | 2012-03-26 17:06:54 +0530 | [diff] [blame] | 36 | TEST_LOOP=100 |
Hongbo Zhang | 4080751 | 2013-01-09 15:01:11 +0800 | [diff] [blame] | 37 | CPU_HEAT_BIN=../utils/heat_cpu |
hongbo.zhang | 9fec6ec | 2012-11-26 15:32:59 +0800 | [diff] [blame] | 38 | cpu_pid=0 |
hongbo.zhang | 9fec6ec | 2012-11-26 15:32:59 +0800 | [diff] [blame] | 39 | |
| 40 | heater_kill() { |
| 41 | if [ $cpu_pid != 0 ]; then |
| 42 | kill -9 $cpu_pid |
| 43 | fi |
Hongbo Zhang | 4080751 | 2013-01-09 15:01:11 +0800 | [diff] [blame] | 44 | kill_glmark2 |
hongbo.zhang | 9fec6ec | 2012-11-26 15:32:59 +0800 | [diff] [blame] | 45 | } |
Amit Daniel Kachhap | d57a91c | 2012-03-26 17:06:54 +0530 | [diff] [blame] | 46 | |
| 47 | check_trip_point_change() { |
| 48 | local dirpath=$THERMAL_PATH/$1 |
| 49 | local zone_name=$1 |
| 50 | shift 1 |
| 51 | |
| 52 | local count=0 |
| 53 | local cur_temp=0 |
| 54 | local trip_temp=0 |
| 55 | local trip_cross= |
| 56 | local trip_id= |
Amit Daniel Kachhap | d57a91c | 2012-03-26 17:06:54 +0530 | [diff] [blame] | 57 | local trip_type=0 |
| 58 | local trip_type_path=0 |
| 59 | $CPU_HEAT_BIN & |
| 60 | cpu_pid=$(ps | grep heat_cpu| awk '{print $1}') |
zhanghongbo | 4dbc977 | 2012-05-11 15:07:56 +0800 | [diff] [blame] | 61 | test -z $cpu_pid && cpu_pid=0 |
Amit Daniel Kachhap | d57a91c | 2012-03-26 17:06:54 +0530 | [diff] [blame] | 62 | check "start cpu heat binary" "test $cpu_pid -ne 0" |
Hongbo Zhang | d85f7bd | 2013-02-06 11:09:31 +0800 | [diff] [blame] | 63 | test $cpu_pid -eq 0 && return |
Amit Daniel Kachhap | d57a91c | 2012-03-26 17:06:54 +0530 | [diff] [blame] | 64 | |
Hongbo Zhang | 4080751 | 2013-01-09 15:01:11 +0800 | [diff] [blame] | 65 | start_glmark2 |
Amit Daniel Kachhap | d57a91c | 2012-03-26 17:06:54 +0530 | [diff] [blame] | 66 | |
| 67 | local index=0 |
| 68 | for trip in $(ls $dirpath | grep "trip_point_['$MAX_ZONE']_temp"); do |
| 69 | trip_cross[$index]=0 |
| 70 | index=$((index + 1)) |
| 71 | done |
| 72 | while (test $count -lt $TEST_LOOP); do |
| 73 | index=0 |
| 74 | sleep 1 |
| 75 | for trip in $(ls $dirpath | grep "trip_point_['$MAX_ZONE']_temp"); do |
| 76 | cur_temp=$(cat $dirpath/temp) |
| 77 | trip_temp=$(cat $dirpath/$trip) |
| 78 | if [ $cur_temp -gt $trip_temp ]; then |
| 79 | trip_cross[$index]=$((${trip_cross[$index]} + 1)) |
| 80 | fi |
| 81 | index=$((index + 1)) |
| 82 | |
| 83 | done |
| 84 | count=$((count + 1)) |
| 85 | done |
| 86 | index=0 |
| 87 | for trip in $(ls $dirpath | grep "trip_point_['$MAX_ZONE']_temp"); do |
| 88 | get_trip_id $trip |
| 89 | trip_id=$? |
| 90 | trip_type=$(cat $dirpath/trip_point_$((trip_id))_type) |
| 91 | trip_temp=$(cat $dirpath/$trip) |
| 92 | |
| 93 | if [ $trip_type != "critical" ]; then |
| 94 | count=${trip_cross[$index]} |
| 95 | check "$trip:$trip_temp crossed" "test $count -gt 0" |
| 96 | fi |
| 97 | index=$((index + 1)) |
| 98 | done |
| 99 | |
hongbo.zhang | 9fec6ec | 2012-11-26 15:32:59 +0800 | [diff] [blame] | 100 | heater_kill |
Amit Daniel Kachhap | d57a91c | 2012-03-26 17:06:54 +0530 | [diff] [blame] | 101 | } |
| 102 | |
hongbo.zhang | 9fec6ec | 2012-11-26 15:32:59 +0800 | [diff] [blame] | 103 | trap "heater_kill; sigtrap" SIGHUP SIGINT SIGTERM |
| 104 | |
Amit Daniel Kachhap | d57a91c | 2012-03-26 17:06:54 +0530 | [diff] [blame] | 105 | for_each_thermal_zone check_trip_point_change |
Sanjay Singh Rawat | 3bf6194 | 2013-04-10 14:06:14 +0530 | [diff] [blame^] | 106 | test_status_show |