Signed-off-by: Lisa Nguyen <[email protected]>
---
cpufreq/cpufreq_03.sh | 3 --
cpufreq/cpufreq_04.sh | 2 +-
cpufreq/cpufreq_05.sh | 6 ++-
cpufreq/cpufreq_06.sh | 10 +---
cpufreq/cpufreq_07.sh | 32 ++++++------
cpufreq/cpufreq_08.sh | 1 -
cpufreq/cpufreq_09.sh | 1 -
cpufreq/cpufreq_sanity.sh | 1 -
cpuhotplug/cpuhotplug_02.sh | 8 +--
cpuhotplug/cpuhotplug_03.sh | 2 +-
cpuhotplug/cpuhotplug_04.sh | 2 +-
cpuhotplug/cpuhotplug_05.sh | 2 +-
cpuhotplug/cpuhotplug_06.sh | 2 +-
cpuhotplug/cpuhotplug_07.sh | 2 +-
cpuhotplug/cpuhotplug_08.sh | 2 +-
cpuhotplug/cpuhotplug_sanity.sh | 2 +-
cpuidle/cpuidle_01.sh | 10 ++--
cpuidle/cpuidle_03.sh | 5 +-
cpuidle/cpuidle_sanity.sh | 1 -
cputopology/cputopology_01.sh | 1 -
include/functions.sh | 103 +++++++++++++++++----------------------
include/suspend_functions.sh | 3 +-
include/thermal_functions.sh | 51 +++++++++----------
powertop/powertop_01.sh | 1 -
powertop/powertop_sanity.sh | 1 -
suspend/suspend_02.sh | 2 -
thermal/thermal_00.sh | 16 +++---
thermal/thermal_01.sh | 11 ++---
thermal/thermal_02.sh | 15 +++---
thermal/thermal_03.sh | 4 +-
thermal/thermal_04.sh | 33 ++++++-------
thermal/thermal_05.sh | 28 ++++++-----
thermal/thermal_06.sh | 55 +++++++++++----------
thermal/thermal_sanity.sh | 1 -
34 files changed, 192 insertions(+), 227 deletions(-)
diff --git a/cpufreq/cpufreq_03.sh b/cpufreq/cpufreq_03.sh
index 32e2114..a69412a 100755
--- a/cpufreq/cpufreq_03.sh
+++ b/cpufreq/cpufreq_03.sh
@@ -28,14 +28,11 @@
. ../include/functions.sh
check_governor() {
-
cpu=$1
newgov=$2
-
shift 2
oldgov=$(get_governor $cpu)
-
set_governor $cpu $newgov
check "governor change to '$newgov'" "test \"$(get_governor $cpu)\" =
\"$newgov\""
diff --git a/cpufreq/cpufreq_04.sh b/cpufreq/cpufreq_04.sh
index 6813a2a..23b09b3 100755
--- a/cpufreq/cpufreq_04.sh
+++ b/cpufreq/cpufreq_04.sh
@@ -28,7 +28,6 @@
. ../include/functions.sh
check_frequency() {
-
cpu=$1
newfreq=$2
@@ -52,4 +51,5 @@ if [ -z "$supported" ]; then
else
for_each_cpu for_each_frequency check_frequency || exit 1
fi
+
test_status_show
diff --git a/cpufreq/cpufreq_05.sh b/cpufreq/cpufreq_05.sh
index 8d37bae..97a1ba2 100755
--- a/cpufreq/cpufreq_05.sh
+++ b/cpufreq/cpufreq_05.sh
@@ -55,6 +55,7 @@ check_governor() {
else
GOV_PATH=$CPU_PATH/cpufreq/$gov
fi
+
check "'$gov' directory exists" "test -d $GOV_PATH"
}
@@ -67,6 +68,7 @@ if [ -n "$scaling_govs" ]; then
for cpu in $cpus; do
switch_ondemand $cpu
done
+
check_governor $cpu 'ondemand'
fi
@@ -88,8 +90,8 @@ if [ -n "$scaling_govs" ]; then
switch_userspace $cpu
done
- check "'ondemand' directory is not there" "test ! -d
$CPU_PATH/cpufreq/ondemand"
- check "'conservative' directory is not there" "test ! -d
$CPU_PATH/cpufreq/conservative"
+ check "'ondemand' directory is not there" "test ! -d
$CPU_PATH/cpufreq/ondemand"
+ check "'conservative' directory is not there" "test ! -d
$CPU_PATH/cpufreq/conservative"
fi
# if more than one cpu, combine governors
diff --git a/cpufreq/cpufreq_06.sh b/cpufreq/cpufreq_06.sh
index 3bb104d..24cdd07 100755
--- a/cpufreq/cpufreq_06.sh
+++ b/cpufreq/cpufreq_06.sh
@@ -39,7 +39,7 @@ compute_freq_ratio() {
result=$($CPUCYCLE $cpu)
if [ $? -ne 0 ]; then
- return 1
+ return 1
fi
value=$(echo "scale=3;($result / $freq)" | bc -l)
@@ -54,7 +54,6 @@ compute_freq_ratio_sum() {
res=$(eval echo \$$freq_results_array$index)
sum=$(echo "($sum + $res)" | bc -l)
index=$((index + 1))
-
}
__check_freq_deviation() {
@@ -71,29 +70,24 @@ __check_freq_deviation() {
res=$(echo "($dev > 5.0)" | bc -l)
if [ "$res" = "1" ]; then
- return 1
+ return 1
fi
return 0
}
check_freq_deviation() {
-
cpu=$1
freq=$2
check "deviation for frequency $(frequnit $freq)" __check_freq_deviation
-
}
check_deviation() {
-
cpu=$1
set_governor $cpu userspace
-
for_each_frequency $cpu compute_freq_ratio
-
for_each_frequency $cpu compute_freq_ratio_sum
avg=$(echo "scale=3;($sum / $index)" | bc -l)
diff --git a/cpufreq/cpufreq_07.sh b/cpufreq/cpufreq_07.sh
index f5c9e2b..db44309 100755
--- a/cpufreq/cpufreq_07.sh
+++ b/cpufreq/cpufreq_07.sh
@@ -30,7 +30,6 @@
CPUBURN=../utils/cpuburn
check_ondemand() {
-
cpu=$1
maxfreq=$(get_max_frequency $cpu)
minfreq=$(get_min_frequency $cpu)
@@ -40,29 +39,26 @@ check_ondemand() {
# wait for a quescient point
for i in $(seq 1 10); do
+ if [ "$minfreq" -eq "$(get_frequency $cpu)" ]; then
+ $CPUBURN $cpu &
+ pid=$!
- if [ "$minfreq" -eq "$(get_frequency $cpu)" ]; then
-
- $CPUBURN $cpu &
- pid=$!
+ sleep 1
+ wait_latency $cpu
+ curfreq=$(get_frequency $cpu)
+ kill $pid
- sleep 1
- wait_latency $cpu
- curfreq=$(get_frequency $cpu)
- kill $pid
+ check "'ondemand' increase frequency on load" "test
\"$curfreq\" = \"$maxfreq\""
- check "'ondemand' increase frequency on load" "test \"$curfreq\" =
\"$maxfreq\""
+ sleep 1
+ curfreq=$(get_frequency $cpu)
- sleep 1
- curfreq=$(get_frequency $cpu)
+ check "'ondemand' decrease frequency on idle" "test
\"$curfreq\" = \"$minfreq\""
- check "'ondemand' decrease frequency on idle" "test \"$curfreq\" =
\"$minfreq\""
-
- return 0
- fi
-
- sleep 1
+ return 0
+ fi
+ sleep 1
done
log_skip "can not reach a quescient point for 'ondemand'"
diff --git a/cpufreq/cpufreq_08.sh b/cpufreq/cpufreq_08.sh
index 7821897..2a65aa5 100755
--- a/cpufreq/cpufreq_08.sh
+++ b/cpufreq/cpufreq_08.sh
@@ -48,7 +48,6 @@ check_frequency() {
}
check_userspace() {
-
cpu=$1
maxfreq=$(get_max_frequency $cpu)
minfreq=$(get_min_frequency $cpu)
diff --git a/cpufreq/cpufreq_09.sh b/cpufreq/cpufreq_09.sh
index 9135fd5..e630ae2 100755
--- a/cpufreq/cpufreq_09.sh
+++ b/cpufreq/cpufreq_09.sh
@@ -30,7 +30,6 @@
CPUBURN=../utils/cpuburn
check_powersave() {
-
cpu=$1
minfreq=$(get_min_frequency $cpu)
curfreq=$(get_frequency $cpu)
diff --git a/cpufreq/cpufreq_sanity.sh b/cpufreq/cpufreq_sanity.sh
index 3ff42cd..41fa994 100755
--- a/cpufreq/cpufreq_sanity.sh
+++ b/cpufreq/cpufreq_sanity.sh
@@ -32,7 +32,6 @@ if [ $? -ne 0 ]; then
fi
check_cpufreq_sysfs_entry() {
-
dirpath=$CPU_PATH/cpufreq
if [ ! -d "$dirpath" ]; then
diff --git a/cpuhotplug/cpuhotplug_02.sh b/cpuhotplug/cpuhotplug_02.sh
index c21d1b6..67f27f4 100755
--- a/cpuhotplug/cpuhotplug_02.sh
+++ b/cpuhotplug/cpuhotplug_02.sh
@@ -33,7 +33,7 @@ check_state() {
shift 1
if [ "$cpu" = "cpu0" ]; then
- is_cpu0_hotplug_allowed $hotplug_allow_cpu0 || return 0
+ is_cpu0_hotplug_allowed $hotplug_allow_cpu0 || return 0
fi
set_offline $cpu
@@ -41,8 +41,8 @@ check_state() {
check "$cpu is offline" "test $state -eq 0"
if [ $? -ne 0 ]; then
- set_online $cpu
- return 1
+ set_online $cpu
+ return 1
fi
set_online $cpu
@@ -50,7 +50,7 @@ check_state() {
check "$cpu is online" "test $state -eq 1"
if [ $? -ne 0 ]; then
- return 1
+ return 1
fi
return 0
diff --git a/cpuhotplug/cpuhotplug_03.sh b/cpuhotplug/cpuhotplug_03.sh
index 96f4685..3b88b4b 100755
--- a/cpuhotplug/cpuhotplug_03.sh
+++ b/cpuhotplug/cpuhotplug_03.sh
@@ -32,7 +32,7 @@ check_affinity_fails() {
cpuid=$(echo $cpu | awk '{print substr($0,4)}')
if [ "$cpu" = "cpu0" ]; then
- is_cpu0_hotplug_allowed $hotplug_allow_cpu0 || return 0
+ is_cpu0_hotplug_allowed $hotplug_allow_cpu0 || return 0
fi
set_offline $cpu
diff --git a/cpuhotplug/cpuhotplug_04.sh b/cpuhotplug/cpuhotplug_04.sh
index 37a6923..8a1d4d9 100755
--- a/cpuhotplug/cpuhotplug_04.sh
+++ b/cpuhotplug/cpuhotplug_04.sh
@@ -34,7 +34,7 @@ check_task_migrate() {
cpumask=$((1 << cpuid))
if [ "$cpu" = "cpu0" ]; then
- is_cpu0_hotplug_allowed $hotplug_allow_cpu0 || return 0
+ is_cpu0_hotplug_allowed $hotplug_allow_cpu0 || return 0
fi
taskset 0x$cpumask $CPUBURN $cpu &
diff --git a/cpuhotplug/cpuhotplug_05.sh b/cpuhotplug/cpuhotplug_05.sh
index 960150a..0629c45 100755
--- a/cpuhotplug/cpuhotplug_05.sh
+++ b/cpuhotplug/cpuhotplug_05.sh
@@ -32,7 +32,7 @@ check_procinfo() {
cpuid=$(echo $cpu | awk '{print substr($0,4)}')
if [ "$cpu" = "cpu0" ]; then
- is_cpu0_hotplug_allowed $hotplug_allow_cpu0 || return 0
+ is_cpu0_hotplug_allowed $hotplug_allow_cpu0 || return 0
fi
set_offline $cpu
diff --git a/cpuhotplug/cpuhotplug_06.sh b/cpuhotplug/cpuhotplug_06.sh
index 3763274..45067ba 100755
--- a/cpuhotplug/cpuhotplug_06.sh
+++ b/cpuhotplug/cpuhotplug_06.sh
@@ -32,7 +32,7 @@ check_procinfo() {
cpuid=$(echo $cpu | awk '{print substr($0,4)}')
if [ "$cpu" = "cpu0" ]; then
- is_cpu0_hotplug_allowed $hotplug_allow_cpu0 || return 0
+ is_cpu0_hotplug_allowed $hotplug_allow_cpu0 || return 0
fi
set_offline $cpu
diff --git a/cpuhotplug/cpuhotplug_07.sh b/cpuhotplug/cpuhotplug_07.sh
index b0bd50a..c9b4ec9 100755
--- a/cpuhotplug/cpuhotplug_07.sh
+++ b/cpuhotplug/cpuhotplug_07.sh
@@ -33,7 +33,7 @@ check_notification() {
cpu=$1
if [ "$cpu" = "cpu0" ]; then
- is_cpu0_hotplug_allowed $hotplug_allow_cpu0 || return 0
+ is_cpu0_hotplug_allowed $hotplug_allow_cpu0 || return 0
fi
# damn ! udevadm is buffering the output, we have to use a temp file
diff --git a/cpuhotplug/cpuhotplug_08.sh b/cpuhotplug/cpuhotplug_08.sh
index de4fea8..f25ccff 100755
--- a/cpuhotplug/cpuhotplug_08.sh
+++ b/cpuhotplug/cpuhotplug_08.sh
@@ -52,5 +52,5 @@ random_stress() {
check "cpu$cpurand is online" "test $ret -eq 0"
}
-for i in $(seq 1 100); do random_stress ; done
+for i in $(seq 1 100); do random_stress; done
test_status_show
diff --git a/cpuhotplug/cpuhotplug_sanity.sh b/cpuhotplug/cpuhotplug_sanity.sh
index d0d36a3..1d5127f 100755
--- a/cpuhotplug/cpuhotplug_sanity.sh
+++ b/cpuhotplug/cpuhotplug_sanity.sh
@@ -32,7 +32,6 @@ if [ $? -ne 0 ]; then
fi
check_cpuhotplug_sysfs_entry() {
-
cpunum=$(ls $CPU_PATH | grep "cpu[0-9].*" -c)
if [ $cpunum -eq 1 ]; then
@@ -52,6 +51,7 @@ check_cpuhotplug_sysfs_entry() {
fi
fi
done
+
return 1
}
diff --git a/cpuidle/cpuidle_01.sh b/cpuidle/cpuidle_01.sh
index 9db4fa9..9bf1e1e 100755
--- a/cpuidle/cpuidle_01.sh
+++ b/cpuidle/cpuidle_01.sh
@@ -31,25 +31,23 @@ STATES="desc latency name power time usage"
FILES="current_driver current_governor_ro"
check_cpuidle_state_files() {
-
dirpath=$CPU_PATH/$1/cpuidle
shift 1
for i in $(ls -d $dirpath/state*); do
- for j in $STATES; do
- check_file $j $i || return 1
- done
+ for j in $STATES; do
+ check_file $j $i || return 1
+ done
done
return 0
}
check_cpuidle_files() {
-
dirpath=$CPU_PATH/cpuidle
for i in $FILES; do
- check_file $i $CPU_PATH/cpuidle || return 1
+ check_file $i $CPU_PATH/cpuidle || return 1
done
return 0
diff --git a/cpuidle/cpuidle_03.sh b/cpuidle/cpuidle_03.sh
index d82e5e3..146e445 100755
--- a/cpuidle/cpuidle_03.sh
+++ b/cpuidle/cpuidle_03.sh
@@ -40,10 +40,9 @@ restore_cpus() {
}
check_cpuidle_kill() {
-
if [ "$1" = "cpu0" ]; then
- log_skip "skipping cpu0"
- return 0
+ log_skip "skipping cpu0"
+ return 0
fi
set_offline $1
diff --git a/cpuidle/cpuidle_sanity.sh b/cpuidle/cpuidle_sanity.sh
index 36aba5c..d615d96 100755
--- a/cpuidle/cpuidle_sanity.sh
+++ b/cpuidle/cpuidle_sanity.sh
@@ -32,7 +32,6 @@ if [ $? -ne 0 ]; then
fi
check_cpuidle_sysfs_entry() {
-
dirpath=$CPU_PATH/cpuidle
test -d $dirpath
diff --git a/cputopology/cputopology_01.sh b/cputopology/cputopology_01.sh
index 1bb925b..cab757d 100755
--- a/cputopology/cputopology_01.sh
+++ b/cputopology/cputopology_01.sh
@@ -28,7 +28,6 @@
. ../include/functions.sh
check_physical_package_id() {
-
package_id=$CPU_PATH/$1/topology/physical_package_id
val=$(cat $package_id)
diff --git a/include/functions.sh b/include/functions.sh
index 4486da8..3c3687e 100644
--- a/include/functions.sh
+++ b/include/functions.sh
@@ -27,7 +27,6 @@
CPU_PATH="/sys/devices/system/cpu"
TEST_NAME=$(basename ${0%.sh})
-PREFIX=$TEST_NAME
INC=0
cpus=$(ls $CPU_PATH | grep "cpu[0-9].*")
pass_count=0
@@ -96,21 +95,19 @@ log_skip() {
}
for_each_cpu() {
-
cpu_func=$1
shift 1
for cpu in $cpus; do
- INC=0
- CPU=/$cpu
- $cpu_func $cpu $@
+ INC=0
+ CPU=/$cpu
+ $cpu_func $cpu $@
done
return 0
}
for_each_governor() {
-
gov_cpu=$1
gov_func=$2
cpufreq_dirpath=$CPU_PATH/$gov_cpu/cpufreq
@@ -118,14 +115,13 @@ for_each_governor() {
shift 2
for governor in $governors; do
- $gov_func $gov_cpu $governor $@
+ $gov_func $gov_cpu $governor $@
done
return 0
}
for_each_frequency() {
-
freq_cpu=$1
freq_func=$2
cpufreq_dirpath=$CPU_PATH/$freq_cpu/cpufreq
@@ -133,14 +129,13 @@ for_each_frequency() {
shift 2
for frequency in $frequencies; do
- $freq_func $freq_cpu $frequency $@
+ $freq_func $freq_cpu $frequency $@
done
return 0
}
set_governor() {
-
gov_cpu=$1
scaling_gov_dirpath=$CPU_PATH/$gov_cpu/cpufreq/scaling_governor
newgov=$2
@@ -149,7 +144,6 @@ set_governor() {
}
get_governor() {
-
gov_cpu=$1
scaling_gov_dirpath=$CPU_PATH/$gov_cpu/cpufreq/scaling_governor
@@ -163,28 +157,27 @@ wait_latency() {
# consider per-policy governor case
if [ -e $CPU_PATH/$wait_latency_cpu/cpufreq/$gov ]; then
- sampling_rate=$(cat
$CPU_PATH/$wait_latency_cpu/cpufreq/$gov/sampling_rate)
+ sampling_rate=$(cat
$CPU_PATH/$wait_latency_cpu/cpufreq/$gov/sampling_rate)
elif [ -e $CPU_PATH/cpufreq/$gov/sampling_rate ]; then
sampling_rate=$(cat $CPU_PATH/cpufreq/$gov/sampling_rate)
else
sampling_rate=0
fi
+
sampling_rate=$((sampling_rate * 1000)) # unit nsec
latency=$(cat $cpufreq_dirpath/cpuinfo_transition_latency)
if [ $? -ne 0 ]; then
- return 1
+ return 1
fi
nrfreq=$(cat $cpufreq_dirpath/scaling_available_frequencies | wc -w)
if [ $? -ne 0 ]; then
- return 1
+ return 1
fi
nrfreq=$((nrfreq + 1))
-
sleep_time=$(($latency + $sampling_rate))
-
$nanosleep $(($nrfreq * $sleep_time))
}
@@ -195,21 +188,20 @@ frequnit() {
ghz_value=$(echo "($ghz > 1.0)" | bc -l)
if [ "$ghz_value" = "1" ]; then
- echo $ghz GHz
- return 0
+ echo "$ghz GHz"
+ return 0
fi
mhz_value=$(echo "($mhz > 1.0)" | bc -l)
if [ "$mhz_value" = "1" ];then
- echo $mhz MHz
- return 0
+ echo "$mhz MHz"
+ return 0
fi
- echo $freq KHz
+ echo "$freq KHz"
}
set_frequency() {
-
freq_cpu=$1
cpufreq_dirpath=$CPU_PATH/$freq_cpu/cpufreq
newfreq=$2
@@ -242,7 +234,7 @@ set_online() {
current_cpu_path=$CPU_PATH/$current_cpu
if [ "$current_cpu" = "cpu0" ]; then
- return 0
+ return 0
fi
echo 1 > $current_cpu_path/online
@@ -253,7 +245,7 @@ set_offline() {
current_cpu_path=$CPU_PATH/$current_cpu
if [ "$current_cpu" = "cpu0" ]; then
- return 0
+ return 0
fi
echo 0 > $current_cpu_path/online
@@ -267,7 +259,6 @@ get_online() {
}
check() {
-
check_descr=$1
check_func=$2
shift 2;
@@ -276,8 +267,8 @@ check() {
$check_func $@
if [ $? -ne 0 ]; then
- log_end "Err"
- return 1
+ log_end "Err"
+ return 1
fi
log_end "Ok"
@@ -298,16 +289,15 @@ check_cpufreq_files() {
shift 1
for i in $@; do
- check_file $i $cpufreq_files_dir || return 1
+ check_file $i $cpufreq_files_dir || return 1
done
return 0
}
check_sched_mc_files() {
-
for i in $@; do
- check_file $i $CPU_PATH || return 1
+ check_file $i $CPU_PATH || return 1
done
return 0
@@ -319,73 +309,69 @@ check_topology_files() {
shift 1
for i in $@; do
- check_file $i $topology_files_dir || return 1
+ check_file $i $topology_files_dir || return 1
done
return 0
}
check_cpuhotplug_files() {
-
cpuhotplug_files_dir=$CPU_PATH/$1
shift 1
for i in $@; do
- if [ `echo $cpuhotplug_files_dir | grep -c "cpu0"` -eq 1 ]; then
- if [ $hotplug_allow_cpu0 -eq 0 ]; then
- continue
- fi
- fi
+ if [ `echo $cpuhotplug_files_dir | grep -c "cpu0"` -eq 1 ]; then
+ if [ $hotplug_allow_cpu0 -eq 0 ]; then
+ continue
+ fi
+ fi
+
+ check_file $i $cpuhotplug_files_dir || return 1
- check_file $i $cpuhotplug_files_dir || return 1
done
return 0
}
save_governors() {
-
index=0
for cpu in $cpus; do
- scaling_gov_value=$(cat $CPU_PATH/$cpu/cpufreq/scaling_governor)
- eval $gov_array$index=$scaling_gov_value
- eval export $gov_array$index
- index=$((index + 1))
+ scaling_gov_value=$(cat $CPU_PATH/$cpu/cpufreq/scaling_governor)
+ eval $gov_array$index=$scaling_gov_value
+ eval export $gov_array$index
+ index=$((index + 1))
done
}
restore_governors() {
-
index=0
for cpu in $cpus; do
- oldgov=$(eval echo \$$gov_array$index)
- echo $oldgov > $CPU_PATH/$cpu/cpufreq/scaling_governor
- index=$((index + 1))
+ oldgov=$(eval echo \$$gov_array$index)
+ echo $oldgov > $CPU_PATH/$cpu/cpufreq/scaling_governor
+ index=$((index + 1))
done
}
save_frequencies() {
-
index=0
for cpu in $cpus; do
- freq_value=$(cat $CPU_PATH/$cpu/cpufreq/scaling_cur_freq)
- eval $freq_array$index=$freq_value
- eval export $freq_array$index
- index=$((index + 1))
+ freq_value=$(cat $CPU_PATH/$cpu/cpufreq/scaling_cur_freq)
+ eval $freq_array$index=$freq_value
+ eval export $freq_array$index
+ index=$((index + 1))
done
}
restore_frequencies() {
-
index=0
for cpu in $cpus; do
- oldfreq=$(eval echo \$$freq_array$index)
- echo $oldfreq > $CPU_PATH/$cpu/cpufreq/scaling_setspeed
- index=$((index + 1))
+ oldfreq=$(eval echo \$$freq_array$index)
+ echo $oldfreq > $CPU_PATH/$cpu/cpufreq/scaling_setspeed
+ index=$((index + 1))
done
}
@@ -414,6 +400,7 @@ is_root() {
# for android
ret=$(id | sed -n 's/uid=//p' | sed -n 's/(root)
[a-z]*=[0-9]*(log)//p')
fi
+
return $ret
}
@@ -421,8 +408,8 @@ is_cpu0_hotplug_allowed() {
status=$1
if [ $status -eq 1 ]; then
- return 0
+ return 0
else
- return 1
+ return 1
fi
}
diff --git a/include/suspend_functions.sh b/include/suspend_functions.sh
index 49e1c01..d0693fe 100644
--- a/include/suspend_functions.sh
+++ b/include/suspend_functions.sh
@@ -70,7 +70,8 @@ setup_wakeup_timer ()
echo "+$timeout" >"$ctl"
return 0
fi
- ctl='/proc/acpi/alarm'
+
+ ctl='/proc/acpi/alarm'
if [ -f "$ctl" ]; then
echo `date '+%F %H:%M:%S' -d '+ '$timeout' seconds'` >"$ctl"
return 0
diff --git a/include/thermal_functions.sh b/include/thermal_functions.sh
index 3b6cfd3..d8f8350 100644
--- a/include/thermal_functions.sh
+++ b/include/thermal_functions.sh
@@ -54,13 +54,12 @@ check_valid_temp() {
}
for_each_thermal_zone() {
-
thermal_func=$1
shift 1
for thermal_zone in $thermal_zones; do
- INC=0
- $thermal_func $thermal_zone $@
+ INC=0
+ $thermal_func $thermal_zone $@
done
return 0
@@ -71,43 +70,45 @@ get_total_trip_point_of_zone() {
zone_path=$THERMAL_PATH/$zone
count=0
shift 1
+
trips=$(ls $zone_path | grep "trip_point_['$MAX_ZONE']_temp")
for trip in $trips; do
- count=$((count + 1))
+ count=$((count + 1))
done
+
return $count
}
for_each_trip_point_of_zone() {
-
zone_path=$THERMAL_PATH/$1
count=0
func=$2
zone_name=$1
shift 2
+
trips=$(ls $zone_path | grep "trip_point_['$MAX_ZONE']_temp")
for trip in $trips; do
- $func $zone_name $count
- count=$((count + 1))
+ $func $zone_name $count
+ count=$((count + 1))
done
+
return 0
}
for_each_binding_of_zone() {
-
zone_path=$THERMAL_PATH/$1
count=0
func=$2
zone_name=$1
shift 2
+
trips=$(ls $zone_path | grep "cdev['$MAX_CDEV']_trip_point")
for trip in $trips; do
- $func $zone_name $count
- count=$((count + 1))
+ $func $zone_name $count
+ count=$((count + 1))
done
return 0
-
}
check_valid_binding() {
@@ -156,25 +157,23 @@ validate_trip_level() {
}
for_each_cooling_device() {
-
cdev_func=$1
shift 1
cooling_devices=$(ls $THERMAL_PATH | grep "cooling_device['$MAX_CDEV']")
if [ "$cooling_devices" = "" ]; then
- log_skip "no cooling devices"
- return 0
+ log_skip "no cooling devices"
+ return 0
fi
for cooling_device in $cooling_devices; do
- INC=0
- $cdev_func $cooling_device $@
+ INC=0
+ $cdev_func $cooling_device $@
done
return 0
}
check_scaling_freq() {
-
before_freq_list=$1
after_freq_list=$2
shift 2
@@ -191,6 +190,7 @@ check_scaling_freq() {
index=$((index + 1))
done
+
return $flag
}
@@ -203,24 +203,24 @@ store_scaling_maxfreq() {
eval echo $scaling_freq_array$index
index=$((index + 1))
done
+
return 0
}
get_trip_id() {
-
trip_name=$1
shift 1
id1=$(echo $trip_name|cut -c12)
id2=$(echo $trip_name|cut -c13)
if [ $id2 != "_" ]; then
- id1=$(($id2 + 10*$id1))
+ id1=$(($id2 + 10*$id1))
fi
+
return $id1
}
disable_all_thermal_zones() {
-
index=0
for thermal_zone in $thermal_zones; do
@@ -228,13 +228,13 @@ disable_all_thermal_zones() {
eval $mode_array$index=$mode
eval export $mode_array$index
index=$((index + 1))
- echo -n "disabled" > $THERMAL_PATH/$thermal_zone/mode
+ echo -n "disabled" > $THERMAL_PATH/$thermal_zone/mode
done
+
return 0
}
enable_all_thermal_zones() {
-
index=0
for thermal_zone in $thermal_zones; do
@@ -242,6 +242,7 @@ enable_all_thermal_zones() {
echo $mode > $THERMAL_PATH/$thermal_zone/mode
index=$((index + 1))
done
+
return 0
}
@@ -282,12 +283,11 @@ kill_glmark2() {
fi
if [ "$gpu_pid" -ne 0 ]; then
- kill -9 $gpu_pid
+ kill -9 $gpu_pid
fi
}
set_thermal_governors() {
-
gov=$1
index=0
@@ -298,11 +298,11 @@ set_thermal_governors() {
index=$((index + 1))
echo $gov > $THERMAL_PATH/$thermal_zone/policy
done
+
return 0
}
restore_thermal_governors() {
-
index=0
for thermal_zone in $thermal_zones; do
@@ -310,5 +310,6 @@ restore_thermal_governors() {
echo $old_policy > $THERMAL_PATH/$thermal_zone/policy
index=$((index + 1))
done
+
return 0
}
diff --git a/powertop/powertop_01.sh b/powertop/powertop_01.sh
index 5fab897..4e9ff71 100755
--- a/powertop/powertop_01.sh
+++ b/powertop/powertop_01.sh
@@ -28,7 +28,6 @@
. ../include/functions.sh
run_powertop() {
-
bin_path=`command -v powertop`
report=csv
seconds=10
diff --git a/powertop/powertop_sanity.sh b/powertop/powertop_sanity.sh
index 4ac7fec..924e022 100755
--- a/powertop/powertop_sanity.sh
+++ b/powertop/powertop_sanity.sh
@@ -26,7 +26,6 @@
. ../include/functions.sh
check_powertop() {
-
bin_name=powertop
command -v $bin_name >/dev/null 2>&1 && return 1 || return 0
diff --git a/suspend/suspend_02.sh b/suspend/suspend_02.sh
index 9113434..f0428b8 100755
--- a/suspend/suspend_02.sh
+++ b/suspend/suspend_02.sh
@@ -25,7 +25,6 @@
# URL :
https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/PmQaSpecification#suspend_02
-
. ../include/functions.sh
. ../include/suspend_functions.sh
@@ -47,4 +46,3 @@ fi
restore_trace
test_status_show
rm -f "$LOGFILE"
-
diff --git a/thermal/thermal_00.sh b/thermal/thermal_00.sh
index 302858f..2c0fe01 100755
--- a/thermal/thermal_00.sh
+++ b/thermal/thermal_00.sh
@@ -29,20 +29,20 @@
. ../include/thermal_functions.sh
check_cooling_device_type() {
- all_zones=$(ls $THERMAL_PATH | grep "cooling_device['$MAX_CDEV']")
+ cooling_devices=$(ls $THERMAL_PATH | grep "cooling_device['$MAX_CDEV']")
echo "Cooling Device list:"
- for i in $all_zones; do
- type=$(cat $THERMAL_PATH/$i/type)
- echo "- $type"
+ for cooling_device in $cooling_devices; do
+ type=$(cat $THERMAL_PATH/$cooling_device/type)
+ echo "- $type"
done
}
check_thermal_zone_type() {
- all_zones=$(ls $THERMAL_PATH | grep "thermal_zone['$MAX_ZONE']")
+ thermal_zones=$(ls $THERMAL_PATH | grep "thermal_zone['$MAX_ZONE']")
echo "Thermal Zone list:"
- for i in $all_zones; do
- type=$(cat $THERMAL_PATH/$i/type)
- echo "- $type"
+ for thermal_zone in $thermal_zones; do
+ type=$(cat $THERMAL_PATH/$thermal_zone/type)
+ echo "- $type"
done
}
diff --git a/thermal/thermal_01.sh b/thermal/thermal_01.sh
index 94bb26b..eafe1fa 100755
--- a/thermal/thermal_01.sh
+++ b/thermal/thermal_01.sh
@@ -35,7 +35,7 @@ check_thermal_zone_attributes() {
dirpath=$THERMAL_PATH/$zone_name
shift 1
for attribute in $ATTRIBUTES; do
- check_file $attribute $dirpath || return 1
+ check_file $attribute $dirpath || return 1
done
check_valid_temp "temp" $zone_name || return 1
@@ -59,26 +59,21 @@ check_thermal_zone_mode() {
}
check_thermal_zone_trip_level() {
-
thermal_zones=$(ls $THERMAL_PATH | grep "thermal_zone['$MAX_ZONE']")
for thermal_zone in $thermal_zones; do
- for_each_trip_point_of_zone $thermal_zone "validate_trip_level" ||
return 1
+ for_each_trip_point_of_zone $thermal_zone "validate_trip_level" ||
return 1
done
}
check_thermal_zone_bindings() {
-
thermal_zones=$(ls $THERMAL_PATH | grep "thermal_zone['$MAX_ZONE']")
for thermal_zone in $thermal_zones; do
- for_each_binding_of_zone $thermal_zone "validate_trip_bindings" ||
return 1
+ for_each_binding_of_zone $thermal_zone "validate_trip_bindings" ||
return 1
done
}
for_each_thermal_zone check_thermal_zone_attributes
-
for_each_thermal_zone check_thermal_zone_mode
-
check_thermal_zone_trip_level
-
check_thermal_zone_bindings
test_status_show
diff --git a/thermal/thermal_02.sh b/thermal/thermal_02.sh
index 9ec02ab..9bf1875 100755
--- a/thermal/thermal_02.sh
+++ b/thermal/thermal_02.sh
@@ -36,7 +36,7 @@ check_cooling_device_attributes() {
shift 1
for attribute in $CDEV_ATTRIBUTES; do
- check_file $attribute $cdev_name_dir || return 1
+ check_file $attribute $cdev_name_dir || return 1
done
}
@@ -45,25 +45,24 @@ check_cooling_device_states() {
cdev_name=$1
cdev_name_dir=$THERMAL_PATH/$cdev_name
shift 1
+
max_state=$(cat $cdev_name_dir/max_state)
prev_state_val=$(cat $cdev_name_dir/cur_state)
count=0
cur_state_val=0
while (test $count -le $max_state); do
- echo $count > $cdev_name_dir/cur_state
- cur_state_val=$(cat $cdev_name_dir/cur_state)
- check "$cdev_name with cur_state=$count"\
+ echo $count > $cdev_name_dir/cur_state
+ cur_state_val=$(cat $cdev_name_dir/cur_state)
+ check "$cdev_name with cur_state=$count"\
"test $cur_state_val -eq $count" || return 1
- count=$((count+1))
+ count=$((count+1))
done
+
echo $prev_state_val > $cdev_name_dir/cur_state
}
set_thermal_governors user_space
-
for_each_cooling_device check_cooling_device_attributes
for_each_cooling_device check_cooling_device_states
-
restore_thermal_governors
-
test_status_show
diff --git a/thermal/thermal_03.sh b/thermal/thermal_03.sh
index 9704b74..acc33f6 100755
--- a/thermal/thermal_03.sh
+++ b/thermal/thermal_03.sh
@@ -33,14 +33,14 @@ cpu_pid=0
heater_kill() {
if [ $cpu_pid -ne 0 ]; then
- kill -9 $cpu_pid
+ kill -9 $cpu_pid
fi
kill_glmark2
}
check_temperature_change() {
- dirpath=$THERMAL_PATH/$1
zone_name=$1
+ dirpath=$THERMAL_PATH/$zone_name
shift 1
init_temp=$(cat $dirpath/temp)
diff --git a/thermal/thermal_04.sh b/thermal/thermal_04.sh
index b290c5a..c571534 100755
--- a/thermal/thermal_04.sh
+++ b/thermal/thermal_04.sh
@@ -32,23 +32,24 @@ pid=0
heater_kill() {
if [ $pid -ne 0 ]; then
- kill -9 $pid
+ kill -9 $pid
fi
}
verify_cooling_device_temp_change() {
- dirpath=$THERMAL_PATH/$1
cdev_name=$1
+ dirpath=$THERMAL_PATH/$cdev_name
shift 1
+
tzonepath=$THERMAL_PATH/thermal_zone0
test -d $tzonepath
if [ $? -ne 0 ] ; then
- echo "No thermal zone present"
- return 1;
+ echo "No thermal zone present"
+ return 1
fi
+
max_state=$(cat $dirpath/max_state)
prev_state_val=$(cat $dirpath/cur_state)
-
count=1
cur_state_val=0
init_temp=0
@@ -59,18 +60,19 @@ verify_cooling_device_temp_change() {
test $pid -eq 0 && return
while (test $count -le $max_state); do
- echo 0 > $dirpath/cur_state
- sleep 5
- init_temp=$(cat $tzonepath/temp)
+ echo 0 > $dirpath/cur_state
+ sleep 5
+ init_temp=$(cat $tzonepath/temp)
- echo $count > $dirpath/cur_state
- sleep 5
- final_temp=$(cat $tzonepath/temp)
- cool_temp=$(($init_temp - $final_temp))
- check "$cdev_name:state=$count effective cool=$cool_temp "\
+ echo $count > $dirpath/cur_state
+ sleep 5
+ final_temp=$(cat $tzonepath/temp)
+ cool_temp=$(($init_temp - $final_temp))
+ check "$cdev_name:state=$count effective cool=$cool_temp "\
"test $cool_temp -ge 0"
- count=$((count+1))
+ count=$((count + 1))
done
+
heater_kill
echo $prev_state_val > $dirpath/cur_state
}
@@ -78,9 +80,6 @@ verify_cooling_device_temp_change() {
trap "heater_kill; sigtrap" HUP INT TERM
set_thermal_governors user_space
-
for_each_cooling_device verify_cooling_device_temp_change
-
restore_thermal_governors
-
test_status_show
diff --git a/thermal/thermal_05.sh b/thermal/thermal_05.sh
index 2e7f080..6afa77d 100755
--- a/thermal/thermal_05.sh
+++ b/thermal/thermal_05.sh
@@ -29,8 +29,8 @@
. ../include/thermal_functions.sh
verify_cpufreq_cooling_device_action() {
- dirpath=$THERMAL_PATH/$1
cdev_name=$1
+ dirpath=$THERMAL_PATH/$cdev_name
shift 1
cpufreq_cdev=$(cat $dirpath/type)
@@ -50,27 +50,29 @@ verify_cpufreq_cooling_device_action() {
change=0
while (test $count -le $max_state); do
- echo 0 > $dirpath/cur_state
- sleep 1
+ echo 0 > $dirpath/cur_state
+ sleep 1
- store_scaling_maxfreq
- before_scale_max=$scale_freq
+ store_scaling_maxfreq
+ before_scale_max=$scale_freq
- echo $count > $dirpath/cur_state
- sleep 1
+ echo $count > $dirpath/cur_state
+ sleep 1
- store_scaling_maxfreq
- after_scale_max=$scale_freq
+ store_scaling_maxfreq
+ after_scale_max=$scale_freq
- check_scaling_freq $before_scale_max $after_scale_max
- change=$?
+ check_scaling_freq $before_scale_max $after_scale_max
+ change=$?
- check "cdev=$cdev_name state=$count" "test $change -ne 0"
+ check "cdev=$cdev_name state=$count" "test $change -ne 0"
- count=$((count+1))
+ count=$((counti + 1))
done
+
enable_all_thermal_zones
echo $prev_state_val > $dirpath/cur_state
}
+
for_each_cooling_device verify_cpufreq_cooling_device_action
test_status_show
diff --git a/thermal/thermal_06.sh b/thermal/thermal_06.sh
index b511329..f090528 100755
--- a/thermal/thermal_06.sh
+++ b/thermal/thermal_06.sh
@@ -35,7 +35,7 @@ trip_cross_array="trip_cross"
heater_kill() {
if [ $cpu_pid -ne 0 ]; then
- kill -9 $cpu_pid
+ kill -9 $cpu_pid
fi
kill_glmark2
}
@@ -67,35 +67,40 @@ check_trip_point_change() {
eval export $trip_cross_array$index
index=$((index + 1))
done
- while (test $count -lt $TEST_LOOP); do
- index=0
- sleep 1
- for trip in $trip_point_temps; do
- cur_temp=$(cat $thermal_zone_path/temp)
- trip_temp=$(cat $thermal_zone_path/$trip)
- if [ $cur_temp -gt $trip_temp ]; then
- value=$(eval echo \$$trip_cross_array$index)
- value=$((value + 1))
- eval $trip_cross_array$index=$value
- eval export $trip_cross_array$index
- fi
- index=$((index + 1))
- done
- count=$((count + 1))
+ while (test $count -lt $TEST_LOOP); do
+ index=0
+ sleep 1
+
+ for trip in $trip_point_temps; do
+ cur_temp=$(cat $thermal_zone_path/temp)
+ trip_temp=$(cat $thermal_zone_path/$trip)
+ if [ $cur_temp -gt $trip_temp ]; then
+ value=$(eval echo \$$trip_cross_array$index)
+ value=$((value + 1))
+ eval $trip_cross_array$index=$value
+ eval export $trip_cross_array$index
+ fi
+
+ index=$((index + 1))
+ done
+
+ count=$((count + 1))
done
+
index=0
for trip in $trip_point_temps; do
- get_trip_id $trip
- trip_id=$?
- trip_type=$(cat $thermal_zone_path/trip_point_"$trip_id"_type)
- trip_temp=$(cat $thermal_zone_path/$trip)
+ get_trip_id $trip
+ trip_id=$?
+ trip_type=$(cat $thermal_zone_path/trip_point_"$trip_id"_type)
+ trip_temp=$(cat $thermal_zone_path/$trip)
- if [ $trip_type != "critical" ]; then
- count=$(eval echo \$$trip_cross_array$index)
- check "$trip:$trip_temp crossed" "test $count -gt 0"
- fi
- index=$((index + 1))
+ if [ $trip_type != "critical" ]; then
+ count=$(eval echo \$$trip_cross_array$index)
+ check "$trip:$trip_temp crossed" "test $count -gt 0"
+ fi
+
+ index=$((index + 1))
done
heater_kill
diff --git a/thermal/thermal_sanity.sh b/thermal/thermal_sanity.sh
index 1e5b5af..4b76c88 100755
--- a/thermal/thermal_sanity.sh
+++ b/thermal/thermal_sanity.sh
@@ -33,7 +33,6 @@ if [ $? -ne 0 ]; then
fi
check_thermal_zone() {
-
test -d $THERMAL_PATH
if [ $? -ne 0 ]; then
echo "thermal zone is not available. Skipping all tests"
--
1.7.9.5
_______________________________________________
linaro-dev mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/linaro-dev