aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmit Daniel Kachhap <amit.kachhap@linaro.org>2012-03-26 16:13:29 +0530
committerzhanghongbo <hongbo.zhang@stericsson.com>2012-05-09 15:29:03 +0800
commit87adb0d5e3be11626274fd7c7c5995da39b9101b (patch)
tree3cb8036e825b3335bad458db5b16f4d353871950
parent199ea5d4c9ebca24ff21ec9aeab48b6bae3d02c9 (diff)
Add cooling devices functional tests.
Signed-off-by: Amit Daniel Kachhap <amit.kachhap@linaro.org>
-rw-r--r--include/thermal_functions.sh16
-rwxr-xr-xthermal/thermal_02.sh65
-rw-r--r--thermal/thermal_02.txt1
3 files changed, 82 insertions, 0 deletions
diff --git a/include/thermal_functions.sh b/include/thermal_functions.sh
index c590688..1a7f1eb 100644
--- a/include/thermal_functions.sh
+++ b/include/thermal_functions.sh
@@ -153,3 +153,19 @@ validate_trip_level() {
check_file $trip_type $dirpath || return 1
check_valid_temp $trip_temp $zone_name || return 1
}
+
+for_each_cooling_device() {
+
+ local func=$1
+ shift 1
+
+ devices=$(ls $THERMAL_PATH | grep "cooling_device['$MAX_CDEV']")
+
+ ALL_DEVICE=$devices
+ for device in $devices; do
+ INC=0
+ $func $device $@
+ done
+
+ return 0
+}
diff --git a/thermal/thermal_02.sh b/thermal/thermal_02.sh
new file mode 100755
index 0000000..d2cb32e
--- /dev/null
+++ b/thermal/thermal_02.sh
@@ -0,0 +1,65 @@
+#!/bin/bash
+#
+# PM-QA validation test suite for the power management on Linux
+#
+# Copyright (C) 2011, Linaro Limited.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+#
+# Contributors:
+# Amit Daniel <amit.kachhap@linaro.org> (Samsung Electronics)
+# - initial API and implementation
+#
+
+# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Doc/QA/Scripts#thermal_02
+
+source ../include/functions.sh
+source ../include/thermal_functions.sh
+
+CDEV_ATTRIBUTES="cur_state max_state type uevent"
+
+check_cooling_device_attributes() {
+
+ local dirpath=$THERMAL_PATH/$1
+ local cdev_name=$1
+ shift 1
+
+ for i in $CDEV_ATTRIBUTES; do
+ check_file $i $dirpath || return 1
+ done
+
+}
+
+check_cooling_device_states() {
+ local dirpath=$THERMAL_PATH/$1
+ local cdev_name=$1
+ shift 1
+ local max_state=$(cat $dirpath/max_state)
+ local prev_state_val=$(cat $dirpath/cur_state)
+ local count=0
+ local cur_state_val=0
+ while (test $count -le $max_state); do
+ echo $count > $dirpath/cur_state
+ cur_state_val=$(cat $dirpath/cur_state)
+ check "$cdev_name cur_state=$count"\
+ "test $cur_state_val -eq $count" || return 1
+ count=$((count+1))
+ done
+ echo $prev_state_val > $dirpath/cur_state
+}
+
+for_each_cooling_device check_cooling_device_attributes
+
+for_each_cooling_device check_cooling_device_states
diff --git a/thermal/thermal_02.txt b/thermal/thermal_02.txt
new file mode 100644
index 0000000..8da4478
--- /dev/null
+++ b/thermal/thermal_02.txt
@@ -0,0 +1 @@
+test/verify the cooling device files are present in the sysfs