aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLisa Nguyen <lisa.nguyen@linaro.org>2015-01-25 17:46:40 -0800
committerLisa Nguyen <lisa.nguyen@linaro.org>2015-02-02 13:52:19 -0800
commit4e0b59aa1b039063092a3741a1fa15511529bb96 (patch)
treef8f032cebaaa69b1126a91339c002a30dd92019a
parent5a0c2bab0fda7ee5095770b07b7187e102d4b668 (diff)
Remove local keywords and uninitialized variables
Remove keywords such as "let", "typeset", and "local" that are defined in BASH. Also, clean up any unused variables in the process. Reviewed-by: Amit Kucheria <amit.kucheria@linaro.org> Signed-off-by: Lisa Nguyen <lisa.nguyen@linaro.org>
-rwxr-xr-xcpufreq/cpufreq_03.sh6
-rwxr-xr-xcpufreq/cpufreq_04.sh8
-rwxr-xr-xcpufreq/cpufreq_05.sh10
-rwxr-xr-xcpufreq/cpufreq_06.sh10
-rwxr-xr-xcpufreq/cpufreq_07.sh9
-rwxr-xr-xcpufreq/cpufreq_08.sh14
-rwxr-xr-xcpufreq/cpufreq_09.sh6
-rwxr-xr-xcpufreq/cpufreq_sanity.sh2
-rwxr-xr-xcpuhotplug/1_sanity_check.sh2
-rwxr-xr-xcpuhotplug/cpuhotplug_02.sh5
-rwxr-xr-xcpuhotplug/cpuhotplug_03.sh7
-rwxr-xr-xcpuhotplug/cpuhotplug_04.sh10
-rwxr-xr-xcpuhotplug/cpuhotplug_05.sh5
-rwxr-xr-xcpuhotplug/cpuhotplug_06.sh5
-rwxr-xr-xcpuhotplug/cpuhotplug_07.sh6
-rwxr-xr-xcpuhotplug/cpuhotplug_08.sh5
-rwxr-xr-xcpuhotplug/z_sanity_check.sh2
-rwxr-xr-xcpuidle/cpuidle_01.sh4
-rwxr-xr-xcpuidle/cpuidle_sanity.sh2
-rwxr-xr-xcputopology/cputopology_01.sh4
-rw-r--r--include/functions.sh108
-rw-r--r--include/suspend_functions.sh10
-rw-r--r--include/thermal_functions.sh109
-rwxr-xr-xpowertop/powertop_01.sh14
-rwxr-xr-xpowertop/powertop_sanity.sh2
-rwxr-xr-xsuspend/suspend_05.sh8
-rwxr-xr-xthermal/thermal_00.sh8
-rwxr-xr-xthermal/thermal_01.sh18
-rwxr-xr-xthermal/thermal_02.sh16
-rwxr-xr-xthermal/thermal_03.sh8
-rwxr-xr-xthermal/thermal_04.sh20
-rwxr-xr-xthermal/thermal_05.sh18
-rwxr-xr-xthermal/thermal_06.sh18
33 files changed, 224 insertions, 255 deletions
diff --git a/cpufreq/cpufreq_03.sh b/cpufreq/cpufreq_03.sh
index acd1c2a..32e2114 100755
--- a/cpufreq/cpufreq_03.sh
+++ b/cpufreq/cpufreq_03.sh
@@ -29,12 +29,12 @@
check_governor() {
- local cpu=$1
- local newgov=$2
+ cpu=$1
+ newgov=$2
shift 2
- local oldgov=$(get_governor $cpu)
+ oldgov=$(get_governor $cpu)
set_governor $cpu $newgov
diff --git a/cpufreq/cpufreq_04.sh b/cpufreq/cpufreq_04.sh
index 98b0fa1..6813a2a 100755
--- a/cpufreq/cpufreq_04.sh
+++ b/cpufreq/cpufreq_04.sh
@@ -29,13 +29,13 @@
check_frequency() {
- local cpu=$1
- local newfreq=$2
+ cpu=$1
+ newfreq=$2
shift 2
- local oldgov=$(get_governor $cpu)
- local oldfreq=$(get_frequency $cpu)
+ oldgov=$(get_governor $cpu)
+ oldfreq=$(get_frequency $cpu)
set_governor $cpu userspace
set_frequency $cpu $newfreq
diff --git a/cpufreq/cpufreq_05.sh b/cpufreq/cpufreq_05.sh
index f74a23e..862d310 100755
--- a/cpufreq/cpufreq_05.sh
+++ b/cpufreq/cpufreq_05.sh
@@ -32,23 +32,23 @@ save_governors
trap restore_governors HUP INT TERM
switch_ondemand() {
- local cpu=$1
+ cpu=$1
set_governor $cpu 'ondemand'
}
switch_conservative() {
- local cpu=$1
+ cpu=$1
set_governor $cpu 'conservative'
}
switch_userspace() {
- local cpu=$1
+ cpu=$1
set_governor $cpu 'userspace'
}
check_governor() {
- local cpu=$1
- local gov=$2
+ cpu=$1
+ gov=$2
if [ -d $CPU_PATH/$cpu/cpufreq/$gov ]; then
GOV_PATH=$CPU_PATH/$cpu/cpufreq/$gov
diff --git a/cpufreq/cpufreq_06.sh b/cpufreq/cpufreq_06.sh
index 803b937..a6fbd15 100755
--- a/cpufreq/cpufreq_06.sh
+++ b/cpufreq/cpufreq_06.sh
@@ -31,8 +31,8 @@ CPUCYCLE=../utils/cpucycle
compute_freq_ratio() {
- local cpu=$1
- local freq=$2
+ cpu=$1
+ freq=$2
set_frequency $cpu $freq
@@ -75,8 +75,8 @@ __check_freq_deviation() {
check_freq_deviation() {
- local cpu=$1
- local freq=$2
+ cpu=$1
+ freq=$2
check "deviation for frequency $(frequnit $freq)" __check_freq_deviation
@@ -84,7 +84,7 @@ check_freq_deviation() {
check_deviation() {
- local cpu=$1
+ cpu=$1
set_governor $cpu userspace
diff --git a/cpufreq/cpufreq_07.sh b/cpufreq/cpufreq_07.sh
index 9f41c49..f5c9e2b 100755
--- a/cpufreq/cpufreq_07.sh
+++ b/cpufreq/cpufreq_07.sh
@@ -31,11 +31,10 @@ CPUBURN=../utils/cpuburn
check_ondemand() {
- local cpu=$1
- local maxfreq=$(get_max_frequency $cpu)
- local minfreq=$(get_min_frequency $cpu)
- local curfreq=$(get_frequency $cpu)
- local pid=
+ cpu=$1
+ maxfreq=$(get_max_frequency $cpu)
+ minfreq=$(get_min_frequency $cpu)
+ curfreq=$(get_frequency $cpu)
set_governor $cpu ondemand
diff --git a/cpufreq/cpufreq_08.sh b/cpufreq/cpufreq_08.sh
index 29b2b9f..f81976d 100755
--- a/cpufreq/cpufreq_08.sh
+++ b/cpufreq/cpufreq_08.sh
@@ -30,10 +30,8 @@
CPUBURN=../utils/cpuburn
check_frequency() {
- local cpu=$1
- local freq=$2
- local curfreq=
- local pid=
+ cpu=$1
+ freq=$2
$CPUBURN $cpu &
pid=$!
@@ -54,10 +52,10 @@ check_frequency() {
check_userspace() {
- local cpu=$1
- local maxfreq=$(get_max_frequency $cpu)
- local minfreq=$(get_min_frequency $cpu)
- local curfreq=$(get_frequency $cpu)
+ cpu=$1
+ maxfreq=$(get_max_frequency $cpu)
+ minfreq=$(get_min_frequency $cpu)
+ curfreq=$(get_frequency $cpu)
set_governor $cpu userspace
diff --git a/cpufreq/cpufreq_09.sh b/cpufreq/cpufreq_09.sh
index 746c7de..2ba1652 100755
--- a/cpufreq/cpufreq_09.sh
+++ b/cpufreq/cpufreq_09.sh
@@ -31,9 +31,9 @@ CPUBURN=../utils/cpuburn
check_powersave() {
- local cpu=$1
- local minfreq=$(get_min_frequency $cpu)
- local curfreq=$(get_frequency $cpu)
+ cpu=$1
+ minfreq=$(get_min_frequency $cpu)
+ curfreq=$(get_frequency $cpu)
set_governor $cpu powersave
diff --git a/cpufreq/cpufreq_sanity.sh b/cpufreq/cpufreq_sanity.sh
index 24784f9..6aba317 100755
--- a/cpufreq/cpufreq_sanity.sh
+++ b/cpufreq/cpufreq_sanity.sh
@@ -33,7 +33,7 @@ fi
check_cpufreq_sysfs_entry() {
- local dirpath=$CPU_PATH/cpufreq
+ dirpath=$CPU_PATH/cpufreq
test -d $dirpath
if [ $? -ne 0 ]; then
diff --git a/cpuhotplug/1_sanity_check.sh b/cpuhotplug/1_sanity_check.sh
index 72be60c..634a736 100755
--- a/cpuhotplug/1_sanity_check.sh
+++ b/cpuhotplug/1_sanity_check.sh
@@ -28,7 +28,7 @@
. ../include/functions.sh
sanity_check() {
- local ret=$(cat $CPU_PATH/offline)
+ ret=$(cat $CPU_PATH/offline)
if [ -z "$ret" ]; then
return 0
else
diff --git a/cpuhotplug/cpuhotplug_02.sh b/cpuhotplug/cpuhotplug_02.sh
index 564cb30..2c87861 100755
--- a/cpuhotplug/cpuhotplug_02.sh
+++ b/cpuhotplug/cpuhotplug_02.sh
@@ -28,9 +28,8 @@
. ../include/functions.sh
check_state() {
- local cpu=$1
- local dirpath=$CPU_PATH/$1
- local state=
+ cpu=$1
+ dirpath=$CPU_PATH/$1
shift 1
if [ "$cpu" = "cpu0" ]; then
diff --git a/cpuhotplug/cpuhotplug_03.sh b/cpuhotplug/cpuhotplug_03.sh
index c32f6a4..b506c0d 100755
--- a/cpuhotplug/cpuhotplug_03.sh
+++ b/cpuhotplug/cpuhotplug_03.sh
@@ -28,10 +28,9 @@
. ../include/functions.sh
check_affinity_fails() {
- local cpu=$1
- local cpuid=${cpu:3}
- local dirpath=$CPU_PATH/$1
- local ret=
+ cpu=$1
+ cpuid=${cpu:3}
+ dirpath=$CPU_PATH/$1
if [ "$cpu" = "cpu0" ]; then
is_cpu0_hotplug_allowed $hotplug_allow_cpu0 || return 0
diff --git a/cpuhotplug/cpuhotplug_04.sh b/cpuhotplug/cpuhotplug_04.sh
index 1e3e8c1..228703b 100755
--- a/cpuhotplug/cpuhotplug_04.sh
+++ b/cpuhotplug/cpuhotplug_04.sh
@@ -29,12 +29,10 @@ CPUBURN=../utils/cpuburn
. ../include/functions.sh
check_task_migrate() {
- local cpu=$1
- local cpuid=${cpu:3}
- local cpumask=$((1 << cpuid))
- local dirpath=$CPU_PATH/$1
- local pid=
- local ret=
+ cpu=$1
+ cpuid=${cpu:3}
+ cpumask=$((1 << cpuid))
+ dirpath=$CPU_PATH/$1
if [ "$cpu" = "cpu0" ]; then
is_cpu0_hotplug_allowed $hotplug_allow_cpu0 || return 0
diff --git a/cpuhotplug/cpuhotplug_05.sh b/cpuhotplug/cpuhotplug_05.sh
index 71baf2c..7d755dd 100755
--- a/cpuhotplug/cpuhotplug_05.sh
+++ b/cpuhotplug/cpuhotplug_05.sh
@@ -28,9 +28,8 @@
. ../include/functions.sh
check_procinfo() {
- local cpu=$1
- local cpuid=${cpu:3}
- local ret=
+ cpu=$1
+ cpuid=${cpu:3}
if [ "$cpu" = "cpu0" ]; then
is_cpu0_hotplug_allowed $hotplug_allow_cpu0 || return 0
diff --git a/cpuhotplug/cpuhotplug_06.sh b/cpuhotplug/cpuhotplug_06.sh
index a774438..b0eae44 100755
--- a/cpuhotplug/cpuhotplug_06.sh
+++ b/cpuhotplug/cpuhotplug_06.sh
@@ -28,9 +28,8 @@
. ../include/functions.sh
check_procinfo() {
- local cpu=$1
- local cpuid=${cpu:3}
- local ret=
+ cpu=$1
+ cpuid=${cpu:3}
if [ "$cpu" = "cpu0" ]; then
is_cpu0_hotplug_allowed $hotplug_allow_cpu0 || return 0
diff --git a/cpuhotplug/cpuhotplug_07.sh b/cpuhotplug/cpuhotplug_07.sh
index c1f5e2c..239855f 100755
--- a/cpuhotplug/cpuhotplug_07.sh
+++ b/cpuhotplug/cpuhotplug_07.sh
@@ -29,10 +29,8 @@
TMPFILE=cpuhotplug_07.tmp
check_notification() {
- local cpu=$1
- local cpuid=${cpu:3}
- local pid=
- local ret=
+ cpu=$1
+ cpuid=${cpu:3}
if [ "$cpu" = "cpu0" ]; then
is_cpu0_hotplug_allowed $hotplug_allow_cpu0 || return 0
diff --git a/cpuhotplug/cpuhotplug_08.sh b/cpuhotplug/cpuhotplug_08.sh
index f7e51ce..43948cf 100755
--- a/cpuhotplug/cpuhotplug_08.sh
+++ b/cpuhotplug/cpuhotplug_08.sh
@@ -36,9 +36,8 @@ function randomize() {
}
random_stress() {
- local cpu_present=$(cat /sys/devices/system/cpu/present | cut -d '-' -f 2)
- local cpurand=$(randomize $cpu_present)
- local ret=
+ cpu_present=$(cat /sys/devices/system/cpu/present | cut -d '-' -f 2)
+ cpurand=$(randomize $cpu_present)
# randomize will in range "1-$cpu_present) so cpu0 is ignored
set_offline cpu$cpurand
diff --git a/cpuhotplug/z_sanity_check.sh b/cpuhotplug/z_sanity_check.sh
index c888536..5d5a425 100755
--- a/cpuhotplug/z_sanity_check.sh
+++ b/cpuhotplug/z_sanity_check.sh
@@ -28,7 +28,7 @@
. ../include/functions.sh
sanity_check() {
- local ret=$(cat $CPU_PATH/offline)
+ ret=$(cat $CPU_PATH/offline)
if [ -z "$ret" ]; then
return 0
else
diff --git a/cpuidle/cpuidle_01.sh b/cpuidle/cpuidle_01.sh
index 777cc34..9db4fa9 100755
--- a/cpuidle/cpuidle_01.sh
+++ b/cpuidle/cpuidle_01.sh
@@ -32,7 +32,7 @@ FILES="current_driver current_governor_ro"
check_cpuidle_state_files() {
- local dirpath=$CPU_PATH/$1/cpuidle
+ dirpath=$CPU_PATH/$1/cpuidle
shift 1
for i in $(ls -d $dirpath/state*); do
@@ -46,7 +46,7 @@ check_cpuidle_state_files() {
check_cpuidle_files() {
- local dirpath=$CPU_PATH/cpuidle
+ dirpath=$CPU_PATH/cpuidle
for i in $FILES; do
check_file $i $CPU_PATH/cpuidle || return 1
diff --git a/cpuidle/cpuidle_sanity.sh b/cpuidle/cpuidle_sanity.sh
index 594f891..36aba5c 100755
--- a/cpuidle/cpuidle_sanity.sh
+++ b/cpuidle/cpuidle_sanity.sh
@@ -33,7 +33,7 @@ fi
check_cpuidle_sysfs_entry() {
- local dirpath=$CPU_PATH/cpuidle
+ dirpath=$CPU_PATH/cpuidle
test -d $dirpath
if [ $? -ne 0 ]; then
diff --git a/cputopology/cputopology_01.sh b/cputopology/cputopology_01.sh
index fece00c..1bb925b 100755
--- a/cputopology/cputopology_01.sh
+++ b/cputopology/cputopology_01.sh
@@ -29,8 +29,8 @@
check_physical_package_id() {
- local package_id=$CPU_PATH/$1/topology/physical_package_id
- local val=$(cat $package_id)
+ package_id=$CPU_PATH/$1/topology/physical_package_id
+ val=$(cat $package_id)
check "topology is enabled" "test \"$val\" != \"-1\""
}
diff --git a/include/functions.sh b/include/functions.sh
index 35ca21d..2ffdb36 100644
--- a/include/functions.sh
+++ b/include/functions.sh
@@ -29,7 +29,6 @@ CPU_PATH="/sys/devices/system/cpu"
TEST_NAME=$(basename ${0%.sh})
PREFIX=$TEST_NAME
INC=0
-CPU=
cpus=$(ls $CPU_PATH | grep "cpu[0-9].*")
pass_count=0
fail_count=0
@@ -95,7 +94,7 @@ log_skip() {
for_each_cpu() {
- local func=$1
+ func=$1
shift 1
for cpu in $cpus; do
@@ -109,10 +108,10 @@ for_each_cpu() {
for_each_governor() {
- local cpu=$1
- local func=$2
- local dirpath=$CPU_PATH/$cpu/cpufreq
- local governors=$(cat $dirpath/scaling_available_governors)
+ cpu=$1
+ func=$2
+ dirpath=$CPU_PATH/$cpu/cpufreq
+ governors=$(cat $dirpath/scaling_available_governors)
shift 2
for governor in $governors; do
@@ -124,10 +123,10 @@ for_each_governor() {
for_each_frequency() {
- local cpu=$1
- local func=$2
- local dirpath=$CPU_PATH/$cpu/cpufreq
- local frequencies=$(cat $dirpath/scaling_available_frequencies)
+ cpu=$1
+ func=$2
+ dirpath=$CPU_PATH/$cpu/cpufreq
+ frequencies=$(cat $dirpath/scaling_available_frequencies)
shift 2
for frequency in $frequencies; do
@@ -139,29 +138,25 @@ for_each_frequency() {
set_governor() {
- local cpu=$1
- local dirpath=$CPU_PATH/$cpu/cpufreq/scaling_governor
- local newgov=$2
+ cpu=$1
+ dirpath=$CPU_PATH/$cpu/cpufreq/scaling_governor
+ newgov=$2
echo $newgov > $dirpath
}
get_governor() {
- local cpu=$1
- local dirpath=$CPU_PATH/$cpu/cpufreq/scaling_governor
+ cpu=$1
+ dirpath=$CPU_PATH/$cpu/cpufreq/scaling_governor
cat $dirpath
}
wait_latency() {
- local cpu=$1
- local dirpath=$CPU_PATH/$cpu/cpufreq
- local latency=
- local nrfreq=
- local sampling_rate=
- local sleep_time=
- local gov=$(cat $dirpath/scaling_governor)
+ cpu=$1
+ dirpath=$CPU_PATH/$cpu/cpufreq
+ gov=$(cat $dirpath/scaling_governor)
# consider per-policy governor case
if [ -e $CPU_PATH/$cpu/cpufreq/$gov ]; then
@@ -189,9 +184,9 @@ wait_latency() {
}
frequnit() {
- local freq=$1
- local ghz=$(echo "scale=1;($freq / 1000000)" | bc -l)
- local mhz=$(echo "scale=1;($freq / 1000)" | bc -l)
+ freq=$1
+ ghz=$(echo "scale=1;($freq / 1000000)" | bc -l)
+ mhz=$(echo "scale=1;($freq / 1000)" | bc -l)
res=$(echo "($ghz > 1.0)" | bc -l)
if [ "$res" = "1" ]; then
@@ -210,36 +205,36 @@ frequnit() {
set_frequency() {
- local cpu=$1
- local dirpath=$CPU_PATH/$cpu/cpufreq
- local newfreq=$2
- local setfreqpath=$dirpath/scaling_setspeed
+ cpu=$1
+ dirpath=$CPU_PATH/$cpu/cpufreq
+ newfreq=$2
+ setfreqpath=$dirpath/scaling_setspeed
echo $newfreq > $setfreqpath
wait_latency $cpu
}
get_frequency() {
- local cpu=$1
- local dirpath=$CPU_PATH/$cpu/cpufreq/scaling_cur_freq
+ cpu=$1
+ dirpath=$CPU_PATH/$cpu/cpufreq/scaling_cur_freq
cat $dirpath
}
get_max_frequency() {
- local cpu=$1
- local dirpath=$CPU_PATH/$cpu/cpufreq/scaling_max_freq
+ cpu=$1
+ dirpath=$CPU_PATH/$cpu/cpufreq/scaling_max_freq
cat $dirpath
}
get_min_frequency() {
- local cpu=$1
- local dirpath=$CPU_PATH/$cpu/cpufreq/scaling_min_freq
+ cpu=$1
+ dirpath=$CPU_PATH/$cpu/cpufreq/scaling_min_freq
cat $dirpath
}
set_online() {
- local cpu=$1
- local dirpath=$CPU_PATH/$cpu
+ cpu=$1
+ dirpath=$CPU_PATH/$cpu
if [ "$cpu" = "cpu0" ]; then
return 0
@@ -249,8 +244,8 @@ set_online() {
}
set_offline() {
- local cpu=$1
- local dirpath=$CPU_PATH/$cpu
+ cpu=$1
+ dirpath=$CPU_PATH/$cpu
if [ "$cpu" = "cpu0" ]; then
return 0
@@ -260,16 +255,16 @@ set_offline() {
}
get_online() {
- local cpu=$1
- local dirpath=$CPU_PATH/$cpu
+ cpu=$1
+ dirpath=$CPU_PATH/$cpu
cat $dirpath/online
}
check() {
- local descr=$1
- local func=$2
+ descr=$1
+ func=$2
shift 2;
log_begin "checking $descr"
@@ -286,15 +281,15 @@ check() {
}
check_file() {
- local file=$1
- local dir=$2
+ file=$1
+ dir=$2
check "'$file' exists in '$dir'" "test -f" $dir/$file
}
check_cpufreq_files() {
- local dirpath=$CPU_PATH/$1/cpufreq
+ dirpath=$CPU_PATH/$1/cpufreq
shift 1
for i in $@; do
@@ -306,7 +301,7 @@ check_cpufreq_files() {
check_sched_mc_files() {
- local dirpath=$CPU_PATH
+ dirpath=$CPU_PATH
for i in $@; do
check_file $i $dirpath || return 1
@@ -317,7 +312,7 @@ check_sched_mc_files() {
check_topology_files() {
- local dirpath=$CPU_PATH/$1/topology
+ dirpath=$CPU_PATH/$1/topology
shift 1
for i in $@; do
@@ -329,7 +324,7 @@ check_topology_files() {
check_cpuhotplug_files() {
- local dirpath=$CPU_PATH/$1
+ dirpath=$CPU_PATH/$1
shift 1
for i in $@; do
@@ -347,8 +342,7 @@ check_cpuhotplug_files() {
save_governors() {
- governors_backup=
- local index=0
+ index=0
for cpu in $cpus; do
governors_backup[$index]=$(cat $CPU_PATH/$cpu/cpufreq/scaling_governor)
@@ -358,8 +352,7 @@ save_governors() {
restore_governors() {
- local index=0
- local oldgov=
+ index=0
for cpu in $cpus; do
oldgov=${governors_backup[$index]}
@@ -370,8 +363,7 @@ restore_governors() {
save_frequencies() {
- frequencies_backup=
- local index=0
+ index=0
for cpu in $cpus; do
frequencies_backup[$index]=$(cat $CPU_PATH/$cpu/cpufreq/scaling_cur_freq)
@@ -381,8 +373,7 @@ save_frequencies() {
restore_frequencies() {
- local index=0
- local oldfreq=
+ index=0
for cpu in $cpus; do
oldfreq=${frequencies_backup[$index]}
@@ -408,7 +399,6 @@ get_os() {
}
is_root() {
- local ret
get_os
if [ $? -eq 1 ]; then
# for ubuntu
@@ -421,7 +411,7 @@ is_root() {
}
is_cpu0_hotplug_allowed() {
- local status=$1
+ status=$1
if [ $status -eq 1 ]; then
return 0
diff --git a/include/suspend_functions.sh b/include/suspend_functions.sh
index 2e9ee21..5157143 100644
--- a/include/suspend_functions.sh
+++ b/include/suspend_functions.sh
@@ -114,7 +114,7 @@ suspend_system ()
echo "v---" >>"$LOGFILE"
retry=30
while [ "$retry" -gt 0 ]; do
- let "retry=$retry-1"
+ retry=$((retry - 1))
# Accumulate the dmesg delta.
dmesg >"$LOGFILE.dmesg.B"
@@ -235,7 +235,7 @@ ac_online()
ac_check()
{
- typeset ac_current=`ac_online`
+ ac_current=`ac_online`
if [ "$ac_becomes" -ne -1 -a "$ac_current" -ne -1 -a \
"$ac_current" -ne "$ac_becomes" ]; then
@@ -251,9 +251,7 @@ phase_interactive=1
phase()
{
- typeset sleep
-
- let phase="$phase+1"
+ phase=$((phase + 1))
if [ "$ac_needed" -ne "$ac_is" ]; then
case "$ac_needed" in
@@ -264,7 +262,7 @@ phase()
fi
if [ "$timer_sleep" -gt 60 ]; then
- let sleep="$timer_sleep / 60"
+ sleep="$timer_sleep / 60"
sleep="$sleep minutes"
else
sleep="$timer_sleep seconds"
diff --git a/include/thermal_functions.sh b/include/thermal_functions.sh
index 59f79a3..56a0a3e 100644
--- a/include/thermal_functions.sh
+++ b/include/thermal_functions.sh
@@ -26,20 +26,18 @@
THERMAL_PATH="/sys/devices/virtual/thermal"
MAX_ZONE=0-12
MAX_CDEV=0-50
-ALL_ZONE=
-ALL_CDEV=
check_valid_temp() {
- local file=$1
- local zone_name=$2
- local dir=$THERMAL_PATH/$2
+ file=$1
+ zone_name=$2
+ dir=$THERMAL_PATH/$2
- local temp_file=$dir/$1
- local func=cat
+ temp_file=$dir/$1
+ func=cat
shift 2;
- local temp_val=$($func $temp_file)
- local descr="'$zone_name'/'$file' ='$temp_val'"
+ temp_val=$($func $temp_file)
+ descr="'$zone_name'/'$file' ='$temp_val'"
log_begin "checking $descr"
if [ $temp_val -gt 0 ]; then
@@ -54,7 +52,7 @@ check_valid_temp() {
for_each_thermal_zone() {
- local func=$1
+ func=$1
shift 1
zones=$(ls $THERMAL_PATH | grep "thermal_zone['$MAX_ZONE']")
@@ -70,8 +68,8 @@ for_each_thermal_zone() {
get_total_trip_point_of_zone() {
- local zone_path=$THERMAL_PATH/$1
- local count=0
+ zone_path=$THERMAL_PATH/$1
+ count=0
shift 1
trips=$(ls $zone_path | grep "trip_point_['$MAX_ZONE']_temp")
for trip in $trips; do
@@ -82,10 +80,10 @@ get_total_trip_point_of_zone() {
for_each_trip_point_of_zone() {
- local zone_path=$THERMAL_PATH/$1
- local count=0
- local func=$2
- local zone_name=$1
+ 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
@@ -97,10 +95,10 @@ for_each_trip_point_of_zone() {
for_each_binding_of_zone() {
- local zone_path=$THERMAL_PATH/$1
- local count=0
- local func=$2
- local zone_name=$1
+ 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
@@ -113,14 +111,14 @@ for_each_binding_of_zone() {
}
check_valid_binding() {
- local trip_point=$1
- local zone_name=$2
- local dirpath=$THERMAL_PATH/$2
- local temp_file=$2/$1
- local trip_point_val=$(cat $dirpath/$trip_point)
+ trip_point=$1
+ zone_name=$2
+ dirpath=$THERMAL_PATH/$2
+ temp_file=$2/$1
+ trip_point_val=$(cat $dirpath/$trip_point)
get_total_trip_point_of_zone $zone_name
- local trip_point_max=$?
- local descr="'$temp_file' valid binding"
+ trip_point_max=$?
+ descr="'$temp_file' valid binding"
shift 2
log_begin "checking $descr"
@@ -134,10 +132,10 @@ check_valid_binding() {
}
validate_trip_bindings() {
- local zone_name=$1
- local bind_no=$2
- local dirpath=$THERMAL_PATH/$1
- local trip_point=cdev$2_trip_point
+ zone_name=$1
+ bind_no=$2
+ dirpath=$THERMAL_PATH/$1
+ trip_point=cdev$2_trip_point
shift 2
check_file $trip_point $dirpath || return 1
@@ -145,11 +143,11 @@ validate_trip_bindings() {
}
validate_trip_level() {
- local zone_name=$1
- local trip_no=$2
- local dirpath=$THERMAL_PATH/$1
- local trip_temp=trip_point_$2_temp
- local trip_type=trip_point_$2_type
+ zone_name=$1
+ trip_no=$2
+ dirpath=$THERMAL_PATH/$1
+ trip_temp=trip_point_$2_temp
+ trip_type=trip_point_$2_type
shift 2
check_file $trip_temp $dirpath || return 1
@@ -159,7 +157,7 @@ validate_trip_level() {
for_each_cooling_device() {
- local func=$1
+ func=$1
shift 1
devices=$(ls $THERMAL_PATH | grep "cooling_device['$MAX_CDEV']")
@@ -178,12 +176,12 @@ for_each_cooling_device() {
}
check_scaling_freq() {
- local before_freq_list=$1
- local after_freq_list=$2
+ before_freq_list=$1
+ after_freq_list=$2
shift 2
- local index=0
+ index=0
- local flag=0
+ flag=0
for cpu in $cpus; do
if [ ${before_freq_list[$index]} -ne ${after_freq_list[$index]} ] ; then
flag=1
@@ -194,8 +192,7 @@ check_scaling_freq() {
}
store_scaling_maxfreq() {
- scale_freq=
- local index=0
+ index=0
for cpu in $cpus; do
scale_freq[$index]=$(cat $CPU_PATH/$cpu/cpufreq/scaling_max_freq)
@@ -206,11 +203,11 @@ store_scaling_maxfreq() {
get_trip_id() {
- local trip_name=$1
+ trip_name=$1
shift 1
- local id1=$(echo $trip_name|cut -c12)
- local id2=$(echo $trip_name|cut -c13)
+ id1=$(echo $trip_name|cut -c12)
+ id2=$(echo $trip_name|cut -c13)
if [ $id2 != "_" ]; then
id1=$(($id2 + 10*$id1))
fi
@@ -219,10 +216,9 @@ get_trip_id() {
disable_all_thermal_zones() {
- mode_list=
- local index=0
+ index=0
- local th_zones=$(ls $THERMAL_PATH | grep "thermal_zone['$MAX_ZONE']")
+ th_zones=$(ls $THERMAL_PATH | grep "thermal_zone['$MAX_ZONE']")
for zone in $th_zones; do
mode_list[$index]=$(cat $THERMAL_PATH/$zone/mode)
index=$((index + 1))
@@ -233,9 +229,9 @@ disable_all_thermal_zones() {
enable_all_thermal_zones() {
- local index=0
+ index=0
- local th_zones=$(ls $THERMAL_PATH | grep "thermal_zone['$MAX_ZONE']")
+ th_zones=$(ls $THERMAL_PATH | grep "thermal_zone['$MAX_ZONE']")
for zone in $th_zones; do
echo ${mode_list[$index]} > $THERMAL_PATH/$zone/mode
index=$((index + 1))
@@ -286,11 +282,10 @@ kill_glmark2() {
set_thermal_governors() {
- local gov=$1
- local index=0
- thermal_governor_backup[MAX_ZONE]=
+ gov=$1
+ index=0
- local th_zones=$(ls $THERMAL_PATH | grep "thermal_zone['$MAX_ZONE']")
+ th_zones=$(ls $THERMAL_PATH | grep "thermal_zone['$MAX_ZONE']")
for zone in $th_zones; do
thermal_governor_backup[$index]=$(cat $THERMAL_PATH/$zone/policy)
index=$((index + 1))
@@ -301,9 +296,9 @@ set_thermal_governors() {
restore_thermal_governors() {
- local index=0
+ index=0
- local th_zones=$(ls $THERMAL_PATH | grep "thermal_zone['$MAX_ZONE']")
+ th_zones=$(ls $THERMAL_PATH | grep "thermal_zone['$MAX_ZONE']")
for zone in $th_zones; do
echo ${thermal_governor_backup[$index]} > $THERMAL_PATH/$zone/policy
index=$((index + 1))
diff --git a/powertop/powertop_01.sh b/powertop/powertop_01.sh
index 7d34a43..5fab897 100755
--- a/powertop/powertop_01.sh
+++ b/powertop/powertop_01.sh
@@ -29,11 +29,11 @@
run_powertop() {
- local bin_path=`command -v powertop`
- local report=csv
- local seconds=10
- local iterations=2
- local report_name=PowerTOP*.csv
+ bin_path=`command -v powertop`
+ report=csv
+ seconds=10
+ iterations=2
+ report_name=PowerTOP*.csv
# remove old reports if exists
rm -f $report_name
@@ -44,8 +44,8 @@ run_powertop() {
end_time=`date +%s`
# check if powertop run for desired time
- let expected_time="$iterations * $seconds"
- let actual_time="$end_time - $start_time"
+ expected_time="$iterations * $seconds"
+ actual_time="$end_time - $start_time"
check "if powertop run for $expected_time sec" "test $actual_time -ge $expected_time"
diff --git a/powertop/powertop_sanity.sh b/powertop/powertop_sanity.sh
index aab019e..4ac7fec 100755
--- a/powertop/powertop_sanity.sh
+++ b/powertop/powertop_sanity.sh
@@ -27,7 +27,7 @@
check_powertop() {
- local bin_name=powertop
+ bin_name=powertop
command -v $bin_name >/dev/null 2>&1 && return 1 || return 0
}
diff --git a/suspend/suspend_05.sh b/suspend/suspend_05.sh
index 36d613e..685c32e 100755
--- a/suspend/suspend_05.sh
+++ b/suspend/suspend_05.sh
@@ -46,7 +46,7 @@ if [ "$battery_count" -eq 0 ]; then
log_skip "no BATTERY detected for power test"
else
save_timer_sleep="$timer_sleep"
- let timer_sleep="$args_power_sleep"
+ timer_sleep="$args_power_sleep"
ac_required 0
phase
@@ -66,9 +66,9 @@ else
bat_after=`battery_capacity`
# do the calculations
- let consumed="$bat_before - $bat_after"
- let elapsed="$date_after - $date_before"
- let usage="($consumed * 60*60) / $elapsed"
+ consumed="$bat_before - $bat_after"
+ elapsed="$date_after - $date_before"
+ usage="($consumed * 60*60) / $elapsed"
# output the results
ECHO "before: $bat_before mWh"
diff --git a/thermal/thermal_00.sh b/thermal/thermal_00.sh
index 672b0ff..302858f 100755
--- a/thermal/thermal_00.sh
+++ b/thermal/thermal_00.sh
@@ -29,19 +29,19 @@
. ../include/thermal_functions.sh
check_cooling_device_type() {
- local all_zones=$(ls $THERMAL_PATH | grep "cooling_device['$MAX_CDEV']")
+ all_zones=$(ls $THERMAL_PATH | grep "cooling_device['$MAX_CDEV']")
echo "Cooling Device list:"
for i in $all_zones; do
- local type=$(cat $THERMAL_PATH/$i/type)
+ type=$(cat $THERMAL_PATH/$i/type)
echo "- $type"
done
}
check_thermal_zone_type() {
- local all_zones=$(ls $THERMAL_PATH | grep "thermal_zone['$MAX_ZONE']")
+ all_zones=$(ls $THERMAL_PATH | grep "thermal_zone['$MAX_ZONE']")
echo "Thermal Zone list:"
for i in $all_zones; do
- local type=$(cat $THERMAL_PATH/$i/type)
+ type=$(cat $THERMAL_PATH/$i/type)
echo "- $type"
done
}
diff --git a/thermal/thermal_01.sh b/thermal/thermal_01.sh
index 57f64a7..e11c884 100755
--- a/thermal/thermal_01.sh
+++ b/thermal/thermal_01.sh
@@ -32,8 +32,8 @@ ATTRIBUTES="mode temp type uevent"
check_thermal_zone_attributes() {
- local dirpath=$THERMAL_PATH/$1
- local zone_name=$1
+ dirpath=$THERMAL_PATH/$1
+ zone_name=$1
shift 1
for i in $ATTRIBUTES; do
check_file $i $dirpath || return 1
@@ -44,16 +44,16 @@ check_thermal_zone_attributes() {
check_thermal_zone_mode() {
- local dirpath=$THERMAL_PATH/$1
- local zone_name=$1
+ dirpath=$THERMAL_PATH/$1
+ zone_name=$1
shift 1
- local prev_mode=$(cat $dirpath/mode)
+ prev_mode=$(cat $dirpath/mode)
echo -n enabled > $dirpath/mode
- local cur_mode=$(cat $dirpath/mode)
+ cur_mode=$(cat $dirpath/mode)
check "$zone_name cur_mode=$cur_mode"\
"test $cur_mode = enabled" || return 1
echo -n disabled > $dirpath/mode
- local cur_mode=$(cat $dirpath/mode)
+ cur_mode=$(cat $dirpath/mode)
check "$zone_name cur_mode=$cur_mode"\
"test $cur_mode = disabled" || return 1
@@ -62,7 +62,7 @@ check_thermal_zone_mode() {
check_thermal_zone_trip_level() {
- local all_zones=$(ls $THERMAL_PATH | grep "thermal_zone['$MAX_ZONE']")
+ all_zones=$(ls $THERMAL_PATH | grep "thermal_zone['$MAX_ZONE']")
for i in $all_zones; do
for_each_trip_point_of_zone $i "validate_trip_level" || return 1
done
@@ -70,7 +70,7 @@ check_thermal_zone_trip_level() {
check_thermal_zone_bindings() {
- local all_zones=$(ls $THERMAL_PATH | grep "thermal_zone['$MAX_ZONE']")
+ all_zones=$(ls $THERMAL_PATH | grep "thermal_zone['$MAX_ZONE']")
for i in $all_zones; do
for_each_binding_of_zone $i "validate_trip_bindings" || return 1
done
diff --git a/thermal/thermal_02.sh b/thermal/thermal_02.sh
index 8105d80..0786870 100755
--- a/thermal/thermal_02.sh
+++ b/thermal/thermal_02.sh
@@ -32,8 +32,8 @@ CDEV_ATTRIBUTES="cur_state max_state type uevent"
check_cooling_device_attributes() {
- local dirpath=$THERMAL_PATH/$1
- local cdev_name=$1
+ dirpath=$THERMAL_PATH/$1
+ cdev_name=$1
shift 1
for i in $CDEV_ATTRIBUTES; do
@@ -43,13 +43,13 @@ check_cooling_device_attributes() {
}
check_cooling_device_states() {
- local dirpath=$THERMAL_PATH/$1
- local cdev_name=$1
+ dirpath=$THERMAL_PATH/$1
+ 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
+ max_state=$(cat $dirpath/max_state)
+ prev_state_val=$(cat $dirpath/cur_state)
+ count=0
+ cur_state_val=0
while (test $count -le $max_state); do
echo $count > $dirpath/cur_state
cur_state_val=$(cat $dirpath/cur_state)
diff --git a/thermal/thermal_03.sh b/thermal/thermal_03.sh
index 42082f0..9704b74 100755
--- a/thermal/thermal_03.sh
+++ b/thermal/thermal_03.sh
@@ -39,11 +39,11 @@ heater_kill() {
}
check_temperature_change() {
- local dirpath=$THERMAL_PATH/$1
- local zone_name=$1
+ dirpath=$THERMAL_PATH/$1
+ zone_name=$1
shift 1
- local init_temp=$(cat $dirpath/temp)
+ init_temp=$(cat $dirpath/temp)
$CPU_HEAT_BIN &
cpu_pid=$(ps | grep heat_cpu| awk '{print $1}')
test -z $cpu_pid && cpu_pid=0
@@ -53,7 +53,7 @@ check_temperature_change() {
start_glmark2
sleep 5
- local final_temp=$(cat $dirpath/temp)
+ final_temp=$(cat $dirpath/temp)
heater_kill
check "temperature variation with load" "test $final_temp -gt $init_temp"
}
diff --git a/thermal/thermal_04.sh b/thermal/thermal_04.sh
index 932903c..37c65f6 100755
--- a/thermal/thermal_04.sh
+++ b/thermal/thermal_04.sh
@@ -37,23 +37,23 @@ heater_kill() {
}
verify_cooling_device_temp_change() {
- local dirpath=$THERMAL_PATH/$1
- local cdev_name=$1
+ dirpath=$THERMAL_PATH/$1
+ cdev_name=$1
shift 1
- local tzonepath=$THERMAL_PATH/thermal_zone0
+ tzonepath=$THERMAL_PATH/thermal_zone0
test -d $tzonepath
if [ $? -ne 0 ] ; then
echo "No thermal zone present"
return 1;
fi
- local max_state=$(cat $dirpath/max_state)
- local prev_state_val=$(cat $dirpath/cur_state)
+ max_state=$(cat $dirpath/max_state)
+ prev_state_val=$(cat $dirpath/cur_state)
- local count=1
- local cur_state_val=0
- local init_temp=0
- local final_temp=0
- local cool_temp=0
+ count=1
+ cur_state_val=0
+ init_temp=0
+ final_temp=0
+ cool_temp=0
./$HEAT_CPU_MODERATE moderate &
pid=$!
test $pid -eq 0 && return
diff --git a/thermal/thermal_05.sh b/thermal/thermal_05.sh
index 68c44d3..2e7f080 100755
--- a/thermal/thermal_05.sh
+++ b/thermal/thermal_05.sh
@@ -29,25 +29,25 @@
. ../include/thermal_functions.sh
verify_cpufreq_cooling_device_action() {
- local dirpath=$THERMAL_PATH/$1
- local cdev_name=$1
+ dirpath=$THERMAL_PATH/$1
+ cdev_name=$1
shift 1
- local cpufreq_cdev=$(cat $dirpath/type)
+ cpufreq_cdev=$(cat $dirpath/type)
cat $dirpath/type | grep cpufreq
if [ $? -ne 0 ] ; then
log_skip "Cannot find cpufreq in $cdev_name..."
return 0
fi
- local max_state=$(cat $dirpath/max_state)
- local prev_state_val=$(cat $dirpath/cur_state)
+ max_state=$(cat $dirpath/max_state)
+ prev_state_val=$(cat $dirpath/cur_state)
disable_all_thermal_zones
- local count=1
- local before_scale_max=0
- local after_scale_max=0
- local change=0
+ count=1
+ before_scale_max=0
+ after_scale_max=0
+ change=0
while (test $count -le $max_state); do
echo 0 > $dirpath/cur_state
diff --git a/thermal/thermal_06.sh b/thermal/thermal_06.sh
index 978a526..2929605 100755
--- a/thermal/thermal_06.sh
+++ b/thermal/thermal_06.sh
@@ -45,17 +45,15 @@ heater_kill() {
}
check_trip_point_change() {
- local dirpath=$THERMAL_PATH/$1
- local zone_name=$1
+ dirpath=$THERMAL_PATH/$1
+ zone_name=$1
shift 1
- local count=0
- local cur_temp=0
- local trip_temp=0
- local trip_cross=
- local trip_id=
- local trip_type=0
- local trip_type_path=0
+ count=0
+ cur_temp=0
+ trip_temp=0
+ trip_type=0
+ trip_type_path=0
$CPU_HEAT_BIN &
cpu_pid=$(ps | grep heat_cpu| awk '{print $1}')
test -z $cpu_pid && cpu_pid=0
@@ -64,7 +62,7 @@ check_trip_point_change() {
start_glmark2
- local index=0
+ index=0
for trip in $(ls $dirpath | grep "trip_point_['$MAX_ZONE']_temp"); do
trip_cross[$index]=0
index=$((index + 1))