Amit Daniel Kachhap | f2408a6 | 2012-03-26 15:18:33 +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_04 |
| 27 | |
| 28 | source ../include/functions.sh |
| 29 | source ../include/thermal_functions.sh |
| 30 | HEAT_CPU_MODERATE=../utils/heat_cpu moderate |
| 31 | |
| 32 | verify_cooling_device_temp_change() { |
| 33 | local dirpath=$THERMAL_PATH/$1 |
| 34 | local cdev_name=$1 |
| 35 | shift 1 |
| 36 | local tzonepath=$THERMAL_PATH/thermal_zone0 |
| 37 | test -d $tzonepath |
| 38 | if [ $? -ne 0 ] ; then |
| 39 | echo "No thermal zone present" |
| 40 | return 1; |
| 41 | fi |
| 42 | local max_state=$(cat $dirpath/max_state) |
| 43 | local prev_state_val=$(cat $dirpath/cur_state) |
| 44 | local prev_mode_val=$(cat $tzonepath/mode) |
| 45 | echo -n disabled > $tzonepath/mode |
| 46 | |
| 47 | local count=1 |
| 48 | local cur_state_val=0 |
| 49 | local init_temp=0 |
| 50 | local final_temp=0 |
| 51 | local cool_temp=0 |
| 52 | ./$HEAT_CPU_MODERATE & |
| 53 | pid=$! |
| 54 | |
| 55 | while (test $count -le $max_state); do |
| 56 | echo 0 > $dirpath/cur_state |
| 57 | sleep 5 |
| 58 | init_temp=$(cat $tzonepath/temp) |
| 59 | |
| 60 | echo $count > $dirpath/cur_state |
| 61 | sleep 5 |
| 62 | final_temp=$(cat $tzonepath/temp) |
| 63 | cool_temp=$(($init_temp - $final_temp)) |
| 64 | check "$cdev_name:state=$count effective cool=$cool_temp "\ |
| 65 | "test $final_temp -lt $init_temp" |
| 66 | count=$((count+1)) |
| 67 | done |
| 68 | kill -9 $pid |
| 69 | echo $prev_mode_val > $tzonepath/mode |
| 70 | echo $prev_state_val > $dirpath/cur_state |
| 71 | } |
| 72 | |
| 73 | for_each_cooling_device verify_cooling_device_temp_change |