Changes in v2: - Reorganized previous patchset and recreated patches based on logical change - Rewritten logic to find certain attributes in sysfs
[Let's try again...]
This patchset primarily fixes Linaro Bug# 772 (https://bugs.linaro.org/show_bug.cgi?id=772) to remove bashisms in all PM-QA scripts. These scripts will run on Android, Openembedded, and Ubuntu.
Cleanups have been done to remove redundant code, improve readability, and resolve syntax errors that were not detected before.
Currently, the suspend and powertop test modules are disabled. However, to maintain consistency, the format of the suspend and powertop scripts have been updated to be POSIX-compliant.
Next steps:
Once this patchset has been reviewed and acked, the following steps will be taken:
1. Submit a patch to update the release tag on the pwrmgmt test definitions to pm-qa-v0.5.0
2. Submit a patch to update the pm-qa script (https://git.linaro.org/qa/test-definitions.git/blob/HEAD:/common/scripts/pm-...) used to run PM-QA on Android by removing unnecessary busybox sym links and replace suspend test module with thermal in directory list.
3. Investigate further on why pandaboards do not like the cpuidle_03 test case.
4. Update the PM-QA wiki with new test cases and their descriptions: https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/Pm...
Comments and/or questions are highly encouraged.
Lisa Nguyen (25): Fix path to library files and change shebang line Replace double equals with one for comparison Remove sigtrap prefixes for traps Remove local keywords and uninitialized variables Fix syntax to get the cpu id number Remove thermal_try_max variable Switches: Add hotplug_allow_cpu0=0 cpuhotplug: Rewrite randomize() function Fix the syntax to call C programs cpuidle: Use is_root() function in cpuidle_03 Remove unused variables and rename some Remove BASH arrays Rewrite logic to check for sampling_rate suspend_functions: Check if $LOGDIR exists cpuhotplug: Rename 1_sanity_check files to cpuhotplug_00 files cpuhotplug: Rename z_sanity_check files to cpuhotplug_99 cputopology: Add cputopology_sanity.sh Android: Update makefiles with new test numbers Use -q option for grep command Improve test conditions to see if a directory or file exists cpufreq: Remove unnecessary checks Test: Add sort function cpufreq: Check to see if scaling_available_governors is available cpufreq: Rewrite logic to check if powersave is supported Whitespace cleanup
Switches.sh | 6 +- Test.mk | 2 +- cpufreq/cpufreq_01.sh | 4 +- cpufreq/cpufreq_02.sh | 4 +- cpufreq/cpufreq_03.sh | 15 +- cpufreq/cpufreq_04.sh | 16 +-- cpufreq/cpufreq_05.sh | 105 +++++++------- cpufreq/cpufreq_06.sh | 46 +++--- cpufreq/cpufreq_07.sh | 47 +++---- cpufreq/cpufreq_08.sh | 26 ++-- cpufreq/cpufreq_09.sh | 28 ++-- cpufreq/cpufreq_sanity.sh | 10 +- cpuhotplug/1_sanity_check.sh | 40 ------ cpuhotplug/1_sanity_check.txt | 1 - cpuhotplug/Android.mk | 4 +- cpuhotplug/cpuhotplug_00.sh | 40 ++++++ cpuhotplug/cpuhotplug_00.txt | 1 + cpuhotplug/cpuhotplug_01.sh | 5 +- cpuhotplug/cpuhotplug_02.sh | 23 ++- cpuhotplug/cpuhotplug_03.sh | 18 ++- cpuhotplug/cpuhotplug_04.sh | 17 +-- cpuhotplug/cpuhotplug_05.sh | 13 +- cpuhotplug/cpuhotplug_06.sh | 15 +- cpuhotplug/cpuhotplug_07.sh | 26 ++-- cpuhotplug/cpuhotplug_08.sh | 22 +-- cpuhotplug/cpuhotplug_99.sh | 40 ++++++ cpuhotplug/cpuhotplug_99.txt | 1 + cpuhotplug/cpuhotplug_sanity.sh | 6 +- cpuhotplug/z_sanity_check.sh | 40 ------ cpuhotplug/z_sanity_check.txt | 1 - cpuidle/cpuidle_01.sh | 18 ++- cpuidle/cpuidle_02.sh | 6 +- cpuidle/cpuidle_03.sh | 16 +-- cpuidle/cpuidle_sanity.sh | 7 +- cputopology/Android.mk | 2 +- cputopology/cputopology_01.sh | 9 +- cputopology/cputopology_02.sh | 4 +- cputopology/cputopology_sanity.sh | 49 +++++++ cputopology/cputopology_sanity.txt | 1 + include/functions.sh | 274 +++++++++++++++++------------------- include/suspend_functions.sh | 21 +-- include/thermal_functions.sh | 215 ++++++++++++++-------------- powertop/powertop_01.sh | 19 ++- powertop/powertop_sanity.sh | 7 +- suspend/suspend_01.sh | 6 +- suspend/suspend_02.sh | 8 +- suspend/suspend_03.sh | 6 +- suspend/suspend_04.sh | 6 +- suspend/suspend_05.sh | 14 +- suspend/suspend_sanity.sh | 4 +- thermal/thermal_00.sh | 22 +-- thermal/thermal_01.sh | 43 +++--- thermal/thermal_02.sh | 42 +++--- thermal/thermal_03.sh | 18 +-- thermal/thermal_04.sh | 59 ++++---- thermal/thermal_05.sh | 50 +++---- thermal/thermal_06.sh | 96 +++++++------ thermal/thermal_sanity.sh | 7 +- utils/utils_sanity.sh | 4 +- 59 files changed, 827 insertions(+), 828 deletions(-) delete mode 100755 cpuhotplug/1_sanity_check.sh delete mode 100644 cpuhotplug/1_sanity_check.txt create mode 100755 cpuhotplug/cpuhotplug_00.sh create mode 100644 cpuhotplug/cpuhotplug_00.txt create mode 100755 cpuhotplug/cpuhotplug_99.sh create mode 100644 cpuhotplug/cpuhotplug_99.txt delete mode 100755 cpuhotplug/z_sanity_check.sh delete mode 100644 cpuhotplug/z_sanity_check.txt create mode 100755 cputopology/cputopology_sanity.sh create mode 100644 cputopology/cputopology_sanity.txt
'source' is a BASH keyword. Edit the path to the library files by using the POSIX version of the 'source' keyword.
Also change the interpreter from #!/bin/bash to #!/bin/sh.
Signed-off-by: Lisa Nguyen lisa.nguyen@linaro.org --- cpufreq/cpufreq_01.sh | 4 ++-- cpufreq/cpufreq_02.sh | 4 ++-- cpufreq/cpufreq_03.sh | 4 ++-- cpufreq/cpufreq_04.sh | 4 ++-- cpufreq/cpufreq_05.sh | 4 ++-- cpufreq/cpufreq_06.sh | 4 ++-- cpufreq/cpufreq_07.sh | 4 ++-- cpufreq/cpufreq_08.sh | 4 ++-- cpufreq/cpufreq_09.sh | 4 ++-- cpufreq/cpufreq_sanity.sh | 4 ++-- cpuhotplug/1_sanity_check.sh | 4 ++-- cpuhotplug/cpuhotplug_01.sh | 5 ++--- cpuhotplug/cpuhotplug_02.sh | 4 ++-- cpuhotplug/cpuhotplug_03.sh | 4 ++-- cpuhotplug/cpuhotplug_04.sh | 4 ++-- cpuhotplug/cpuhotplug_05.sh | 4 ++-- cpuhotplug/cpuhotplug_06.sh | 4 ++-- cpuhotplug/cpuhotplug_07.sh | 4 ++-- cpuhotplug/cpuhotplug_08.sh | 4 ++-- cpuhotplug/cpuhotplug_sanity.sh | 4 ++-- cpuhotplug/z_sanity_check.sh | 4 ++-- cpuidle/cpuidle_01.sh | 4 ++-- cpuidle/cpuidle_02.sh | 4 ++-- cpuidle/cpuidle_03.sh | 4 ++-- cpuidle/cpuidle_sanity.sh | 4 ++-- cputopology/cputopology_01.sh | 4 ++-- cputopology/cputopology_02.sh | 4 ++-- include/functions.sh | 4 ++-- include/suspend_functions.sh | 4 ++-- include/thermal_functions.sh | 2 +- powertop/powertop_01.sh | 4 ++-- powertop/powertop_sanity.sh | 4 ++-- suspend/suspend_01.sh | 6 +++--- suspend/suspend_02.sh | 6 +++--- suspend/suspend_03.sh | 6 +++--- suspend/suspend_04.sh | 6 +++--- suspend/suspend_05.sh | 6 +++--- suspend/suspend_sanity.sh | 4 ++-- thermal/thermal_00.sh | 6 +++--- thermal/thermal_01.sh | 6 +++--- thermal/thermal_02.sh | 6 +++--- thermal/thermal_03.sh | 6 +++--- thermal/thermal_04.sh | 6 +++--- thermal/thermal_05.sh | 6 +++--- thermal/thermal_06.sh | 6 +++--- thermal/thermal_sanity.sh | 6 +++--- utils/utils_sanity.sh | 4 ++-- 47 files changed, 106 insertions(+), 107 deletions(-)
diff --git a/cpufreq/cpufreq_01.sh b/cpufreq/cpufreq_01.sh index 6f092fe..fa86941 100755 --- a/cpufreq/cpufreq_01.sh +++ b/cpufreq/cpufreq_01.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -25,7 +25,7 @@
# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/Pm...
-source ../include/functions.sh +. ../include/functions.sh
FILES="scaling_available_frequencies scaling_cur_freq scaling_setspeed"
diff --git a/cpufreq/cpufreq_02.sh b/cpufreq/cpufreq_02.sh index 34e19b7..d633d4f 100755 --- a/cpufreq/cpufreq_02.sh +++ b/cpufreq/cpufreq_02.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -25,7 +25,7 @@
# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/Pm...
-source ../include/functions.sh +. ../include/functions.sh
FILES="scaling_available_governors scaling_governor"
diff --git a/cpufreq/cpufreq_03.sh b/cpufreq/cpufreq_03.sh index 65a6ad7..8aeeeb2 100755 --- a/cpufreq/cpufreq_03.sh +++ b/cpufreq/cpufreq_03.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -25,7 +25,7 @@
# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/Pm...
-source ../include/functions.sh +. ../include/functions.sh
check_governor() {
diff --git a/cpufreq/cpufreq_04.sh b/cpufreq/cpufreq_04.sh index d4ed1bd..71ee69d 100755 --- a/cpufreq/cpufreq_04.sh +++ b/cpufreq/cpufreq_04.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -25,7 +25,7 @@
# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/Pm...
-source ../include/functions.sh +. ../include/functions.sh
check_frequency() {
diff --git a/cpufreq/cpufreq_05.sh b/cpufreq/cpufreq_05.sh index 1f0dd8d..8df5ba2 100755 --- a/cpufreq/cpufreq_05.sh +++ b/cpufreq/cpufreq_05.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -25,7 +25,7 @@
# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/Pm...
-source ../include/functions.sh +. ../include/functions.sh
save_governors
diff --git a/cpufreq/cpufreq_06.sh b/cpufreq/cpufreq_06.sh index e2e708a..fedec0f 100755 --- a/cpufreq/cpufreq_06.sh +++ b/cpufreq/cpufreq_06.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -25,7 +25,7 @@
# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/Pm...
-source ../include/functions.sh +. ../include/functions.sh
CPUCYCLE=../utils/cpucycle
diff --git a/cpufreq/cpufreq_07.sh b/cpufreq/cpufreq_07.sh index b65d212..aef991f 100755 --- a/cpufreq/cpufreq_07.sh +++ b/cpufreq/cpufreq_07.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -25,7 +25,7 @@
# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/Pm...
-source ../include/functions.sh +. ../include/functions.sh
CPUBURN=../utils/cpuburn
diff --git a/cpufreq/cpufreq_08.sh b/cpufreq/cpufreq_08.sh index 2250017..3cc60f8 100755 --- a/cpufreq/cpufreq_08.sh +++ b/cpufreq/cpufreq_08.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -25,7 +25,7 @@
# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/Pm...
-source ../include/functions.sh +. ../include/functions.sh
CPUBURN=../utils/cpuburn
diff --git a/cpufreq/cpufreq_09.sh b/cpufreq/cpufreq_09.sh index 62c953d..f502b83 100755 --- a/cpufreq/cpufreq_09.sh +++ b/cpufreq/cpufreq_09.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -25,7 +25,7 @@
# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/Pm...
-source ../include/functions.sh +. ../include/functions.sh
CPUBURN=../utils/cpuburn
diff --git a/cpufreq/cpufreq_sanity.sh b/cpufreq/cpufreq_sanity.sh index e3518b8..24784f9 100755 --- a/cpufreq/cpufreq_sanity.sh +++ b/cpufreq/cpufreq_sanity.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -23,7 +23,7 @@ # - initial API and implementation #
-source ../include/functions.sh +. ../include/functions.sh
is_root if [ $? -ne 0 ]; then diff --git a/cpuhotplug/1_sanity_check.sh b/cpuhotplug/1_sanity_check.sh index e091879..72be60c 100755 --- a/cpuhotplug/1_sanity_check.sh +++ b/cpuhotplug/1_sanity_check.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -25,7 +25,7 @@
# URL :
-source ../include/functions.sh +. ../include/functions.sh
sanity_check() { local ret=$(cat $CPU_PATH/offline) diff --git a/cpuhotplug/cpuhotplug_01.sh b/cpuhotplug/cpuhotplug_01.sh index 8804df7..8591a21 100755 --- a/cpuhotplug/cpuhotplug_01.sh +++ b/cpuhotplug/cpuhotplug_01.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -22,10 +22,9 @@ # Daniel Lezcano daniel.lezcano@linaro.org (IBM Corporation) # - initial API and implementation # - # URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/Pm...
-source ../include/functions.sh +. ../include/functions.sh
FILES="online offline possible present"
diff --git a/cpuhotplug/cpuhotplug_02.sh b/cpuhotplug/cpuhotplug_02.sh index d2bb5b4..8caf5e6 100755 --- a/cpuhotplug/cpuhotplug_02.sh +++ b/cpuhotplug/cpuhotplug_02.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -25,7 +25,7 @@
# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/Pm...
-source ../include/functions.sh +. ../include/functions.sh
check_state() { local cpu=$1 diff --git a/cpuhotplug/cpuhotplug_03.sh b/cpuhotplug/cpuhotplug_03.sh index 2a5ae48..91c29ef 100755 --- a/cpuhotplug/cpuhotplug_03.sh +++ b/cpuhotplug/cpuhotplug_03.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -25,7 +25,7 @@
# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/Pm...
-source ../include/functions.sh +. ../include/functions.sh
check_affinity_fails() { local cpu=$1 diff --git a/cpuhotplug/cpuhotplug_04.sh b/cpuhotplug/cpuhotplug_04.sh index 7938e7d..1f7efa7 100755 --- a/cpuhotplug/cpuhotplug_04.sh +++ b/cpuhotplug/cpuhotplug_04.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -26,7 +26,7 @@ # URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/Pm...
CPUBURN=../utils/cpuburn -source ../include/functions.sh +. ../include/functions.sh
check_task_migrate() { local cpu=$1 diff --git a/cpuhotplug/cpuhotplug_05.sh b/cpuhotplug/cpuhotplug_05.sh index 4042f2c..28f6f8c 100755 --- a/cpuhotplug/cpuhotplug_05.sh +++ b/cpuhotplug/cpuhotplug_05.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -25,7 +25,7 @@
# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/Pm...
-source ../include/functions.sh +. ../include/functions.sh
check_procinfo() { local cpu=$1 diff --git a/cpuhotplug/cpuhotplug_06.sh b/cpuhotplug/cpuhotplug_06.sh index 0461e37..df9deaf 100755 --- a/cpuhotplug/cpuhotplug_06.sh +++ b/cpuhotplug/cpuhotplug_06.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -25,7 +25,7 @@
# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/Pm...
-source ../include/functions.sh +. ../include/functions.sh
check_procinfo() { local cpu=$1 diff --git a/cpuhotplug/cpuhotplug_07.sh b/cpuhotplug/cpuhotplug_07.sh index a3526be..05b3a4b 100755 --- a/cpuhotplug/cpuhotplug_07.sh +++ b/cpuhotplug/cpuhotplug_07.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -25,7 +25,7 @@
# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/Pm...
-source ../include/functions.sh +. ../include/functions.sh TMPFILE=cpuhotplug_07.tmp
check_notification() { diff --git a/cpuhotplug/cpuhotplug_08.sh b/cpuhotplug/cpuhotplug_08.sh index c6ef477..f7e51ce 100755 --- a/cpuhotplug/cpuhotplug_08.sh +++ b/cpuhotplug/cpuhotplug_08.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -25,7 +25,7 @@
# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/Pm...
-source ../include/functions.sh +. ../include/functions.sh
function randomize() { if [ $hotplug_allow_cpu0 -eq 0 ]; then diff --git a/cpuhotplug/cpuhotplug_sanity.sh b/cpuhotplug/cpuhotplug_sanity.sh index 9a9df25..d0d36a3 100755 --- a/cpuhotplug/cpuhotplug_sanity.sh +++ b/cpuhotplug/cpuhotplug_sanity.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -23,7 +23,7 @@ # - initial API and implementation #
-source ../include/functions.sh +. ../include/functions.sh
is_root if [ $? -ne 0 ]; then diff --git a/cpuhotplug/z_sanity_check.sh b/cpuhotplug/z_sanity_check.sh index c39413e..c888536 100755 --- a/cpuhotplug/z_sanity_check.sh +++ b/cpuhotplug/z_sanity_check.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -25,7 +25,7 @@
# URL :
-source ../include/functions.sh +. ../include/functions.sh
sanity_check() { local ret=$(cat $CPU_PATH/offline) diff --git a/cpuidle/cpuidle_01.sh b/cpuidle/cpuidle_01.sh index 8aa62c2..777cc34 100755 --- a/cpuidle/cpuidle_01.sh +++ b/cpuidle/cpuidle_01.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -25,7 +25,7 @@
# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/Pm...
-source ../include/functions.sh +. ../include/functions.sh
STATES="desc latency name power time usage" FILES="current_driver current_governor_ro" diff --git a/cpuidle/cpuidle_02.sh b/cpuidle/cpuidle_02.sh index 0056382..61176d7 100755 --- a/cpuidle/cpuidle_02.sh +++ b/cpuidle/cpuidle_02.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -25,7 +25,7 @@
# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/Pm...
-source ../include/functions.sh +. ../include/functions.sh
CPUIDLE_KILLER=./cpuidle_killer
diff --git a/cpuidle/cpuidle_03.sh b/cpuidle/cpuidle_03.sh index 663d385..036ff22 100755 --- a/cpuidle/cpuidle_03.sh +++ b/cpuidle/cpuidle_03.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -25,7 +25,7 @@
# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/Pm...
-source ../include/functions.sh +. ../include/functions.sh
CPUIDLE_KILLER=./cpuidle_killer
diff --git a/cpuidle/cpuidle_sanity.sh b/cpuidle/cpuidle_sanity.sh index 65fe549..594f891 100755 --- a/cpuidle/cpuidle_sanity.sh +++ b/cpuidle/cpuidle_sanity.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -23,7 +23,7 @@ # - initial API and implementation #
-source ../include/functions.sh +. ../include/functions.sh
is_root if [ $? -ne 0 ]; then diff --git a/cputopology/cputopology_01.sh b/cputopology/cputopology_01.sh index 617c9b8..fece00c 100755 --- a/cputopology/cputopology_01.sh +++ b/cputopology/cputopology_01.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -25,7 +25,7 @@
# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/Pm...
-source ../include/functions.sh +. ../include/functions.sh
check_physical_package_id() {
diff --git a/cputopology/cputopology_02.sh b/cputopology/cputopology_02.sh index 84199c2..b0755ea 100755 --- a/cputopology/cputopology_02.sh +++ b/cputopology/cputopology_02.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -25,7 +25,7 @@
# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/Pm...
-source ../include/functions.sh +. ../include/functions.sh
FILES="core_id core_siblings core_siblings_list physical_package_id \ thread_siblings thread_siblings_list" diff --git a/include/functions.sh b/include/functions.sh index ebe96ad..033319b 100644 --- a/include/functions.sh +++ b/include/functions.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -23,7 +23,7 @@ # - initial API and implementation #
-source ../Switches.sh +. ../Switches.sh
CPU_PATH="/sys/devices/system/cpu" TEST_NAME=$(basename ${0%.sh}) diff --git a/include/suspend_functions.sh b/include/suspend_functions.sh index 3be29f5..2e9ee21 100644 --- a/include/suspend_functions.sh +++ b/include/suspend_functions.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # Script to automate suspend / resume # @@ -33,7 +33,7 @@ # - hongbo.zhang@linaro.org, March, 2012 #
-source ./functions.sh +. ../include/functions.sh
LOGDIR='/var/lib/pm-utils' LOGFILE="$LOGDIR/stress.log" diff --git a/include/thermal_functions.sh b/include/thermal_functions.sh index bfc6620..f173e37 100644 --- a/include/thermal_functions.sh +++ b/include/thermal_functions.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # diff --git a/powertop/powertop_01.sh b/powertop/powertop_01.sh index c66b725..7d34a43 100755 --- a/powertop/powertop_01.sh +++ b/powertop/powertop_01.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -25,7 +25,7 @@
# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Doc/QA/Scripts#powerto...
-source ../include/functions.sh +. ../include/functions.sh
run_powertop() {
diff --git a/powertop/powertop_sanity.sh b/powertop/powertop_sanity.sh index 3ae3065..aab019e 100755 --- a/powertop/powertop_sanity.sh +++ b/powertop/powertop_sanity.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -23,7 +23,7 @@ # - initial API and implementation #
-source ../include/functions.sh +. ../include/functions.sh
check_powertop() {
diff --git a/suspend/suspend_01.sh b/suspend/suspend_01.sh index 6ba8d41..bcbcc4b 100755 --- a/suspend/suspend_01.sh +++ b/suspend/suspend_01.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -26,8 +26,8 @@ # URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/Pm...
-source ../include/functions.sh -source ../include/suspend_functions.sh +. ../include/functions.sh +. ../include/suspend_functions.sh
if [ "$suspend_dbus" -eq 0 ]; then log_skip "dbus message suspend test not enabled" diff --git a/suspend/suspend_02.sh b/suspend/suspend_02.sh index 666b6a5..9113434 100755 --- a/suspend/suspend_02.sh +++ b/suspend/suspend_02.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -26,8 +26,8 @@ # URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/Pm...
-source ../include/functions.sh -source ../include/suspend_functions.sh +. ../include/functions.sh +. ../include/suspend_functions.sh
if [ "$suspend_pmsuspend" -eq 0 ]; then log_skip "pm-suspend test not enabled" diff --git a/suspend/suspend_03.sh b/suspend/suspend_03.sh index 474d3f5..70bebc4 100755 --- a/suspend/suspend_03.sh +++ b/suspend/suspend_03.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -26,8 +26,8 @@ # URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/Pm...
-source ../include/functions.sh -source ../include/suspend_functions.sh +. ../include/functions.sh +. ../include/suspend_functions.sh
if [ "$suspend_mem" -eq 0 ]; then log_skip "suspend to ram via sysfs not enabled" diff --git a/suspend/suspend_04.sh b/suspend/suspend_04.sh index 1f62cab..f937c5a 100755 --- a/suspend/suspend_04.sh +++ b/suspend/suspend_04.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -26,8 +26,8 @@ # URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/Pm...
-source ../include/functions.sh -source ../include/suspend_functions.sh +. ../include/functions.sh +. ../include/suspend_functions.sh
if [ "$suspend_ac" -eq 0 ]; then log_skip "suspend test involving ac power remove" diff --git a/suspend/suspend_05.sh b/suspend/suspend_05.sh index 9d5793e..36d613e 100755 --- a/suspend/suspend_05.sh +++ b/suspend/suspend_05.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -26,8 +26,8 @@ # URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/Pm...
-source ../include/functions.sh -source ../include/suspend_functions.sh +. ../include/functions.sh +. ../include/suspend_functions.sh
args_power_sleep=60
diff --git a/suspend/suspend_sanity.sh b/suspend/suspend_sanity.sh index 0f2b5d5..f37eccb 100755 --- a/suspend/suspend_sanity.sh +++ b/suspend/suspend_sanity.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -23,7 +23,7 @@ # - initial API and implementation #
-source ../include/functions.sh +. ../include/functions.sh
is_root if [ $? -ne 0 ]; then diff --git a/thermal/thermal_00.sh b/thermal/thermal_00.sh index cdc5a10..672b0ff 100755 --- a/thermal/thermal_00.sh +++ b/thermal/thermal_00.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -25,8 +25,8 @@
# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Doc/QA/Scripts#thermal...
-source ../include/functions.sh -source ../include/thermal_functions.sh +. ../include/functions.sh +. ../include/thermal_functions.sh
check_cooling_device_type() { local all_zones=$(ls $THERMAL_PATH | grep "cooling_device['$MAX_CDEV']") diff --git a/thermal/thermal_01.sh b/thermal/thermal_01.sh index dac26d1..57f64a7 100755 --- a/thermal/thermal_01.sh +++ b/thermal/thermal_01.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -25,8 +25,8 @@
# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/Pm...
-source ../include/functions.sh -source ../include/thermal_functions.sh +. ../include/functions.sh +. ../include/thermal_functions.sh
ATTRIBUTES="mode temp type uevent"
diff --git a/thermal/thermal_02.sh b/thermal/thermal_02.sh index 1f53612..8105d80 100755 --- a/thermal/thermal_02.sh +++ b/thermal/thermal_02.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -25,8 +25,8 @@
# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/Pm...
-source ../include/functions.sh -source ../include/thermal_functions.sh +. ../include/functions.sh +. ../include/thermal_functions.sh
CDEV_ATTRIBUTES="cur_state max_state type uevent"
diff --git a/thermal/thermal_03.sh b/thermal/thermal_03.sh index cf53a1a..a4504f5 100755 --- a/thermal/thermal_03.sh +++ b/thermal/thermal_03.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -25,8 +25,8 @@
# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/Pm...
-source ../include/functions.sh -source ../include/thermal_functions.sh +. ../include/functions.sh +. ../include/thermal_functions.sh
CPU_HEAT_BIN=../utils/heat_cpu cpu_pid=0 diff --git a/thermal/thermal_04.sh b/thermal/thermal_04.sh index 8bf3799..058920c 100755 --- a/thermal/thermal_04.sh +++ b/thermal/thermal_04.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -25,8 +25,8 @@
# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/Pm...
-source ../include/functions.sh -source ../include/thermal_functions.sh +. ../include/functions.sh +. ../include/thermal_functions.sh HEAT_CPU_MODERATE=../utils/heat_cpu pid=0
diff --git a/thermal/thermal_05.sh b/thermal/thermal_05.sh index 52a0ac2..68c44d3 100755 --- a/thermal/thermal_05.sh +++ b/thermal/thermal_05.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -25,8 +25,8 @@
# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/Pm...
-source ../include/functions.sh -source ../include/thermal_functions.sh +. ../include/functions.sh +. ../include/thermal_functions.sh
verify_cpufreq_cooling_device_action() { local dirpath=$THERMAL_PATH/$1 diff --git a/thermal/thermal_06.sh b/thermal/thermal_06.sh index d8877f0..5c80b6a 100755 --- a/thermal/thermal_06.sh +++ b/thermal/thermal_06.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -25,8 +25,8 @@
# URL : https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/Pm...
-source ../include/functions.sh -source ../include/thermal_functions.sh +. ../include/functions.sh +. ../include/thermal_functions.sh
if [ "$thermal_try_max" -eq 0 ]; then log_skip "test of trip points being crossed" diff --git a/thermal/thermal_sanity.sh b/thermal/thermal_sanity.sh index c9149c0..1e5b5af 100755 --- a/thermal/thermal_sanity.sh +++ b/thermal/thermal_sanity.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -23,8 +23,8 @@ # - initial API and implementation #
-source ../include/functions.sh -source ../include/thermal_functions.sh +. ../include/functions.sh +. ../include/thermal_functions.sh
is_root if [ $? -ne 0 ]; then diff --git a/utils/utils_sanity.sh b/utils/utils_sanity.sh index 84f4905..c5bdcd7 100755 --- a/utils/utils_sanity.sh +++ b/utils/utils_sanity.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # PM-QA validation test suite for the power management on Linux # @@ -23,7 +23,7 @@ # - initial API and implementation #
-source ../include/functions.sh +. ../include/functions.sh
is_root if [ $? -ne 0 ]; then
Using double equals to evaluate whether two conditions are equal is considered BASH syntax. The POSIX compliant version uses one equal sign for evaluating.
Signed-off-by: Lisa Nguyen lisa.nguyen@linaro.org --- cpufreq/cpufreq_03.sh | 2 +- cpufreq/cpufreq_04.sh | 2 +- cpufreq/cpufreq_07.sh | 4 ++-- cpufreq/cpufreq_08.sh | 2 +- cpufreq/cpufreq_09.sh | 4 ++-- cpuhotplug/cpuhotplug_02.sh | 2 +- 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 +- include/functions.sh | 8 ++++---- include/thermal_functions.sh | 2 +- 13 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/cpufreq/cpufreq_03.sh b/cpufreq/cpufreq_03.sh index 8aeeeb2..acd1c2a 100755 --- a/cpufreq/cpufreq_03.sh +++ b/cpufreq/cpufreq_03.sh @@ -38,7 +38,7 @@ check_governor() {
set_governor $cpu $newgov
- check "governor change to '$newgov'" "test "$(get_governor $cpu)" == "$newgov"" + check "governor change to '$newgov'" "test "$(get_governor $cpu)" = "$newgov""
set_governor $cpu $oldgov } diff --git a/cpufreq/cpufreq_04.sh b/cpufreq/cpufreq_04.sh index 71ee69d..98b0fa1 100755 --- a/cpufreq/cpufreq_04.sh +++ b/cpufreq/cpufreq_04.sh @@ -40,7 +40,7 @@ check_frequency() { set_governor $cpu userspace set_frequency $cpu $newfreq
- check "setting frequency '$(frequnit $newfreq)'" "test "$(get_frequency $cpu)" == "$newfreq"" + check "setting frequency '$(frequnit $newfreq)'" "test "$(get_frequency $cpu)" = "$newfreq""
set_frequency $cpu $oldfreq set_governor $cpu $oldgov diff --git a/cpufreq/cpufreq_07.sh b/cpufreq/cpufreq_07.sh index aef991f..2568b72 100755 --- a/cpufreq/cpufreq_07.sh +++ b/cpufreq/cpufreq_07.sh @@ -52,12 +52,12 @@ check_ondemand() { 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)
- check "'ondemand' decrease frequency on idle" "test "$curfreq" == "$minfreq"" + check "'ondemand' decrease frequency on idle" "test "$curfreq" = "$minfreq""
return 0 fi diff --git a/cpufreq/cpufreq_08.sh b/cpufreq/cpufreq_08.sh index 3cc60f8..8eae7c0 100755 --- a/cpufreq/cpufreq_08.sh +++ b/cpufreq/cpufreq_08.sh @@ -44,7 +44,7 @@ check_frequency() { curfreq=$(get_frequency $cpu) kill $pid
- check "'userspace' $(frequnit $freq) is fixed" "test "$curfreq" == "$freq"" + check "'userspace' $(frequnit $freq) is fixed" "test "$curfreq" = "$freq"" if [ "$?" != "0" ]; then return 1 fi diff --git a/cpufreq/cpufreq_09.sh b/cpufreq/cpufreq_09.sh index f502b83..f227b62 100755 --- a/cpufreq/cpufreq_09.sh +++ b/cpufreq/cpufreq_09.sh @@ -40,7 +40,7 @@ check_powersave() { wait_latency $cpu curfreq=$(get_frequency $cpu)
- check "'powersave' sets frequency to $(frequnit $minfreq)" "test "$curfreq" == "$minfreq"" + check "'powersave' sets frequency to $(frequnit $minfreq)" "test "$curfreq" = "$minfreq"" if [ "$?" != "0" ]; then return 1 fi @@ -52,7 +52,7 @@ check_powersave() { curfreq=$(get_frequency $cpu) kill $pid
- check "'powersave' frequency $(frequnit $minfreq) is fixed" "test "$curfreq" == "$minfreq"" + check "'powersave' frequency $(frequnit $minfreq) is fixed" "test "$curfreq" = "$minfreq"" if [ "$?" -ne "0" ]; then return 1 fi diff --git a/cpuhotplug/cpuhotplug_02.sh b/cpuhotplug/cpuhotplug_02.sh index 8caf5e6..564cb30 100755 --- a/cpuhotplug/cpuhotplug_02.sh +++ b/cpuhotplug/cpuhotplug_02.sh @@ -33,7 +33,7 @@ check_state() { local state= shift 1
- if [ "$cpu" == "cpu0" ]; then + if [ "$cpu" = "cpu0" ]; then is_cpu0_hotplug_allowed $hotplug_allow_cpu0 || return 0 fi
diff --git a/cpuhotplug/cpuhotplug_03.sh b/cpuhotplug/cpuhotplug_03.sh index 91c29ef..c32f6a4 100755 --- a/cpuhotplug/cpuhotplug_03.sh +++ b/cpuhotplug/cpuhotplug_03.sh @@ -33,7 +33,7 @@ check_affinity_fails() { local dirpath=$CPU_PATH/$1 local ret=
- if [ "$cpu" == "cpu0" ]; then + if [ "$cpu" = "cpu0" ]; then is_cpu0_hotplug_allowed $hotplug_allow_cpu0 || return 0 fi
diff --git a/cpuhotplug/cpuhotplug_04.sh b/cpuhotplug/cpuhotplug_04.sh index 1f7efa7..1e3e8c1 100755 --- a/cpuhotplug/cpuhotplug_04.sh +++ b/cpuhotplug/cpuhotplug_04.sh @@ -36,7 +36,7 @@ check_task_migrate() { local pid= local ret=
- if [ "$cpu" == "cpu0" ]; then + if [ "$cpu" = "cpu0" ]; then is_cpu0_hotplug_allowed $hotplug_allow_cpu0 || return 0 fi
diff --git a/cpuhotplug/cpuhotplug_05.sh b/cpuhotplug/cpuhotplug_05.sh index 28f6f8c..71baf2c 100755 --- a/cpuhotplug/cpuhotplug_05.sh +++ b/cpuhotplug/cpuhotplug_05.sh @@ -32,7 +32,7 @@ check_procinfo() { local cpuid=${cpu:3} local ret=
- if [ "$cpu" == "cpu0" ]; then + if [ "$cpu" = "cpu0" ]; then is_cpu0_hotplug_allowed $hotplug_allow_cpu0 || return 0 fi
diff --git a/cpuhotplug/cpuhotplug_06.sh b/cpuhotplug/cpuhotplug_06.sh index df9deaf..a774438 100755 --- a/cpuhotplug/cpuhotplug_06.sh +++ b/cpuhotplug/cpuhotplug_06.sh @@ -32,7 +32,7 @@ check_procinfo() { local cpuid=${cpu:3} local ret=
- if [ "$cpu" == "cpu0" ]; then + if [ "$cpu" = "cpu0" ]; then is_cpu0_hotplug_allowed $hotplug_allow_cpu0 || return 0 fi
diff --git a/cpuhotplug/cpuhotplug_07.sh b/cpuhotplug/cpuhotplug_07.sh index 05b3a4b..c1f5e2c 100755 --- a/cpuhotplug/cpuhotplug_07.sh +++ b/cpuhotplug/cpuhotplug_07.sh @@ -34,7 +34,7 @@ check_notification() { local pid= local ret=
- if [ "$cpu" == "cpu0" ]; then + if [ "$cpu" = "cpu0" ]; then is_cpu0_hotplug_allowed $hotplug_allow_cpu0 || return 0 fi
diff --git a/include/functions.sh b/include/functions.sh index 033319b..35ca21d 100644 --- a/include/functions.sh +++ b/include/functions.sh @@ -50,9 +50,9 @@ test_status_show() { fi
echo " " - if [[ "$test_script_status" == "fail" ]]; then + if [ "$test_script_status" = "fail" ]; then echo "$TEST_NAME: fail" - elif [[ "$test_script_status" == "skip" ]]; then + elif [ "$test_script_status" = "skip" ]; then echo "$TEST_NAME: skip" else echo "$TEST_NAME: pass" @@ -79,9 +79,9 @@ log_begin() { log_end() { printf "$*\n"
- if [[ "$*" == "Err" ]]; then + if [ "$*" = "Err" ]; then fail_count=$((fail_count + 1)) - elif [[ "$*" == "skip" ]]; then + elif [ "$*" = "skip" ]; then skip_count=$((skip_count + 1)) else pass_count=$((pass_count + 1)) diff --git a/include/thermal_functions.sh b/include/thermal_functions.sh index f173e37..59f79a3 100644 --- a/include/thermal_functions.sh +++ b/include/thermal_functions.sh @@ -163,7 +163,7 @@ for_each_cooling_device() { shift 1
devices=$(ls $THERMAL_PATH | grep "cooling_device['$MAX_CDEV']") - if [ "$devices" == "" ]; then + if [ "$devices" = "" ]; then log_skip "no cooling devices" return 0 fi
Remove signals that begin with SIG* since that is considered a bashism. Use the POSIX-compliant version to list signals to be used with the trap command.
Signed-off-by: Lisa Nguyen lisa.nguyen@linaro.org --- cpufreq/cpufreq_05.sh | 2 +- cpufreq/cpufreq_06.sh | 2 +- cpufreq/cpufreq_07.sh | 2 +- cpufreq/cpufreq_08.sh | 2 +- cpufreq/cpufreq_09.sh | 2 +- cpuidle/cpuidle_03.sh | 2 +- thermal/thermal_03.sh | 2 +- thermal/thermal_04.sh | 2 +- thermal/thermal_06.sh | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/cpufreq/cpufreq_05.sh b/cpufreq/cpufreq_05.sh index 8df5ba2..f74a23e 100755 --- a/cpufreq/cpufreq_05.sh +++ b/cpufreq/cpufreq_05.sh @@ -29,7 +29,7 @@
save_governors
-trap restore_governors SIGHUP SIGINT SIGTERM +trap restore_governors HUP INT TERM
switch_ondemand() { local cpu=$1 diff --git a/cpufreq/cpufreq_06.sh b/cpufreq/cpufreq_06.sh index fedec0f..803b937 100755 --- a/cpufreq/cpufreq_06.sh +++ b/cpufreq/cpufreq_06.sh @@ -110,7 +110,7 @@ fi save_governors save_frequencies
-trap "restore_frequencies; restore_governors; sigtrap" SIGHUP SIGINT SIGTERM +trap "restore_frequencies; restore_governors; sigtrap" HUP INT TERM
for_each_cpu check_deviation
diff --git a/cpufreq/cpufreq_07.sh b/cpufreq/cpufreq_07.sh index 2568b72..9f41c49 100755 --- a/cpufreq/cpufreq_07.sh +++ b/cpufreq/cpufreq_07.sh @@ -79,7 +79,7 @@ fi
save_governors
-trap "restore_governors; sigtrap" SIGHUP SIGINT SIGTERM +trap "restore_governors; sigtrap" HUP INT TERM
for_each_cpu check_ondemand
diff --git a/cpufreq/cpufreq_08.sh b/cpufreq/cpufreq_08.sh index 8eae7c0..29b2b9f 100755 --- a/cpufreq/cpufreq_08.sh +++ b/cpufreq/cpufreq_08.sh @@ -72,7 +72,7 @@ if [ -z "$supported" ]; then return 0 fi
-trap "restore_governors; sigtrap" SIGHUP SIGINT SIGTERM +trap "restore_governors; sigtrap" HUP INT TERM
for_each_cpu check_userspace
diff --git a/cpufreq/cpufreq_09.sh b/cpufreq/cpufreq_09.sh index f227b62..746c7de 100755 --- a/cpufreq/cpufreq_09.sh +++ b/cpufreq/cpufreq_09.sh @@ -68,7 +68,7 @@ if [ -z "$supported" ]; then return 0 fi
-trap "restore_governors; sigtrap" SIGHUP SIGINT SIGTERM +trap "restore_governors; sigtrap" HUP INT TERM
for_each_cpu check_powersave
diff --git a/cpuidle/cpuidle_03.sh b/cpuidle/cpuidle_03.sh index 036ff22..5dbf37f 100755 --- a/cpuidle/cpuidle_03.sh +++ b/cpuidle/cpuidle_03.sh @@ -49,7 +49,7 @@ check_cpuidle_kill() { check "cpuidle program runs successfully (120 secs)" "./$CPUIDLE_KILLER" }
-trap "restore_cpus; sigtrap" SIGHUP SIGINT SIGTERM +trap "restore_cpus; sigtrap" HUP INT TERM
for_each_cpu check_cpuidle_kill restore_cpus diff --git a/thermal/thermal_03.sh b/thermal/thermal_03.sh index a4504f5..42082f0 100755 --- a/thermal/thermal_03.sh +++ b/thermal/thermal_03.sh @@ -58,7 +58,7 @@ check_temperature_change() { check "temperature variation with load" "test $final_temp -gt $init_temp" }
-trap "heater_kill; sigtrap" SIGHUP SIGINT SIGTERM +trap "heater_kill; sigtrap" HUP INT TERM
for_each_thermal_zone check_temperature_change test_status_show diff --git a/thermal/thermal_04.sh b/thermal/thermal_04.sh index 058920c..932903c 100755 --- a/thermal/thermal_04.sh +++ b/thermal/thermal_04.sh @@ -75,7 +75,7 @@ verify_cooling_device_temp_change() { echo $prev_state_val > $dirpath/cur_state }
-trap "heater_kill; sigtrap" SIGHUP SIGINT SIGTERM +trap "heater_kill; sigtrap" HUP INT TERM
set_thermal_governors user_space
diff --git a/thermal/thermal_06.sh b/thermal/thermal_06.sh index 5c80b6a..978a526 100755 --- a/thermal/thermal_06.sh +++ b/thermal/thermal_06.sh @@ -100,7 +100,7 @@ check_trip_point_change() { heater_kill }
-trap "heater_kill; sigtrap" SIGHUP SIGINT SIGTERM +trap "heater_kill; sigtrap" HUP INT TERM
for_each_thermal_zone check_trip_point_change test_status_show
Remove keywords such as "let", "typeset", and "local" that are defined in BASH. Also, clean up any unused variables in the process.
Signed-off-by: Lisa Nguyen lisa.nguyen@linaro.org --- cpufreq/cpufreq_03.sh | 6 +-- cpufreq/cpufreq_04.sh | 8 +-- cpufreq/cpufreq_05.sh | 10 ++-- cpufreq/cpufreq_06.sh | 10 ++-- cpufreq/cpufreq_07.sh | 9 ++-- cpufreq/cpufreq_08.sh | 14 +++--- cpufreq/cpufreq_09.sh | 6 +-- cpufreq/cpufreq_sanity.sh | 2 +- cpuhotplug/1_sanity_check.sh | 2 +- cpuhotplug/cpuhotplug_02.sh | 5 +- cpuhotplug/cpuhotplug_03.sh | 7 ++- cpuhotplug/cpuhotplug_04.sh | 10 ++-- cpuhotplug/cpuhotplug_05.sh | 5 +- cpuhotplug/cpuhotplug_06.sh | 5 +- cpuhotplug/cpuhotplug_07.sh | 6 +-- cpuhotplug/cpuhotplug_08.sh | 5 +- cpuhotplug/z_sanity_check.sh | 2 +- cpuidle/cpuidle_01.sh | 4 +- cpuidle/cpuidle_sanity.sh | 2 +- cputopology/cputopology_01.sh | 4 +- include/functions.sh | 108 ++++++++++++++++++---------------------- include/suspend_functions.sh | 10 ++-- include/thermal_functions.sh | 109 ++++++++++++++++++++--------------------- powertop/powertop_01.sh | 14 +++--- powertop/powertop_sanity.sh | 2 +- suspend/suspend_05.sh | 8 +-- thermal/thermal_00.sh | 8 +-- thermal/thermal_01.sh | 18 +++---- thermal/thermal_02.sh | 16 +++--- thermal/thermal_03.sh | 8 +-- thermal/thermal_04.sh | 20 ++++---- thermal/thermal_05.sh | 18 +++---- thermal/thermal_06.sh | 18 +++---- 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))
Fix the syntax to get the current cpu id number with the POSIX version.
Signed-off-by: Lisa Nguyen lisa.nguyen@linaro.org --- 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 +- 5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/cpuhotplug/cpuhotplug_03.sh b/cpuhotplug/cpuhotplug_03.sh index b506c0d..689fc8a 100755 --- a/cpuhotplug/cpuhotplug_03.sh +++ b/cpuhotplug/cpuhotplug_03.sh @@ -29,7 +29,7 @@
check_affinity_fails() { cpu=$1 - cpuid=${cpu:3} + cpuid=$(echo $cpu | awk '{print substr($0,4)}') dirpath=$CPU_PATH/$1
if [ "$cpu" = "cpu0" ]; then diff --git a/cpuhotplug/cpuhotplug_04.sh b/cpuhotplug/cpuhotplug_04.sh index 228703b..18a8e9c 100755 --- a/cpuhotplug/cpuhotplug_04.sh +++ b/cpuhotplug/cpuhotplug_04.sh @@ -30,7 +30,7 @@ CPUBURN=../utils/cpuburn
check_task_migrate() { cpu=$1 - cpuid=${cpu:3} + cpuid=$(echo $cpu | awk '{print substr($0,4)}') cpumask=$((1 << cpuid)) dirpath=$CPU_PATH/$1
diff --git a/cpuhotplug/cpuhotplug_05.sh b/cpuhotplug/cpuhotplug_05.sh index 7d755dd..960150a 100755 --- a/cpuhotplug/cpuhotplug_05.sh +++ b/cpuhotplug/cpuhotplug_05.sh @@ -29,7 +29,7 @@
check_procinfo() { cpu=$1 - cpuid=${cpu:3} + cpuid=$(echo $cpu | awk '{print substr($0,4)}')
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 b0eae44..e1e59e3 100755 --- a/cpuhotplug/cpuhotplug_06.sh +++ b/cpuhotplug/cpuhotplug_06.sh @@ -29,7 +29,7 @@
check_procinfo() { cpu=$1 - cpuid=${cpu:3} + cpuid=$(echo $cpu | awk '{print substr($0,4)}')
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 239855f..8ae9f72 100755 --- a/cpuhotplug/cpuhotplug_07.sh +++ b/cpuhotplug/cpuhotplug_07.sh @@ -30,7 +30,7 @@ TMPFILE=cpuhotplug_07.tmp
check_notification() { cpu=$1 - cpuid=${cpu:3} + cpuid=$(echo $cpu | awk '{print substr($0,4)}')
if [ "$cpu" = "cpu0" ]; then is_cpu0_hotplug_allowed $hotplug_allow_cpu0 || return 0
The value of the thermal_try_max variable does not change when running PM-QA. There is no reason to check if the value is zero if it's hardly used at all.
Signed-off-by: Lisa Nguyen lisa.nguyen@linaro.org --- Switches.sh | 3 --- thermal/thermal_06.sh | 5 ----- 2 files changed, 8 deletions(-)
diff --git a/Switches.sh b/Switches.sh index cc59992..1ea1cd9 100644 --- a/Switches.sh +++ b/Switches.sh @@ -1,8 +1,5 @@ # These are switches to enable/disable some tests.
-# Thermal tests -export thermal_try_max=0 - # Suspend tests export suspend_dbus=0 export suspend_pmsuspend=1 diff --git a/thermal/thermal_06.sh b/thermal/thermal_06.sh index 2929605..9d62a07 100755 --- a/thermal/thermal_06.sh +++ b/thermal/thermal_06.sh @@ -28,11 +28,6 @@ . ../include/functions.sh . ../include/thermal_functions.sh
-if [ "$thermal_try_max" -eq 0 ]; then - log_skip "test of trip points being crossed" - return 0 -fi - TEST_LOOP=100 CPU_HEAT_BIN=../utils/heat_cpu cpu_pid=0
Add an entry in Switches.sh to export and set the hotplug_allow_cpu0 variable to zero. This will resolve Android issues where invalid comparisons cannot be made in the cpuhotplug scripts. Android runs the Switches.sh script before it runs any test modules.
Signed-off-by: Lisa Nguyen lisa.nguyen@linaro.org --- Switches.sh | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/Switches.sh b/Switches.sh index 1ea1cd9..ed67481 100644 --- a/Switches.sh +++ b/Switches.sh @@ -6,3 +6,6 @@ export suspend_pmsuspend=1 export suspend_mem=1 export suspend_ac=0 export suspend_power=0 + +# Disable hotplugging cpu0 by default +hotplug_allow_cpu0=0
$RANDOM is a BASH defined variable. Rewrite the randomize() function to be POSIX-compliant.
Signed-off-by: Lisa Nguyen lisa.nguyen@linaro.org --- cpuhotplug/cpuhotplug_08.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/cpuhotplug/cpuhotplug_08.sh b/cpuhotplug/cpuhotplug_08.sh index 43948cf..de4fea8 100755 --- a/cpuhotplug/cpuhotplug_08.sh +++ b/cpuhotplug/cpuhotplug_08.sh @@ -27,12 +27,15 @@
. ../include/functions.sh
-function randomize() { +randomize() { + random=$(od -A n -N 2 -t u2 /dev/urandom) + number=$(echo $random % $1) + if [ $hotplug_allow_cpu0 -eq 0 ]; then - echo $[ ( $RANDOM % $1 ) + 1 ] - else - echo $[ ( $RANDOM % $1 ) ] + number=$(($number + 1)) fi + + echo $number }
random_stress() {
In PM-QA, there are programs written in C (e.g. cpuidle_killer, uevent_reader) that run in the background while some scripts are being.
However, remove the extra slash and period when it's not necessary and create variables to store the path of these programs.
Signed-off-by: Lisa Nguyen lisa.nguyen@linaro.org --- cpuhotplug/cpuhotplug_07.sh | 4 +++- cpuidle/cpuidle_02.sh | 2 +- cpuidle/cpuidle_03.sh | 2 +- include/functions.sh | 3 ++- thermal/thermal_04.sh | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/cpuhotplug/cpuhotplug_07.sh b/cpuhotplug/cpuhotplug_07.sh index 8ae9f72..2e81f28 100755 --- a/cpuhotplug/cpuhotplug_07.sh +++ b/cpuhotplug/cpuhotplug_07.sh @@ -27,6 +27,7 @@
. ../include/functions.sh TMPFILE=cpuhotplug_07.tmp +UEVENT_READER="../utils/uevent_reader"
check_notification() { cpu=$1 @@ -38,8 +39,9 @@ check_notification() {
# damn ! udevadm is buffering the output, we have to use a temp file # to retrieve the output + rm -f $TMPFILE - ../utils/uevent_reader $TMPFILE & + $UEVENT_READER $TMPFILE & pid=$! sleep 1
diff --git a/cpuidle/cpuidle_02.sh b/cpuidle/cpuidle_02.sh index 61176d7..4242e24 100755 --- a/cpuidle/cpuidle_02.sh +++ b/cpuidle/cpuidle_02.sh @@ -29,5 +29,5 @@
CPUIDLE_KILLER=./cpuidle_killer
-check "cpuidle program runs successfully (120 secs)" "./$CPUIDLE_KILLER" +check "cpuidle program runs successfully (120 secs)" "$CPUIDLE_KILLER" test_status_show diff --git a/cpuidle/cpuidle_03.sh b/cpuidle/cpuidle_03.sh index 5dbf37f..26d3e28 100755 --- a/cpuidle/cpuidle_03.sh +++ b/cpuidle/cpuidle_03.sh @@ -46,7 +46,7 @@ check_cpuidle_kill() { fi
set_offline $1 - check "cpuidle program runs successfully (120 secs)" "./$CPUIDLE_KILLER" + check "cpuidle program runs successfully (120 secs)" "$CPUIDLE_KILLER" }
trap "restore_cpus; sigtrap" HUP INT TERM diff --git a/include/functions.sh b/include/functions.sh index 2ffdb36..97930ae 100644 --- a/include/functions.sh +++ b/include/functions.sh @@ -34,6 +34,7 @@ pass_count=0 fail_count=0 skip_count=0 test_script_status="pass" +nanosleep="../utils/nanosleep"
test_status_show() { if [ $fail_count -ne 0 ]; then @@ -180,7 +181,7 @@ wait_latency() {
sleep_time=$(($latency + $sampling_rate))
- ../utils/nanosleep $(($nrfreq * $sleep_time)) + $nanosleep $(($nrfreq * $sleep_time)) }
frequnit() { diff --git a/thermal/thermal_04.sh b/thermal/thermal_04.sh index 37c65f6..b290c5a 100755 --- a/thermal/thermal_04.sh +++ b/thermal/thermal_04.sh @@ -54,7 +54,7 @@ verify_cooling_device_temp_change() { init_temp=0 final_temp=0 cool_temp=0 - ./$HEAT_CPU_MODERATE moderate & + $HEAT_CPU_MODERATE moderate & pid=$! test $pid -eq 0 && return
On Mon, Feb 2, 2015 at 7:34 AM, Lisa Nguyen lisa.nguyen@linaro.org wrote:
In PM-QA, there are programs written in C (e.g. cpuidle_killer, uevent_reader) that run in the background while some scripts are being.
However, remove the extra slash and period when it's not necessary and create variables to store the path of these programs.
Signed-off-by: Lisa Nguyen lisa.nguyen@linaro.org
cpuhotplug/cpuhotplug_07.sh | 4 +++- cpuidle/cpuidle_02.sh | 2 +- cpuidle/cpuidle_03.sh | 2 +- include/functions.sh | 3 ++- thermal/thermal_04.sh | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/cpuhotplug/cpuhotplug_07.sh b/cpuhotplug/cpuhotplug_07.sh index 8ae9f72..2e81f28 100755 --- a/cpuhotplug/cpuhotplug_07.sh +++ b/cpuhotplug/cpuhotplug_07.sh @@ -27,6 +27,7 @@
. ../include/functions.sh TMPFILE=cpuhotplug_07.tmp +UEVENT_READER="../utils/uevent_reader"
check_notification() { cpu=$1 @@ -38,8 +39,9 @@ check_notification() {
# damn ! udevadm is buffering the output, we have to use a temp file # to retrieve the output
- rm -f $TMPFILE
- ../utils/uevent_reader $TMPFILE &
- $UEVENT_READER $TMPFILE & pid=$! sleep 1
diff --git a/cpuidle/cpuidle_02.sh b/cpuidle/cpuidle_02.sh index 61176d7..4242e24 100755 --- a/cpuidle/cpuidle_02.sh +++ b/cpuidle/cpuidle_02.sh @@ -29,5 +29,5 @@
CPUIDLE_KILLER=./cpuidle_killer
-check "cpuidle program runs successfully (120 secs)" "./$CPUIDLE_KILLER" +check "cpuidle program runs successfully (120 secs)" "$CPUIDLE_KILLER" test_status_show diff --git a/cpuidle/cpuidle_03.sh b/cpuidle/cpuidle_03.sh index 5dbf37f..26d3e28 100755 --- a/cpuidle/cpuidle_03.sh +++ b/cpuidle/cpuidle_03.sh @@ -46,7 +46,7 @@ check_cpuidle_kill() { fi
set_offline $1
- check "cpuidle program runs successfully (120 secs)" "./$CPUIDLE_KILLER"
- check "cpuidle program runs successfully (120 secs)" "$CPUIDLE_KILLER"
}
trap "restore_cpus; sigtrap" HUP INT TERM diff --git a/include/functions.sh b/include/functions.sh index 2ffdb36..97930ae 100644 --- a/include/functions.sh +++ b/include/functions.sh @@ -34,6 +34,7 @@ pass_count=0 fail_count=0 skip_count=0 test_script_status="pass" +nanosleep="../utils/nanosleep"
If you're using ALL CAPs variable names for all the external programs, why leave this one out? :)
test_status_show() { if [ $fail_count -ne 0 ]; then @@ -180,7 +181,7 @@ wait_latency() {
sleep_time=$(($latency + $sampling_rate))
- ../utils/nanosleep $(($nrfreq * $sleep_time))
- $nanosleep $(($nrfreq * $sleep_time))
}
frequnit() { diff --git a/thermal/thermal_04.sh b/thermal/thermal_04.sh index 37c65f6..b290c5a 100755 --- a/thermal/thermal_04.sh +++ b/thermal/thermal_04.sh @@ -54,7 +54,7 @@ verify_cooling_device_temp_change() { init_temp=0 final_temp=0 cool_temp=0
- ./$HEAT_CPU_MODERATE moderate &
- $HEAT_CPU_MODERATE moderate & pid=$! test $pid -eq 0 && return
-- 1.7.9.5
On 1 February 2015 at 21:44, Amit Kucheria amit.kucheria@linaro.org wrote:
On Mon, Feb 2, 2015 at 7:34 AM, Lisa Nguyen lisa.nguyen@linaro.org wrote:
In PM-QA, there are programs written in C (e.g. cpuidle_killer, uevent_reader) that run in the background while some scripts are being.
However, remove the extra slash and period when it's not necessary and create variables to store the path of these programs.
Signed-off-by: Lisa Nguyen lisa.nguyen@linaro.org
cpuhotplug/cpuhotplug_07.sh | 4 +++- cpuidle/cpuidle_02.sh | 2 +- cpuidle/cpuidle_03.sh | 2 +- include/functions.sh | 3 ++- thermal/thermal_04.sh | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/cpuhotplug/cpuhotplug_07.sh b/cpuhotplug/cpuhotplug_07.sh index 8ae9f72..2e81f28 100755 --- a/cpuhotplug/cpuhotplug_07.sh +++ b/cpuhotplug/cpuhotplug_07.sh @@ -27,6 +27,7 @@
. ../include/functions.sh TMPFILE=cpuhotplug_07.tmp +UEVENT_READER="../utils/uevent_reader"
check_notification() { cpu=$1 @@ -38,8 +39,9 @@ check_notification() {
# damn ! udevadm is buffering the output, we have to use a temp file # to retrieve the output
- rm -f $TMPFILE
- ../utils/uevent_reader $TMPFILE &
- $UEVENT_READER $TMPFILE & pid=$! sleep 1
diff --git a/cpuidle/cpuidle_02.sh b/cpuidle/cpuidle_02.sh index 61176d7..4242e24 100755 --- a/cpuidle/cpuidle_02.sh +++ b/cpuidle/cpuidle_02.sh @@ -29,5 +29,5 @@
CPUIDLE_KILLER=./cpuidle_killer
-check "cpuidle program runs successfully (120 secs)" "./$CPUIDLE_KILLER" +check "cpuidle program runs successfully (120 secs)" "$CPUIDLE_KILLER" test_status_show diff --git a/cpuidle/cpuidle_03.sh b/cpuidle/cpuidle_03.sh index 5dbf37f..26d3e28 100755 --- a/cpuidle/cpuidle_03.sh +++ b/cpuidle/cpuidle_03.sh @@ -46,7 +46,7 @@ check_cpuidle_kill() { fi
set_offline $1
- check "cpuidle program runs successfully (120 secs)" "./$CPUIDLE_KILLER"
- check "cpuidle program runs successfully (120 secs)" "$CPUIDLE_KILLER"
}
trap "restore_cpus; sigtrap" HUP INT TERM diff --git a/include/functions.sh b/include/functions.sh index 2ffdb36..97930ae 100644 --- a/include/functions.sh +++ b/include/functions.sh @@ -34,6 +34,7 @@ pass_count=0 fail_count=0 skip_count=0 test_script_status="pass" +nanosleep="../utils/nanosleep"
If you're using ALL CAPs variable names for all the external programs, why leave this one out? :)
Good point. Will be an easy fix for later.
test_status_show() { if [ $fail_count -ne 0 ]; then @@ -180,7 +181,7 @@ wait_latency() {
sleep_time=$(($latency + $sampling_rate))
- ../utils/nanosleep $(($nrfreq * $sleep_time))
- $nanosleep $(($nrfreq * $sleep_time))
}
frequnit() { diff --git a/thermal/thermal_04.sh b/thermal/thermal_04.sh index 37c65f6..b290c5a 100755 --- a/thermal/thermal_04.sh +++ b/thermal/thermal_04.sh @@ -54,7 +54,7 @@ verify_cooling_device_temp_change() { init_temp=0 final_temp=0 cool_temp=0
- ./$HEAT_CPU_MODERATE moderate &
- $HEAT_CPU_MODERATE moderate & pid=$! test $pid -eq 0 && return
-- 1.7.9.5
Instead of using a command to check if the user is root, use the is_root() function to perform that check in the cpuidle_03.sh script
Signed-off-by: Lisa Nguyen lisa.nguyen@linaro.org --- cpuidle/cpuidle_03.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/cpuidle/cpuidle_03.sh b/cpuidle/cpuidle_03.sh index 26d3e28..d82e5e3 100755 --- a/cpuidle/cpuidle_03.sh +++ b/cpuidle/cpuidle_03.sh @@ -29,7 +29,8 @@
CPUIDLE_KILLER=./cpuidle_killer
-if [ $(id -u) -ne 0 ]; then +is_root +if [ $? -ne 0 ]; then log_skip "run as non-root" exit 0 fi
Remove unused variables and rename some variables to avoid conflicts since they are global. Also, renaming variables will make it easier to understand what variables are assigned to them.
Signed-off-by: Lisa Nguyen lisa.nguyen@linaro.org --- cpuhotplug/cpuhotplug_02.sh | 6 +- cpuhotplug/cpuhotplug_03.sh | 5 +- cpuhotplug/cpuhotplug_04.sh | 1 - cpuhotplug/cpuhotplug_07.sh | 1 - include/functions.sh | 136 +++++++++++++++++++++--------------------- include/thermal_functions.sh | 45 +++++++------- thermal/thermal_01.sh | 22 ++++--- 7 files changed, 103 insertions(+), 113 deletions(-)
diff --git a/cpuhotplug/cpuhotplug_02.sh b/cpuhotplug/cpuhotplug_02.sh index 2c87861..c21d1b6 100755 --- a/cpuhotplug/cpuhotplug_02.sh +++ b/cpuhotplug/cpuhotplug_02.sh @@ -29,7 +29,7 @@
check_state() { cpu=$1 - dirpath=$CPU_PATH/$1 + dirpath=$CPU_PATH/$cpu shift 1
if [ "$cpu" = "cpu0" ]; then @@ -39,7 +39,7 @@ check_state() { set_offline $cpu state=$(get_online $cpu)
- check "cpu is offline" "test $state -eq 0" + check "$cpu is offline" "test $state -eq 0" if [ $? -ne 0 ]; then set_online $cpu return 1 @@ -48,7 +48,7 @@ check_state() { set_online $cpu state=$(get_online $cpu)
- check "cpu is online" "test $state -eq 1" + check "$cpu is online" "test $state -eq 1" if [ $? -ne 0 ]; then return 1 fi diff --git a/cpuhotplug/cpuhotplug_03.sh b/cpuhotplug/cpuhotplug_03.sh index 689fc8a..96f4685 100755 --- a/cpuhotplug/cpuhotplug_03.sh +++ b/cpuhotplug/cpuhotplug_03.sh @@ -30,7 +30,6 @@ check_affinity_fails() { cpu=$1 cpuid=$(echo $cpu | awk '{print substr($0,4)}') - dirpath=$CPU_PATH/$1
if [ "$cpu" = "cpu0" ]; then is_cpu0_hotplug_allowed $hotplug_allow_cpu0 || return 0 @@ -38,9 +37,9 @@ check_affinity_fails() {
set_offline $cpu
- taskset -c $cpuid /bin/true + taskset -c $cpuid /bin/true 2> /dev/null ret=$? - check "setting affinity on cpu fails" "test $ret -ne 0" + check "setting affinity on $cpu fails" "test $ret -ne 0"
set_online $cpu
diff --git a/cpuhotplug/cpuhotplug_04.sh b/cpuhotplug/cpuhotplug_04.sh index 18a8e9c..37a6923 100755 --- a/cpuhotplug/cpuhotplug_04.sh +++ b/cpuhotplug/cpuhotplug_04.sh @@ -32,7 +32,6 @@ check_task_migrate() { cpu=$1 cpuid=$(echo $cpu | awk '{print substr($0,4)}') 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_07.sh b/cpuhotplug/cpuhotplug_07.sh index 2e81f28..dbd7bff 100755 --- a/cpuhotplug/cpuhotplug_07.sh +++ b/cpuhotplug/cpuhotplug_07.sh @@ -31,7 +31,6 @@ UEVENT_READER="../utils/uevent_reader"
check_notification() { cpu=$1 - cpuid=$(echo $cpu | awk '{print substr($0,4)}')
if [ "$cpu" = "cpu0" ]; then is_cpu0_hotplug_allowed $hotplug_allow_cpu0 || return 0 diff --git a/include/functions.sh b/include/functions.sh index 97930ae..b5c9666 100644 --- a/include/functions.sh +++ b/include/functions.sh @@ -95,13 +95,13 @@ log_skip() {
for_each_cpu() {
- func=$1 + cpu_func=$1 shift 1
for cpu in $cpus; do INC=0 CPU=/$cpu - $func $cpu $@ + $cpu_func $cpu $@ done
return 0 @@ -109,14 +109,14 @@ for_each_cpu() {
for_each_governor() {
- cpu=$1 - func=$2 - dirpath=$CPU_PATH/$cpu/cpufreq - governors=$(cat $dirpath/scaling_available_governors) + gov_cpu=$1 + gov_func=$2 + cpufreq_dirpath=$CPU_PATH/$gov_cpu/cpufreq + governors=$(cat $cpufreq_dirpath/scaling_available_governors) shift 2
for governor in $governors; do - $func $cpu $governor $@ + $gov_func $gov_cpu $governor $@ done
return 0 @@ -124,14 +124,14 @@ for_each_governor() {
for_each_frequency() {
- cpu=$1 - func=$2 - dirpath=$CPU_PATH/$cpu/cpufreq - frequencies=$(cat $dirpath/scaling_available_frequencies) + freq_cpu=$1 + freq_func=$2 + cpufreq_dirpath=$CPU_PATH/$freq_cpu/cpufreq + frequencies=$(cat $cpufreq_dirpath/scaling_available_frequencies) shift 2
for frequency in $frequencies; do - $func $cpu $frequency $@ + $freq_func $freq_cpu $frequency $@ done
return 0 @@ -139,40 +139,40 @@ for_each_frequency() {
set_governor() {
- cpu=$1 - dirpath=$CPU_PATH/$cpu/cpufreq/scaling_governor + gov_cpu=$1 + scaling_gov_dirpath=$CPU_PATH/$gov_cpu/cpufreq/scaling_governor newgov=$2
- echo $newgov > $dirpath + echo $newgov > $scaling_gov_dirpath }
get_governor() {
- cpu=$1 - dirpath=$CPU_PATH/$cpu/cpufreq/scaling_governor + gov_cpu=$1 + scaling_gov_dirpath=$CPU_PATH/$gov_cpu/cpufreq/scaling_governor
- cat $dirpath + cat $scaling_gov_dirpath }
wait_latency() { - cpu=$1 - dirpath=$CPU_PATH/$cpu/cpufreq - gov=$(cat $dirpath/scaling_governor) + wait_latency_cpu=$1 + cpufreq_dirpath=$CPU_PATH/$wait_latency_cpu/cpufreq + gov=$(cat $cpufreq_dirpath/scaling_governor)
# consider per-policy governor case - if [ -e $CPU_PATH/$cpu/cpufreq/$gov ]; then - sampling_rate=$(cat $CPU_PATH/$cpu/cpufreq/$gov/sampling_rate) + if [ -e $CPU_PATH/$wait_latency_cpu/cpufreq/$gov ]; then + sampling_rate=$(cat $CPU_PATH/$wait_latency_cpu/cpufreq/$gov/sampling_rate) else sampling_rate=$(cat $CPU_PATH/cpufreq/$gov/sampling_rate) fi sampling_rate=$((sampling_rate * 1000)) # unit nsec
- latency=$(cat $dirpath/cpuinfo_transition_latency) + latency=$(cat $cpufreq_dirpath/cpuinfo_transition_latency) if [ $? -ne 0 ]; then return 1 fi
- nrfreq=$(cat $dirpath/scaling_available_frequencies | wc -w) + nrfreq=$(cat $cpufreq_dirpath/scaling_available_frequencies | wc -w) if [ $? -ne 0 ]; then return 1 fi @@ -189,14 +189,14 @@ frequnit() { 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 + ghz_value=$(echo "($ghz > 1.0)" | bc -l) + if [ "$ghz_value" = "1" ]; then echo $ghz GHz return 0 fi
- res=$(echo "($mhz > 1.0)" | bc -l) - if [ "$res" = "1" ];then + mhz_value=$(echo "($mhz > 1.0)" | bc -l) + if [ "$mhz_value" = "1" ];then echo $mhz MHz return 0 fi @@ -206,71 +206,71 @@ frequnit() {
set_frequency() {
- cpu=$1 - dirpath=$CPU_PATH/$cpu/cpufreq + freq_cpu=$1 + cpufreq_dirpath=$CPU_PATH/$freq_cpu/cpufreq newfreq=$2 - setfreqpath=$dirpath/scaling_setspeed + setfreqpath=$cpufreq_dirpath/scaling_setspeed
echo $newfreq > $setfreqpath - wait_latency $cpu + wait_latency $freq_cpu }
get_frequency() { - cpu=$1 - dirpath=$CPU_PATH/$cpu/cpufreq/scaling_cur_freq - cat $dirpath + freq_cpu=$1 + scaling_cur_freq=$CPU_PATH/$freq_cpu/cpufreq/scaling_cur_freq + cat $scaling_cur_freq }
get_max_frequency() { - cpu=$1 - dirpath=$CPU_PATH/$cpu/cpufreq/scaling_max_freq - cat $dirpath + freq_cpu=$1 + scaling_max_freq=$CPU_PATH/$freq_cpu/cpufreq/scaling_max_freq + cat $scaling_max_freq }
get_min_frequency() { - cpu=$1 - dirpath=$CPU_PATH/$cpu/cpufreq/scaling_min_freq - cat $dirpath + freq_cpu=$1 + scaling_min_freq=$CPU_PATH/$freq_cpu/cpufreq/scaling_min_freq + cat $scaling_min_freq }
set_online() { - cpu=$1 - dirpath=$CPU_PATH/$cpu + current_cpu=$1 + current_cpu_path=$CPU_PATH/$current_cpu
- if [ "$cpu" = "cpu0" ]; then + if [ "$current_cpu" = "cpu0" ]; then return 0 fi
- echo 1 > $dirpath/online + echo 1 > $current_cpu_path/online }
set_offline() { - cpu=$1 - dirpath=$CPU_PATH/$cpu + current_cpu=$1 + current_cpu_path=$CPU_PATH/$current_cpu
- if [ "$cpu" = "cpu0" ]; then + if [ "$current_cpu" = "cpu0" ]; then return 0 fi
- echo 0 > $dirpath/online + echo 0 > $current_cpu_path/online }
get_online() { - cpu=$1 - dirpath=$CPU_PATH/$cpu + current_cpu=$1 + current_cpu_path=$CPU_PATH/$current_cpu
- cat $dirpath/online + cat $current_cpu_path/online }
check() {
- descr=$1 - func=$2 + check_descr=$1 + check_func=$2 shift 2;
- log_begin "checking $descr" + log_begin "checking $check_descr"
- $func $@ + $check_func $@ if [ $? -ne 0 ]; then log_end "Err" return 1 @@ -289,12 +289,12 @@ check_file() { }
check_cpufreq_files() { - - dirpath=$CPU_PATH/$1/cpufreq + cpu_id=$1 + cpufreq_files_dir=$CPU_PATH/$cpu_id/cpufreq shift 1
for i in $@; do - check_file $i $dirpath || return 1 + check_file $i $cpufreq_files_dir || return 1 done
return 0 @@ -302,22 +302,20 @@ check_cpufreq_files() {
check_sched_mc_files() {
- dirpath=$CPU_PATH - for i in $@; do - check_file $i $dirpath || return 1 + check_file $i $CPU_PATH || return 1 done
return 0 }
check_topology_files() { - - dirpath=$CPU_PATH/$1/topology + cpu=$1 + topology_files_dir=$CPU_PATH/$cpu/topology shift 1
for i in $@; do - check_file $i $dirpath || return 1 + check_file $i $topology_files_dir || return 1 done
return 0 @@ -325,17 +323,17 @@ check_topology_files() {
check_cpuhotplug_files() {
- dirpath=$CPU_PATH/$1 + cpuhotplug_files_dir=$CPU_PATH/$1 shift 1
for i in $@; do - if [ `echo $dirpath | grep -c "cpu0"` -eq 1 ]; then + if [ `echo $cpuhotplug_files_dir | grep -c "cpu0"` -eq 1 ]; then if [ $hotplug_allow_cpu0 -eq 0 ]; then continue fi fi
- check_file $i $dirpath || return 1 + check_file $i $cpuhotplug_files_dir || return 1 done
return 0 diff --git a/include/thermal_functions.sh b/include/thermal_functions.sh index 56a0a3e..56f9d33 100644 --- a/include/thermal_functions.sh +++ b/include/thermal_functions.sh @@ -30,13 +30,12 @@ MAX_CDEV=0-50 check_valid_temp() { file=$1 zone_name=$2 - dir=$THERMAL_PATH/$2 + dir=$THERMAL_PATH/$zone_name
- temp_file=$dir/$1 - func=cat + temp_file=$dir/$file shift 2;
- temp_val=$($func $temp_file) + temp_val=$(cat $temp_file) descr="'$zone_name'/'$file' ='$temp_val'" log_begin "checking $descr"
@@ -52,23 +51,22 @@ check_valid_temp() {
for_each_thermal_zone() {
- func=$1 + thermal_func=$1 shift 1
- zones=$(ls $THERMAL_PATH | grep "thermal_zone['$MAX_ZONE']") + thermal_zones=$(ls $THERMAL_PATH | grep "thermal_zone['$MAX_ZONE']")
- ALL_ZONE=$zone - for zone in $zones; do + for thermal_zone in $zones; do INC=0 - $func $zone $@ + $thermal_func $thermal_zone $@ done
return 0 }
get_total_trip_point_of_zone() { - - zone_path=$THERMAL_PATH/$1 + zone=$1 + zone_path=$THERMAL_PATH/$zone count=0 shift 1 trips=$(ls $zone_path | grep "trip_point_['$MAX_ZONE']_temp") @@ -113,8 +111,8 @@ for_each_binding_of_zone() { check_valid_binding() { trip_point=$1 zone_name=$2 - dirpath=$THERMAL_PATH/$2 - temp_file=$2/$1 + dirpath=$THERMAL_PATH/$zone_name + temp_file=$zone_name/$trip_point trip_point_val=$(cat $dirpath/$trip_point) get_total_trip_point_of_zone $zone_name trip_point_max=$? @@ -134,8 +132,8 @@ check_valid_binding() { validate_trip_bindings() { zone_name=$1 bind_no=$2 - dirpath=$THERMAL_PATH/$1 - trip_point=cdev$2_trip_point + dirpath=$THERMAL_PATH/$zone_name + trip_point=cdev"$bind_no"_trip_point shift 2
check_file $trip_point $dirpath || return 1 @@ -145,9 +143,9 @@ validate_trip_bindings() { validate_trip_level() { zone_name=$1 trip_no=$2 - dirpath=$THERMAL_PATH/$1 - trip_temp=trip_point_$2_temp - trip_type=trip_point_$2_type + dirpath=$THERMAL_PATH/$zone_name + trip_temp=trip_point_"$trip_no"_temp + trip_type=trip_point_"$trip_no"_type shift 2
check_file $trip_temp $dirpath || return 1 @@ -157,19 +155,18 @@ validate_trip_level() {
for_each_cooling_device() {
- func=$1 + cdev_func=$1 shift 1
- devices=$(ls $THERMAL_PATH | grep "cooling_device['$MAX_CDEV']") - if [ "$devices" = "" ]; then + cooling_devices=$(ls $THERMAL_PATH | grep "cooling_device['$MAX_CDEV']") + if [ "$cooling_devices" = "" ]; then log_skip "no cooling devices" return 0 fi
- ALL_DEVICE=$devices - for device in $devices; do + for cooling_device in $cooling_devices; do INC=0 - $func $device $@ + $cdev_func $cooling_device $@ done
return 0 diff --git a/thermal/thermal_01.sh b/thermal/thermal_01.sh index e11c884..94bb26b 100755 --- a/thermal/thermal_01.sh +++ b/thermal/thermal_01.sh @@ -31,21 +31,19 @@ ATTRIBUTES="mode temp type uevent"
check_thermal_zone_attributes() { - - dirpath=$THERMAL_PATH/$1 zone_name=$1 + dirpath=$THERMAL_PATH/$zone_name shift 1 - for i in $ATTRIBUTES; do - check_file $i $dirpath || return 1 + for attribute in $ATTRIBUTES; do + check_file $attribute $dirpath || return 1 done
check_valid_temp "temp" $zone_name || return 1 }
check_thermal_zone_mode() { - - dirpath=$THERMAL_PATH/$1 zone_name=$1 + dirpath=$THERMAL_PATH/$zone_name shift 1 prev_mode=$(cat $dirpath/mode) echo -n enabled > $dirpath/mode @@ -62,17 +60,17 @@ check_thermal_zone_mode() {
check_thermal_zone_trip_level() {
- 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 + 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 done }
check_thermal_zone_bindings() {
- 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 + 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 done }
The syntax for arrays, foo[index], is defined in BASH. Replace BASH arrays with ones that are POSIX compliant.
Signed-off-by: Lisa Nguyen lisa.nguyen@linaro.org --- cpufreq/cpufreq_06.sh | 20 ++++++++-------- include/functions.sh | 14 +++++++---- include/thermal_functions.sh | 54 +++++++++++++++++++++++++----------------- thermal/thermal_02.sh | 21 ++++++++-------- thermal/thermal_06.sh | 32 +++++++++++++++---------- 5 files changed, 82 insertions(+), 59 deletions(-)
diff --git a/cpufreq/cpufreq_06.sh b/cpufreq/cpufreq_06.sh index a6fbd15..3bb104d 100755 --- a/cpufreq/cpufreq_06.sh +++ b/cpufreq/cpufreq_06.sh @@ -28,9 +28,10 @@ . ../include/functions.sh
CPUCYCLE=../utils/cpucycle +freq_results_array="results"
compute_freq_ratio() { - + index=0 cpu=$1 freq=$2
@@ -41,21 +42,24 @@ compute_freq_ratio() { return 1 fi
- results[$index]=$(echo "scale=3;($result / $freq)" | bc -l) + value=$(echo "scale=3;($result / $freq)" | bc -l) + eval $freq_results_array$index=$value + eval export $freq_results_array$index index=$((index + 1)) }
compute_freq_ratio_sum() { - - res=${results[$index]} + index=0 + sum=0 + res=$(eval echo $$freq_results_array$index) sum=$(echo "($sum + $res)" | bc -l) index=$((index + 1))
}
__check_freq_deviation() { - - res=${results[$index]} + index=0 + res=$(eval echo $$freq_results_array$index)
# compute deviation dev=$(echo "scale=3;((( $res - $avg ) / $avg) * 100 )" | bc -l) @@ -90,14 +94,10 @@ check_deviation() {
for_each_frequency $cpu compute_freq_ratio
- index=0 - sum=0 - for_each_frequency $cpu compute_freq_ratio_sum
avg=$(echo "scale=3;($sum / $index)" | bc -l)
- index=0 for_each_frequency $cpu check_freq_deviation }
diff --git a/include/functions.sh b/include/functions.sh index b5c9666..e3eb140 100644 --- a/include/functions.sh +++ b/include/functions.sh @@ -35,6 +35,8 @@ fail_count=0 skip_count=0 test_script_status="pass" nanosleep="../utils/nanosleep" +gov_array="governors_backup" +freq_array="frequencies_backup"
test_status_show() { if [ $fail_count -ne 0 ]; then @@ -344,7 +346,9 @@ save_governors() { index=0
for cpu in $cpus; do - governors_backup[$index]=$(cat $CPU_PATH/$cpu/cpufreq/scaling_governor) + 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 } @@ -354,7 +358,7 @@ restore_governors() { index=0
for cpu in $cpus; do - oldgov=${governors_backup[$index]} + oldgov=$(eval echo $$gov_array$index) echo $oldgov > $CPU_PATH/$cpu/cpufreq/scaling_governor index=$((index + 1)) done @@ -365,7 +369,9 @@ save_frequencies() { index=0
for cpu in $cpus; do - frequencies_backup[$index]=$(cat $CPU_PATH/$cpu/cpufreq/scaling_cur_freq) + 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 } @@ -375,7 +381,7 @@ restore_frequencies() { index=0
for cpu in $cpus; do - oldfreq=${frequencies_backup[$index]} + oldfreq=$(eval echo $$freq_array$index) echo $oldfreq > $CPU_PATH/$cpu/cpufreq/scaling_setspeed index=$((index + 1)) done diff --git a/include/thermal_functions.sh b/include/thermal_functions.sh index 56f9d33..3b6cfd3 100644 --- a/include/thermal_functions.sh +++ b/include/thermal_functions.sh @@ -26,6 +26,10 @@ THERMAL_PATH="/sys/devices/virtual/thermal" MAX_ZONE=0-12 MAX_CDEV=0-50 +scaling_freq_array="scaling_freq" +mode_array="mode_list" +thermal_gov_array="thermal_governor_backup" +thermal_zones=$(ls $THERMAL_PATH | grep "thermal_zone['$MAX_ZONE']")
check_valid_temp() { file=$1 @@ -54,9 +58,7 @@ for_each_thermal_zone() { thermal_func=$1 shift 1
- thermal_zones=$(ls $THERMAL_PATH | grep "thermal_zone['$MAX_ZONE']") - - for thermal_zone in $zones; do + for thermal_zone in $thermal_zones; do INC=0 $thermal_func $thermal_zone $@ done @@ -180,10 +182,14 @@ check_scaling_freq() {
flag=0 for cpu in $cpus; do - if [ ${before_freq_list[$index]} -ne ${after_freq_list[$index]} ] ; then - flag=1 - fi - index=$((index + 1)) + after_freq=$(eval echo $$after_freq_list$index) + before_freq=$(eval echo $$before_freq_list$index) + + if [ $after_freq -ne $before_freq ] ; then + flag=1 + fi + + index=$((index + 1)) done return $flag } @@ -192,7 +198,9 @@ store_scaling_maxfreq() { index=0
for cpu in $cpus; do - scale_freq[$index]=$(cat $CPU_PATH/$cpu/cpufreq/scaling_max_freq) + scaling_freq_max_value=$(cat $CPU_PATH/$cpu/cpufreq/scaling_max_freq) + eval $scaling_freq_array$index=$scaling_freq_max_value + eval echo $scaling_freq_array$index index=$((index + 1)) done return 0 @@ -215,11 +223,12 @@ disable_all_thermal_zones() {
index=0
- th_zones=$(ls $THERMAL_PATH | grep "thermal_zone['$MAX_ZONE']") - for zone in $th_zones; do - mode_list[$index]=$(cat $THERMAL_PATH/$zone/mode) + for thermal_zone in $thermal_zones; do + mode=$(cat $THERMAL_PATH/$thermal_zone/mode) + eval $mode_array$index=$mode + eval export $mode_array$index index=$((index + 1)) - echo -n "disabled" > $THERMAL_PATH/$zone/mode + echo -n "disabled" > $THERMAL_PATH/$thermal_zone/mode done return 0 } @@ -228,9 +237,9 @@ enable_all_thermal_zones() {
index=0
- th_zones=$(ls $THERMAL_PATH | grep "thermal_zone['$MAX_ZONE']") - for zone in $th_zones; do - echo ${mode_list[$index]} > $THERMAL_PATH/$zone/mode + for thermal_zone in $thermal_zones; do + mode=$(eval echo $$mode_array$index) + echo $mode > $THERMAL_PATH/$thermal_zone/mode index=$((index + 1)) done return 0 @@ -282,11 +291,12 @@ set_thermal_governors() { gov=$1 index=0
- 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) + for thermal_zone in $thermal_zones; do + policy=$(cat $THERMAL_PATH/$thermal_zone/policy) + eval $thermal_gov_array$index=$policy + eval export $thermal_gov_array$index index=$((index + 1)) - echo $gov > $THERMAL_PATH/$zone/policy + echo $gov > $THERMAL_PATH/$thermal_zone/policy done return 0 } @@ -295,9 +305,9 @@ restore_thermal_governors() {
index=0
- 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 + for thermal_zone in $thermal_zones; do + old_policy=$(eval echo $$thermal_gov_array$index) + echo $old_policy > $THERMAL_PATH/$thermal_zone/policy index=$((index + 1)) done return 0 diff --git a/thermal/thermal_02.sh b/thermal/thermal_02.sh index 0786870..9ec02ab 100755 --- a/thermal/thermal_02.sh +++ b/thermal/thermal_02.sh @@ -31,33 +31,32 @@ CDEV_ATTRIBUTES="cur_state max_state type uevent"
check_cooling_device_attributes() { - - dirpath=$THERMAL_PATH/$1 cdev_name=$1 + cdev_name_dir=$THERMAL_PATH/$cdev_name shift 1
- for i in $CDEV_ATTRIBUTES; do - check_file $i $dirpath || return 1 + for attribute in $CDEV_ATTRIBUTES; do + check_file $attribute $cdev_name_dir || return 1 done
}
check_cooling_device_states() { - dirpath=$THERMAL_PATH/$1 cdev_name=$1 + cdev_name_dir=$THERMAL_PATH/$cdev_name shift 1 - max_state=$(cat $dirpath/max_state) - prev_state_val=$(cat $dirpath/cur_state) + 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 > $dirpath/cur_state - cur_state_val=$(cat $dirpath/cur_state) - check "$cdev_name 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)) done - echo $prev_state_val > $dirpath/cur_state + echo $prev_state_val > $cdev_name_dir/cur_state }
set_thermal_governors user_space diff --git a/thermal/thermal_06.sh b/thermal/thermal_06.sh index 9d62a07..b511329 100755 --- a/thermal/thermal_06.sh +++ b/thermal/thermal_06.sh @@ -31,6 +31,7 @@ TEST_LOOP=100 CPU_HEAT_BIN=../utils/heat_cpu cpu_pid=0 +trip_cross_array="trip_cross"
heater_kill() { if [ $cpu_pid -ne 0 ]; then @@ -40,8 +41,8 @@ heater_kill() { }
check_trip_point_change() { - dirpath=$THERMAL_PATH/$1 zone_name=$1 + thermal_zone_path=$THERMAL_PATH/$zone_name shift 1
count=0 @@ -58,18 +59,25 @@ check_trip_point_change() { start_glmark2
index=0 - for trip in $(ls $dirpath | grep "trip_point_['$MAX_ZONE']_temp"); do - trip_cross[$index]=0 - index=$((index + 1)) + trip_point_temps=$(ls $thermal_zone_path | grep "trip_point_['$MAX_ZONE']_temp") + + for trip in $trip_point_temps; do + trip_value=0 + eval $trip_cross_array$index=$trip_value + eval export $trip_cross_array$index + index=$((index + 1)) done while (test $count -lt $TEST_LOOP); do index=0 sleep 1 - for trip in $(ls $dirpath | grep "trip_point_['$MAX_ZONE']_temp"); do - cur_temp=$(cat $dirpath/temp) - trip_temp=$(cat $dirpath/$trip) + 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 - trip_cross[$index]=$((${trip_cross[$index]} + 1)) + 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))
@@ -77,14 +85,14 @@ check_trip_point_change() { count=$((count + 1)) done index=0 - for trip in $(ls $dirpath | grep "trip_point_['$MAX_ZONE']_temp"); do + for trip in $trip_point_temps; do get_trip_id $trip trip_id=$? - trip_type=$(cat $dirpath/trip_point_$((trip_id))_type) - trip_temp=$(cat $dirpath/$trip) + trip_type=$(cat $thermal_zone_path/trip_point_"$trip_id"_type) + trip_temp=$(cat $thermal_zone_path/$trip)
if [ $trip_type != "critical" ]; then - count=${trip_cross[$index]} + count=$(eval echo $$trip_cross_array$index) check "$trip:$trip_temp crossed" "test $count -gt 0" fi index=$((index + 1))
Set the sampling_rate to zero if the sampling_rate attribute cannot be found in either directories listed in the if condition. This will also resolve minor bugs where the sampling_rate is missing.
Signed-off-by: Lisa Nguyen lisa.nguyen@linaro.org --- include/functions.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/include/functions.sh b/include/functions.sh index e3eb140..4486da8 100644 --- a/include/functions.sh +++ b/include/functions.sh @@ -164,8 +164,10 @@ 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) - else + 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
On Mon, Feb 2, 2015 at 7:34 AM, Lisa Nguyen lisa.nguyen@linaro.org wrote:
Set the sampling_rate to zero if the sampling_rate attribute cannot be found in either directories listed in the if condition. This will also resolve minor bugs where the sampling_rate is missing.
Signed-off-by: Lisa Nguyen lisa.nguyen@linaro.org
include/functions.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/include/functions.sh b/include/functions.sh index e3eb140..4486da8 100644 --- a/include/functions.sh +++ b/include/functions.sh @@ -164,8 +164,10 @@ 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)
- else
- elif [ -e $CPU_PATH/cpufreq/$gov/sampling_rate ]; then sampling_rate=$(cat $CPU_PATH/cpufreq/$gov/sampling_rate)
- else
fi sampling_rate=$((sampling_rate * 1000)) # unit nsecsampling_rate=0
Hmm, let us think about this a bit. In what situation will be not find a sampling rate for the governor? In the case where we are NOT using ondemand governor. This is expected on Android which uses the interactive governor.
So the entire wait_latency() function is going to return somewhat incorrect values when run on Android.
I suggest the following removing this patch from the series and properly fixing this problem by doing tests on ubuntu and android with ondemand and interactive respectively to figure out what variables should be read to get the sampling rate.
On 1 February 2015 at 22:00, Amit Kucheria amit.kucheria@linaro.org wrote:
On Mon, Feb 2, 2015 at 7:34 AM, Lisa Nguyen lisa.nguyen@linaro.org wrote:
Set the sampling_rate to zero if the sampling_rate attribute cannot be found in either directories listed in the if condition. This will also resolve minor bugs where the sampling_rate is missing.
Signed-off-by: Lisa Nguyen lisa.nguyen@linaro.org
include/functions.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/include/functions.sh b/include/functions.sh index e3eb140..4486da8 100644 --- a/include/functions.sh +++ b/include/functions.sh @@ -164,8 +164,10 @@ 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)
- else
- elif [ -e $CPU_PATH/cpufreq/$gov/sampling_rate ]; then sampling_rate=$(cat $CPU_PATH/cpufreq/$gov/sampling_rate)
- else
fi sampling_rate=$((sampling_rate * 1000)) # unit nsecsampling_rate=0
Hmm, let us think about this a bit. In what situation will be not find a sampling rate for the governor? In the case where we are NOT using ondemand governor. This is expected on Android which uses the interactive governor.
So the entire wait_latency() function is going to return somewhat incorrect values when run on Android.
I agree.
I suggest the following removing this patch from the series and properly fixing this problem by doing tests on ubuntu and android with ondemand and interactive respectively to figure out what variables should be read to get the sampling rate.
The common errors I ran into were these ones without the patch:
+ gov=userspace + [ -e /sys/devices/system/cpu/cpu0/cpufreq/userspace ] + cat /sys/devices/system/cpu/cpufreq/userspace/sampling_rate cat: /sys/devices/system/cpu/cpufreq/userspace/sampling_rate: No such file or directory + sampling_rate=
I'll see what results I get on Ubuntu and Android with ondemand and interactive respectively.
On Tue, Feb 3, 2015 at 3:14 AM, Lisa Nguyen lisa.nguyen@linaro.org wrote:
On 1 February 2015 at 22:00, Amit Kucheria amit.kucheria@linaro.org wrote:
On Mon, Feb 2, 2015 at 7:34 AM, Lisa Nguyen lisa.nguyen@linaro.org wrote:
Set the sampling_rate to zero if the sampling_rate attribute cannot be found in either directories listed in the if condition. This will also resolve minor bugs where the sampling_rate is missing.
Signed-off-by: Lisa Nguyen lisa.nguyen@linaro.org
include/functions.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/include/functions.sh b/include/functions.sh index e3eb140..4486da8 100644 --- a/include/functions.sh +++ b/include/functions.sh @@ -164,8 +164,10 @@ 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)
- else
- elif [ -e $CPU_PATH/cpufreq/$gov/sampling_rate ]; then sampling_rate=$(cat $CPU_PATH/cpufreq/$gov/sampling_rate)
- else
fi sampling_rate=$((sampling_rate * 1000)) # unit nsecsampling_rate=0
Hmm, let us think about this a bit. In what situation will be not find a sampling rate for the governor? In the case where we are NOT using ondemand governor. This is expected on Android which uses the interactive governor.
So the entire wait_latency() function is going to return somewhat incorrect values when run on Android.
I agree.
I suggest the following removing this patch from the series and properly fixing this problem by doing tests on ubuntu and android with ondemand and interactive respectively to figure out what variables should be read to get the sampling rate.
The common errors I ran into were these ones without the patch:
- gov=userspace
- [ -e /sys/devices/system/cpu/cpu0/cpufreq/userspace ]
- cat /sys/devices/system/cpu/cpufreq/userspace/sampling_rate
cat: /sys/devices/system/cpu/cpufreq/userspace/sampling_rate: No such file or directory
- sampling_rate=
I'll see what results I get on Ubuntu and Android with ondemand and interactive respectively.
Read Documentation/cpu-freq/governors.txt for details on the knobs available for ondemand. These knobs are specific to each governor for tuning, so of course you won't find them with the userspace governor.
Add an if condition to check if the log directory exists. Create one if it doesn't already exist.
Signed-off-by: Lisa Nguyen lisa.nguyen@linaro.org --- include/suspend_functions.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/include/suspend_functions.sh b/include/suspend_functions.sh index 5157143..49e1c01 100644 --- a/include/suspend_functions.sh +++ b/include/suspend_functions.sh @@ -52,7 +52,9 @@ if [ $? -ne 0 ]; then fi
# Ensure the log directory exists. -mkdir -p "$LOGDIR" +if [ ! -d "$LOGDIR" ]; then + mkdir -p "$LOGDIR" +fi
setup_wakeup_timer () {
1_sanity_check.sh script didn't have a meaningful name. Rename it to cpuhotplug_00 as the first script to check if all cpus are online before the other cpuhotplug scripts begin.
Signed-off-by: Lisa Nguyen lisa.nguyen@linaro.org --- cpuhotplug/1_sanity_check.sh | 40 ---------------------------------------- cpuhotplug/1_sanity_check.txt | 1 - cpuhotplug/cpuhotplug_00.sh | 40 ++++++++++++++++++++++++++++++++++++++++ cpuhotplug/cpuhotplug_00.txt | 1 + 4 files changed, 41 insertions(+), 41 deletions(-) delete mode 100755 cpuhotplug/1_sanity_check.sh delete mode 100644 cpuhotplug/1_sanity_check.txt create mode 100755 cpuhotplug/cpuhotplug_00.sh create mode 100644 cpuhotplug/cpuhotplug_00.txt
diff --git a/cpuhotplug/1_sanity_check.sh b/cpuhotplug/1_sanity_check.sh deleted file mode 100755 index 634a736..0000000 --- a/cpuhotplug/1_sanity_check.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh -# -# 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: -# Daniel Lezcano daniel.lezcano@linaro.org (IBM Corporation) -# - initial API and implementation -# - -# URL : - -. ../include/functions.sh - -sanity_check() { - ret=$(cat $CPU_PATH/offline) - if [ -z "$ret" ]; then - return 0 - else - return 1 - fi -} - -check "all cpu are online" "sanity_check" -test_status_show diff --git a/cpuhotplug/1_sanity_check.txt b/cpuhotplug/1_sanity_check.txt deleted file mode 100644 index 8930419..0000000 --- a/cpuhotplug/1_sanity_check.txt +++ /dev/null @@ -1 +0,0 @@ -ensure all the cpus are online before the tests diff --git a/cpuhotplug/cpuhotplug_00.sh b/cpuhotplug/cpuhotplug_00.sh new file mode 100755 index 0000000..634a736 --- /dev/null +++ b/cpuhotplug/cpuhotplug_00.sh @@ -0,0 +1,40 @@ +#!/bin/sh +# +# 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: +# Daniel Lezcano daniel.lezcano@linaro.org (IBM Corporation) +# - initial API and implementation +# + +# URL : + +. ../include/functions.sh + +sanity_check() { + ret=$(cat $CPU_PATH/offline) + if [ -z "$ret" ]; then + return 0 + else + return 1 + fi +} + +check "all cpu are online" "sanity_check" +test_status_show diff --git a/cpuhotplug/cpuhotplug_00.txt b/cpuhotplug/cpuhotplug_00.txt new file mode 100644 index 0000000..8930419 --- /dev/null +++ b/cpuhotplug/cpuhotplug_00.txt @@ -0,0 +1 @@ +ensure all the cpus are online before the tests
z_sanity_check.sh doesn't have a meaningful name. Rename it to cpuhotplug_99 as the last script to run to see if all cpus are back online after running previous cpuhotplug scripts.
Signed-off-by: Lisa Nguyen lisa.nguyen@linaro.org --- cpuhotplug/cpuhotplug_99.sh | 40 ++++++++++++++++++++++++++++++++++++++++ cpuhotplug/cpuhotplug_99.txt | 1 + cpuhotplug/z_sanity_check.sh | 40 ---------------------------------------- cpuhotplug/z_sanity_check.txt | 1 - 4 files changed, 41 insertions(+), 41 deletions(-) create mode 100755 cpuhotplug/cpuhotplug_99.sh create mode 100644 cpuhotplug/cpuhotplug_99.txt delete mode 100755 cpuhotplug/z_sanity_check.sh delete mode 100644 cpuhotplug/z_sanity_check.txt
diff --git a/cpuhotplug/cpuhotplug_99.sh b/cpuhotplug/cpuhotplug_99.sh new file mode 100755 index 0000000..5d5a425 --- /dev/null +++ b/cpuhotplug/cpuhotplug_99.sh @@ -0,0 +1,40 @@ +#!/bin/sh +# +# 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: +# Daniel Lezcano daniel.lezcano@linaro.org (IBM Corporation) +# - initial API and implementation +# + +# URL : + +. ../include/functions.sh + +sanity_check() { + ret=$(cat $CPU_PATH/offline) + if [ -z "$ret" ]; then + return 0 + else + return 1 + fi +} + +check "all cpu are back online" "sanity_check" +test_status_show diff --git a/cpuhotplug/cpuhotplug_99.txt b/cpuhotplug/cpuhotplug_99.txt new file mode 100644 index 0000000..2b6c2fa --- /dev/null +++ b/cpuhotplug/cpuhotplug_99.txt @@ -0,0 +1 @@ +ensure all the cpus are online when the tests are finished diff --git a/cpuhotplug/z_sanity_check.sh b/cpuhotplug/z_sanity_check.sh deleted file mode 100755 index 5d5a425..0000000 --- a/cpuhotplug/z_sanity_check.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh -# -# 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: -# Daniel Lezcano daniel.lezcano@linaro.org (IBM Corporation) -# - initial API and implementation -# - -# URL : - -. ../include/functions.sh - -sanity_check() { - ret=$(cat $CPU_PATH/offline) - if [ -z "$ret" ]; then - return 0 - else - return 1 - fi -} - -check "all cpu are back online" "sanity_check" -test_status_show diff --git a/cpuhotplug/z_sanity_check.txt b/cpuhotplug/z_sanity_check.txt deleted file mode 100644 index 2b6c2fa..0000000 --- a/cpuhotplug/z_sanity_check.txt +++ /dev/null @@ -1 +0,0 @@ -ensure all the cpus are online when the tests are finished
Every test module has a sanity script. Add one for cputopology to check for topology entries for all cpus.
Signed-off-by: Lisa Nguyen lisa.nguyen@linaro.org --- cputopology/cputopology_sanity.sh | 49 ++++++++++++++++++++++++++++++++++++ cputopology/cputopology_sanity.txt | 1 + 2 files changed, 50 insertions(+) create mode 100755 cputopology/cputopology_sanity.sh create mode 100644 cputopology/cputopology_sanity.txt
diff --git a/cputopology/cputopology_sanity.sh b/cputopology/cputopology_sanity.sh new file mode 100755 index 0000000..698ceab --- /dev/null +++ b/cputopology/cputopology_sanity.sh @@ -0,0 +1,49 @@ +#!/bin/sh +# +# PM-QA validation test suite for the power management on Linux +# +# Copyright (C) 2015, 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: +# Lisa Nguyen lisa.nguyen@linaro.org +# - initial implementation +# + +. ../include/functions.sh + +is_root +if [ $? -ne 0 ]; then + log_skip "User is not root" + exit 0 +fi + +check_cputopology_sysfs_entry() { + for cpu in $cpus; do + cputopology_sysfs_dir="$CPU_PATH/$cpu/topology" + + test -d $cputopology_sysfs_dir + if [ $? -ne 0 ]; then + echo "cputopology entry not found. Skipping all cputopology tests" + skip_tests cputopology + return 0 + fi + done + + return 1 +} + +check_cputopology_sysfs_entry diff --git a/cputopology/cputopology_sanity.txt b/cputopology/cputopology_sanity.txt new file mode 100644 index 0000000..99f927c --- /dev/null +++ b/cputopology/cputopology_sanity.txt @@ -0,0 +1 @@ +Checking for topology dir in each cpu
Signed-off-by: Lisa Nguyen lisa.nguyen@linaro.org --- cpuhotplug/Android.mk | 4 +--- cputopology/Android.mk | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/cpuhotplug/Android.mk b/cpuhotplug/Android.mk index fabb70a..ac0ff0b 100644 --- a/cpuhotplug/Android.mk +++ b/cpuhotplug/Android.mk @@ -14,7 +14,7 @@ define $(module_name)_add_executable include $(BUILD_PREBUILT) endef
-test_num := sanity 01 02 03 04 05 06 07 08 +test_num := sanity 00 01 02 03 04 05 06 07 08 99 $(foreach item,$(test_num),$(eval $(call $(module_name)_add_executable, $(module_name)_$(item))))
define $(module_name)_etc_add_executable @@ -28,5 +28,3 @@ define $(module_name)_etc_add_executable include $(BUILD_PREBUILT) endef
-test_names := 1_sanity_check z_sanity_check -$(foreach item,$(test_names),$(eval $(call $(module_name)_etc_add_executable, $(item)))) diff --git a/cputopology/Android.mk b/cputopology/Android.mk index d5b5480..3555496 100644 --- a/cputopology/Android.mk +++ b/cputopology/Android.mk @@ -14,5 +14,5 @@ define $(module_name)_add_executable include $(BUILD_PREBUILT) endef
-test_num := 01 02 +test_num := sanity 01 02 $(foreach item,$(test_num),$(eval $(call $(module_name)_add_executable, $(module_name)_$(item))))
Silence the grep results by using the -q option. The extra output that some grep commands print out would be more useful in debugging situations.
Signed-off-by: Lisa Nguyen lisa.nguyen@linaro.org --- cpuhotplug/cpuhotplug_06.sh | 2 +- cpuhotplug/cpuhotplug_07.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/cpuhotplug/cpuhotplug_06.sh b/cpuhotplug/cpuhotplug_06.sh index e1e59e3..3763274 100755 --- a/cpuhotplug/cpuhotplug_06.sh +++ b/cpuhotplug/cpuhotplug_06.sh @@ -37,7 +37,7 @@ check_procinfo() {
set_offline $cpu
- grep "CPU$cpuid" /proc/interrupts + grep -q "CPU$cpuid" /proc/interrupts ret=$?
check "offline processor not found in interrupts" "test $ret -ne 0" diff --git a/cpuhotplug/cpuhotplug_07.sh b/cpuhotplug/cpuhotplug_07.sh index dbd7bff..af7acb5 100755 --- a/cpuhotplug/cpuhotplug_07.sh +++ b/cpuhotplug/cpuhotplug_07.sh @@ -52,11 +52,11 @@ check_notification() { sleep 1 kill -s INT $pid
- grep "offline@/devices/system/cpu/$cpu" $TMPFILE + grep -q "offline@/devices/system/cpu/$cpu" $TMPFILE ret=$? check "offline event was received" "test $ret -eq 0"
- grep "online@/devices/system/cpu/$cpu" $TMPFILE + grep -q "online@/devices/system/cpu/$cpu" $TMPFILE ret=$? check "online event was received" "test $ret -eq 0"
Additional checks to see if a directory or file exists.
Signed-off-by: Lisa Nguyen lisa.nguyen@linaro.org --- cpufreq/cpufreq_sanity.sh | 3 +-- cpuhotplug/cpuhotplug_07.sh | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/cpufreq/cpufreq_sanity.sh b/cpufreq/cpufreq_sanity.sh index 6aba317..3ff42cd 100755 --- a/cpufreq/cpufreq_sanity.sh +++ b/cpufreq/cpufreq_sanity.sh @@ -35,8 +35,7 @@ check_cpufreq_sysfs_entry() {
dirpath=$CPU_PATH/cpufreq
- test -d $dirpath - if [ $? -ne 0 ]; then + if [ ! -d "$dirpath" ]; then echo "cpufreq is not supported. Skipping all cpufreq tests" skip_tests cpufreq return 0 diff --git a/cpuhotplug/cpuhotplug_07.sh b/cpuhotplug/cpuhotplug_07.sh index af7acb5..b0bd50a 100755 --- a/cpuhotplug/cpuhotplug_07.sh +++ b/cpuhotplug/cpuhotplug_07.sh @@ -39,7 +39,10 @@ check_notification() { # damn ! udevadm is buffering the output, we have to use a temp file # to retrieve the output
- rm -f $TMPFILE + if [ -f $TMPFILE ]; then + rm -f $TMPFILE + fi + $UEVENT_READER $TMPFILE & pid=$! sleep 1
The check function already determines if a subtest fails, passes, or skips. No need to check for the return value of the command.
Signed-off-by: Lisa Nguyen lisa.nguyen@linaro.org --- cpufreq/cpufreq_08.sh | 3 --- cpufreq/cpufreq_09.sh | 6 ------ 2 files changed, 9 deletions(-)
diff --git a/cpufreq/cpufreq_08.sh b/cpufreq/cpufreq_08.sh index f81976d..7821897 100755 --- a/cpufreq/cpufreq_08.sh +++ b/cpufreq/cpufreq_08.sh @@ -43,9 +43,6 @@ check_frequency() { kill $pid
check "'userspace' $(frequnit $freq) is fixed" "test "$curfreq" = "$freq"" - if [ "$?" != "0" ]; then - return 1 - fi
return 0 } diff --git a/cpufreq/cpufreq_09.sh b/cpufreq/cpufreq_09.sh index 2ba1652..3e40cbf 100755 --- a/cpufreq/cpufreq_09.sh +++ b/cpufreq/cpufreq_09.sh @@ -41,9 +41,6 @@ check_powersave() { curfreq=$(get_frequency $cpu)
check "'powersave' sets frequency to $(frequnit $minfreq)" "test "$curfreq" = "$minfreq"" - if [ "$?" != "0" ]; then - return 1 - fi
$CPUBURN $cpu & pid=$! @@ -53,9 +50,6 @@ check_powersave() { kill $pid
check "'powersave' frequency $(frequnit $minfreq) is fixed" "test "$curfreq" = "$minfreq"" - if [ "$?" -ne "0" ]; then - return 1 - fi
return 0 }
Use the built-in sort function to ensure that the PM-QA scripts will run in order. Some platforms may have makefile versions greater than 3.82.
See the following link for details: https://lists.gnu.org/archive/html/info-gnu/2010-07/msg00023.html
Signed-off-by: Lisa Nguyen lisa.nguyen@linaro.org --- Test.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Test.mk b/Test.mk index 66fe44b..fb7d41a 100644 --- a/Test.mk +++ b/Test.mk @@ -22,7 +22,7 @@ # - initial API and implementation
SNT=$(wildcard *sanity.sh) -TST=$(wildcard *[^{sanity}].sh) +TST=$(sort $(wildcard *[!{sanity}].sh)) LOG=$(TST:.sh=.log) CFLAGS?=-g -Wall -pthread CC?=gcc
Before searching for specific governors, check to see if the scaling_available_governors attribute exists first. It is to add more error handling.
Signed-off-by: Lisa Nguyen lisa.nguyen@linaro.org --- cpufreq/cpufreq_05.sh | 83 +++++++++++++++++++++++++++---------------------- 1 file changed, 45 insertions(+), 38 deletions(-)
diff --git a/cpufreq/cpufreq_05.sh b/cpufreq/cpufreq_05.sh index 862d310..8d37bae 100755 --- a/cpufreq/cpufreq_05.sh +++ b/cpufreq/cpufreq_05.sh @@ -58,51 +58,58 @@ check_governor() { check "'$gov' directory exists" "test -d $GOV_PATH" }
-supported=$(cat $CPU_PATH/cpu0/cpufreq/scaling_available_governors | grep "ondemand") -if [ -z "$supported" ]; then - log_skip "ondemand not supported" -else - for cpu in $cpus; do - switch_ondemand $cpu - done - check_governor $cpu 'ondemand' -fi +scaling_govs=$(cat $CPU_PATH/cpu0/cpufreq/scaling_available_governors) +if [ -n "$scaling_govs" ]; then + supported=$(cat $CPU_PATH/cpu0/cpufreq/scaling_available_governors | grep "ondemand") + if [ -z "$supported" ]; then + log_skip "ondemand not supported" + else + for cpu in $cpus; do + switch_ondemand $cpu + done + check_governor $cpu 'ondemand' + fi
-supported=$(cat $CPU_PATH/cpu0/cpufreq/scaling_available_governors | grep "conservative") -if [ -z "$supported" ]; then - log_skip "conservative not supported" -else - for cpu in $cpus; do - switch_conservative $cpu - done - check_governor $cpu 'conservative' -fi + supported=$(cat $CPU_PATH/cpu0/cpufreq/scaling_available_governors | grep "conservative") + if [ -z "$supported" ]; then + log_skip "conservative not supported" + else + for cpu in $cpus; do + switch_conservative $cpu + done + check_governor $cpu 'conservative' + fi
-supported=$(cat $CPU_PATH/cpu0/cpufreq/scaling_available_governors | grep "userspace") -if [ -z "$supported" ]; then - log_skip "userspace not supported" -else - for cpu in $cpus; do - switch_userspace $cpu - done + supported=$(cat $CPU_PATH/cpu0/cpufreq/scaling_available_governors | grep "userspace") + if [ -z "$supported" ]; then + log_skip "userspace not supported" + else + for cpu in $cpus; do + 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" -fi + fi
-# if more than one cpu, combine governors -nrcpus=$(ls $CPU_PATH | grep "cpu[0-9].*" | wc -l) -if [ $nrcpus -gt 1 ]; then - affected=$(cat $CPU_PATH/cpu0/cpufreq/affected_cpus | grep 1) - if [ -z $affected ]; then - switch_ondemand cpu0 - switch_conservative cpu1 - check_governor cpu0 'ondemand' - check_governor cpu1 'conservative' - else - log_skip "combine governors not supported" + # if more than one cpu, combine governors + nrcpus=$(ls $CPU_PATH | grep "cpu[0-9].*" | wc -l) + if [ $nrcpus -gt 1 ]; then + affected=$(cat $CPU_PATH/cpu0/cpufreq/affected_cpus | grep 1) + if [ -z $affected ]; then + switch_ondemand cpu0 + switch_conservative cpu1 + check_governor cpu0 'ondemand' + check_governor cpu1 'conservative' + else + log_skip "combine governors not supported" + fi fi + + restore_governors + +else + log_skip "scaling available governors not available" fi
-restore_governors test_status_show
On Mon, Feb 2, 2015 at 7:34 AM, Lisa Nguyen lisa.nguyen@linaro.org wrote:
Before searching for specific governors, check to see if the scaling_available_governors attribute exists first. It is to add more error handling.
This doesn't seem to handle interactive governor that is usually the default on Android.
Signed-off-by: Lisa Nguyen lisa.nguyen@linaro.org
cpufreq/cpufreq_05.sh | 83 +++++++++++++++++++++++++++---------------------- 1 file changed, 45 insertions(+), 38 deletions(-)
diff --git a/cpufreq/cpufreq_05.sh b/cpufreq/cpufreq_05.sh index 862d310..8d37bae 100755 --- a/cpufreq/cpufreq_05.sh +++ b/cpufreq/cpufreq_05.sh @@ -58,51 +58,58 @@ check_governor() { check "'$gov' directory exists" "test -d $GOV_PATH" }
-supported=$(cat $CPU_PATH/cpu0/cpufreq/scaling_available_governors | grep "ondemand") -if [ -z "$supported" ]; then
- log_skip "ondemand not supported"
-else
- for cpu in $cpus; do
switch_ondemand $cpu
- done
- check_governor $cpu 'ondemand'
-fi +scaling_govs=$(cat $CPU_PATH/cpu0/cpufreq/scaling_available_governors) +if [ -n "$scaling_govs" ]; then
- supported=$(cat $CPU_PATH/cpu0/cpufreq/scaling_available_governors | grep "ondemand")
- if [ -z "$supported" ]; then
log_skip "ondemand not supported"
- else
for cpu in $cpus; do
switch_ondemand $cpu
done
check_governor $cpu 'ondemand'
- fi
-supported=$(cat $CPU_PATH/cpu0/cpufreq/scaling_available_governors | grep "conservative") -if [ -z "$supported" ]; then
- log_skip "conservative not supported"
-else
- for cpu in $cpus; do
switch_conservative $cpu
- done
- check_governor $cpu 'conservative'
-fi
- supported=$(cat $CPU_PATH/cpu0/cpufreq/scaling_available_governors | grep "conservative")
- if [ -z "$supported" ]; then
log_skip "conservative not supported"
- else
for cpu in $cpus; do
switch_conservative $cpu
done
check_governor $cpu 'conservative'
- fi
-supported=$(cat $CPU_PATH/cpu0/cpufreq/scaling_available_governors | grep "userspace") -if [ -z "$supported" ]; then
- log_skip "userspace not supported"
-else
- for cpu in $cpus; do
switch_userspace $cpu
- done
supported=$(cat $CPU_PATH/cpu0/cpufreq/scaling_available_governors | grep "userspace")
if [ -z "$supported" ]; then
log_skip "userspace not supported"
else
for cpu in $cpus; do
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"
-fi
- fi
-# if more than one cpu, combine governors -nrcpus=$(ls $CPU_PATH | grep "cpu[0-9].*" | wc -l) -if [ $nrcpus -gt 1 ]; then
- affected=$(cat $CPU_PATH/cpu0/cpufreq/affected_cpus | grep 1)
- if [ -z $affected ]; then
switch_ondemand cpu0
switch_conservative cpu1
check_governor cpu0 'ondemand'
check_governor cpu1 'conservative'
- else
log_skip "combine governors not supported"
- # if more than one cpu, combine governors
- nrcpus=$(ls $CPU_PATH | grep "cpu[0-9].*" | wc -l)
- if [ $nrcpus -gt 1 ]; then
affected=$(cat $CPU_PATH/cpu0/cpufreq/affected_cpus | grep 1)
if [ -z $affected ]; then
switch_ondemand cpu0
switch_conservative cpu1
check_governor cpu0 'ondemand'
check_governor cpu1 'conservative'
else
log_skip "combine governors not supported"
fifi
- restore_governors
+else
- log_skip "scaling available governors not available"
fi
-restore_governors test_status_show -- 1.7.9.5
On 1 February 2015 at 22:02, Amit Kucheria amit.kucheria@linaro.org wrote:
On Mon, Feb 2, 2015 at 7:34 AM, Lisa Nguyen lisa.nguyen@linaro.org wrote:
Before searching for specific governors, check to see if the scaling_available_governors attribute exists first. It is to add more error handling.
This doesn't seem to handle interactive governor that is usually the default on Android.
Will investigate further.
Signed-off-by: Lisa Nguyen lisa.nguyen@linaro.org
cpufreq/cpufreq_05.sh | 83 +++++++++++++++++++++++++++---------------------- 1 file changed, 45 insertions(+), 38 deletions(-)
diff --git a/cpufreq/cpufreq_05.sh b/cpufreq/cpufreq_05.sh index 862d310..8d37bae 100755 --- a/cpufreq/cpufreq_05.sh +++ b/cpufreq/cpufreq_05.sh @@ -58,51 +58,58 @@ check_governor() { check "'$gov' directory exists" "test -d $GOV_PATH" }
-supported=$(cat $CPU_PATH/cpu0/cpufreq/scaling_available_governors | grep "ondemand") -if [ -z "$supported" ]; then
- log_skip "ondemand not supported"
-else
- for cpu in $cpus; do
switch_ondemand $cpu
- done
- check_governor $cpu 'ondemand'
-fi +scaling_govs=$(cat $CPU_PATH/cpu0/cpufreq/scaling_available_governors) +if [ -n "$scaling_govs" ]; then
- supported=$(cat $CPU_PATH/cpu0/cpufreq/scaling_available_governors | grep "ondemand")
- if [ -z "$supported" ]; then
log_skip "ondemand not supported"
- else
for cpu in $cpus; do
switch_ondemand $cpu
done
check_governor $cpu 'ondemand'
- fi
-supported=$(cat $CPU_PATH/cpu0/cpufreq/scaling_available_governors | grep "conservative") -if [ -z "$supported" ]; then
- log_skip "conservative not supported"
-else
- for cpu in $cpus; do
switch_conservative $cpu
- done
- check_governor $cpu 'conservative'
-fi
- supported=$(cat $CPU_PATH/cpu0/cpufreq/scaling_available_governors | grep "conservative")
- if [ -z "$supported" ]; then
log_skip "conservative not supported"
- else
for cpu in $cpus; do
switch_conservative $cpu
done
check_governor $cpu 'conservative'
- fi
-supported=$(cat $CPU_PATH/cpu0/cpufreq/scaling_available_governors | grep "userspace") -if [ -z "$supported" ]; then
- log_skip "userspace not supported"
-else
- for cpu in $cpus; do
switch_userspace $cpu
- done
supported=$(cat $CPU_PATH/cpu0/cpufreq/scaling_available_governors | grep "userspace")
if [ -z "$supported" ]; then
log_skip "userspace not supported"
else
for cpu in $cpus; do
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"
-fi
- fi
-# if more than one cpu, combine governors -nrcpus=$(ls $CPU_PATH | grep "cpu[0-9].*" | wc -l) -if [ $nrcpus -gt 1 ]; then
- affected=$(cat $CPU_PATH/cpu0/cpufreq/affected_cpus | grep 1)
- if [ -z $affected ]; then
switch_ondemand cpu0
switch_conservative cpu1
check_governor cpu0 'ondemand'
check_governor cpu1 'conservative'
- else
log_skip "combine governors not supported"
- # if more than one cpu, combine governors
- nrcpus=$(ls $CPU_PATH | grep "cpu[0-9].*" | wc -l)
- if [ $nrcpus -gt 1 ]; then
affected=$(cat $CPU_PATH/cpu0/cpufreq/affected_cpus | grep 1)
if [ -z $affected ]; then
switch_ondemand cpu0
switch_conservative cpu1
check_governor cpu0 'ondemand'
check_governor cpu1 'conservative'
else
log_skip "combine governors not supported"
fifi
- restore_governors
+else
- log_skip "scaling available governors not available"
fi
-restore_governors test_status_show -- 1.7.9.5
With this new change, the final result for the cpufreq_09 script will always show up and be counted in LAVA.
Signed-off-by: Lisa Nguyen lisa.nguyen@linaro.org --- cpufreq/cpufreq_09.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/cpufreq/cpufreq_09.sh b/cpufreq/cpufreq_09.sh index 3e40cbf..9135fd5 100755 --- a/cpufreq/cpufreq_09.sh +++ b/cpufreq/cpufreq_09.sh @@ -59,12 +59,11 @@ save_governors supported=$(cat $CPU_PATH/cpu0/cpufreq/scaling_available_governors | grep "powersave") if [ -z "$supported" ]; then log_skip "powersave not supported" - return 0 +else + for_each_cpu check_powersave fi
trap "restore_governors; sigtrap" HUP INT TERM
-for_each_cpu check_powersave - restore_governors test_status_show
On Mon, Feb 2, 2015 at 7:34 AM, Lisa Nguyen lisa.nguyen@linaro.org wrote:
With this new change, the final result for the cpufreq_09 script will always show up and be counted in LAVA.
Why?
Signed-off-by: Lisa Nguyen lisa.nguyen@linaro.org
cpufreq/cpufreq_09.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/cpufreq/cpufreq_09.sh b/cpufreq/cpufreq_09.sh index 3e40cbf..9135fd5 100755 --- a/cpufreq/cpufreq_09.sh +++ b/cpufreq/cpufreq_09.sh @@ -59,12 +59,11 @@ save_governors supported=$(cat $CPU_PATH/cpu0/cpufreq/scaling_available_governors | grep "powersave") if [ -z "$supported" ]; then log_skip "powersave not supported"
- return 0
+else
- for_each_cpu check_powersave
fi
trap "restore_governors; sigtrap" HUP INT TERM
-for_each_cpu check_powersave
restore_governors test_status_show -- 1.7.9.5
On 1 February 2015 at 22:03, Amit Kucheria amit.kucheria@linaro.org wrote:
On Mon, Feb 2, 2015 at 7:34 AM, Lisa Nguyen lisa.nguyen@linaro.org wrote:
With this new change, the final result for the cpufreq_09 script will always show up and be counted in LAVA.
Why?
I'll look into this in detail. It was a quick hack since the cpufreq_09 test result wasn't showing up in LAVA with the existing code. Will respin if necessary.
Signed-off-by: Lisa Nguyen lisa.nguyen@linaro.org
cpufreq/cpufreq_09.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/cpufreq/cpufreq_09.sh b/cpufreq/cpufreq_09.sh index 3e40cbf..9135fd5 100755 --- a/cpufreq/cpufreq_09.sh +++ b/cpufreq/cpufreq_09.sh @@ -59,12 +59,11 @@ save_governors supported=$(cat $CPU_PATH/cpu0/cpufreq/scaling_available_governors | grep "powersave") if [ -z "$supported" ]; then log_skip "powersave not supported"
- return 0
+else
- for_each_cpu check_powersave
fi
trap "restore_governors; sigtrap" HUP INT TERM
-for_each_cpu check_powersave
restore_governors test_status_show -- 1.7.9.5
Signed-off-by: Lisa Nguyen lisa.nguyen@linaro.org --- 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/Pm...
- . ../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"
Hi Lisa,
On Mon, Feb 2, 2015 at 7:34 AM, Lisa Nguyen lisa.nguyen@linaro.org wrote:
Changes in v2:
- Reorganized previous patchset and recreated patches based on
logical change
- Rewritten logic to find certain attributes in sysfs
[Let's try again...]
Looks much better and easier to review. Still a few more things for the perfect patchset though :)
You've conflated several things into one big patch series - removal of bashisms, bug fixes, better error handling, new features.
Patches 1-12 seem to contain all the bashism removal. Let us get those merged first after you've run them through git test-sequence[1]. This'll make sure that the change from /bin/bash to /bin/sh in the first patch won't break the intermediate state of the tree. Each patch should be atomic.
[1] http://dustin.sallings.org/2010/03/28/git-test-sequence.html
This patchset primarily fixes Linaro Bug# 772 (https://bugs.linaro.org/show_bug.cgi?id=772) to remove bashisms in all PM-QA scripts. These scripts will run on Android, Openembedded, and Ubuntu.
Cleanups have been done to remove redundant code, improve readability, and resolve syntax errors that were not detected before.
Currently, the suspend and powertop test modules are disabled. However, to maintain consistency, the format of the suspend and powertop scripts have been updated to be POSIX-compliant.
Next steps:
Once this patchset has been reviewed and acked, the following steps will be taken:
- Submit a patch to update the release tag on the pwrmgmt
test definitions to pm-qa-v0.5.0
- Submit a patch to update the pm-qa script
(https://git.linaro.org/qa/test-definitions.git/blob/HEAD:/common/scripts/pm-...) used to run PM-QA on Android by removing unnecessary busybox sym links and replace suspend test module with thermal in directory list.
- Investigate further on why pandaboards do not like the
cpuidle_03 test case.
- Update the PM-QA wiki with new test cases and their descriptions:
https://wiki.linaro.org/WorkingGroups/PowerManagement/Resources/TestSuite/Pm...
Comments and/or questions are highly encouraged.
Lisa Nguyen (25): Fix path to library files and change shebang line Replace double equals with one for comparison Remove sigtrap prefixes for traps Remove local keywords and uninitialized variables Fix syntax to get the cpu id number Remove thermal_try_max variable Switches: Add hotplug_allow_cpu0=0 cpuhotplug: Rewrite randomize() function Fix the syntax to call C programs cpuidle: Use is_root() function in cpuidle_03 Remove unused variables and rename some Remove BASH arrays Rewrite logic to check for sampling_rate suspend_functions: Check if $LOGDIR exists cpuhotplug: Rename 1_sanity_check files to cpuhotplug_00 files cpuhotplug: Rename z_sanity_check files to cpuhotplug_99 cputopology: Add cputopology_sanity.sh Android: Update makefiles with new test numbers Use -q option for grep command Improve test conditions to see if a directory or file exists cpufreq: Remove unnecessary checks Test: Add sort function cpufreq: Check to see if scaling_available_governors is available cpufreq: Rewrite logic to check if powersave is supported Whitespace cleanup
Switches.sh | 6 +- Test.mk | 2 +- cpufreq/cpufreq_01.sh | 4 +- cpufreq/cpufreq_02.sh | 4 +- cpufreq/cpufreq_03.sh | 15 +- cpufreq/cpufreq_04.sh | 16 +-- cpufreq/cpufreq_05.sh | 105 +++++++------- cpufreq/cpufreq_06.sh | 46 +++--- cpufreq/cpufreq_07.sh | 47 +++---- cpufreq/cpufreq_08.sh | 26 ++-- cpufreq/cpufreq_09.sh | 28 ++-- cpufreq/cpufreq_sanity.sh | 10 +- cpuhotplug/1_sanity_check.sh | 40 ------ cpuhotplug/1_sanity_check.txt | 1 - cpuhotplug/Android.mk | 4 +- cpuhotplug/cpuhotplug_00.sh | 40 ++++++ cpuhotplug/cpuhotplug_00.txt | 1 + cpuhotplug/cpuhotplug_01.sh | 5 +- cpuhotplug/cpuhotplug_02.sh | 23 ++- cpuhotplug/cpuhotplug_03.sh | 18 ++- cpuhotplug/cpuhotplug_04.sh | 17 +-- cpuhotplug/cpuhotplug_05.sh | 13 +- cpuhotplug/cpuhotplug_06.sh | 15 +- cpuhotplug/cpuhotplug_07.sh | 26 ++-- cpuhotplug/cpuhotplug_08.sh | 22 +-- cpuhotplug/cpuhotplug_99.sh | 40 ++++++ cpuhotplug/cpuhotplug_99.txt | 1 + cpuhotplug/cpuhotplug_sanity.sh | 6 +- cpuhotplug/z_sanity_check.sh | 40 ------ cpuhotplug/z_sanity_check.txt | 1 - cpuidle/cpuidle_01.sh | 18 ++- cpuidle/cpuidle_02.sh | 6 +- cpuidle/cpuidle_03.sh | 16 +-- cpuidle/cpuidle_sanity.sh | 7 +- cputopology/Android.mk | 2 +- cputopology/cputopology_01.sh | 9 +- cputopology/cputopology_02.sh | 4 +- cputopology/cputopology_sanity.sh | 49 +++++++ cputopology/cputopology_sanity.txt | 1 + include/functions.sh | 274 +++++++++++++++++------------------- include/suspend_functions.sh | 21 +-- include/thermal_functions.sh | 215 ++++++++++++++-------------- powertop/powertop_01.sh | 19 ++- powertop/powertop_sanity.sh | 7 +- suspend/suspend_01.sh | 6 +- suspend/suspend_02.sh | 8 +- suspend/suspend_03.sh | 6 +- suspend/suspend_04.sh | 6 +- suspend/suspend_05.sh | 14 +- suspend/suspend_sanity.sh | 4 +- thermal/thermal_00.sh | 22 +-- thermal/thermal_01.sh | 43 +++--- thermal/thermal_02.sh | 42 +++--- thermal/thermal_03.sh | 18 +-- thermal/thermal_04.sh | 59 ++++---- thermal/thermal_05.sh | 50 +++---- thermal/thermal_06.sh | 96 +++++++------ thermal/thermal_sanity.sh | 7 +- utils/utils_sanity.sh | 4 +- 59 files changed, 827 insertions(+), 828 deletions(-) delete mode 100755 cpuhotplug/1_sanity_check.sh delete mode 100644 cpuhotplug/1_sanity_check.txt create mode 100755 cpuhotplug/cpuhotplug_00.sh create mode 100644 cpuhotplug/cpuhotplug_00.txt create mode 100755 cpuhotplug/cpuhotplug_99.sh create mode 100644 cpuhotplug/cpuhotplug_99.txt delete mode 100755 cpuhotplug/z_sanity_check.sh delete mode 100644 cpuhotplug/z_sanity_check.txt create mode 100755 cputopology/cputopology_sanity.sh create mode 100644 cputopology/cputopology_sanity.txt
-- 1.7.9.5
On Mon, Feb 2, 2015 at 11:40 AM, Amit Kucheria amit.kucheria@linaro.org wrote:
Hi Lisa,
On Mon, Feb 2, 2015 at 7:34 AM, Lisa Nguyen lisa.nguyen@linaro.org wrote:
Changes in v2:
- Reorganized previous patchset and recreated patches based on
logical change
- Rewritten logic to find certain attributes in sysfs
[Let's try again...]
Looks much better and easier to review. Still a few more things for the perfect patchset though :)
You've conflated several things into one big patch series - removal of bashisms, bug fixes, better error handling, new features.
Patches 1-12 seem to contain all the bashism removal. Let us get those merged first after you've run them through git test-sequence[1]. This'll make sure that the change from /bin/bash to /bin/sh in the first patch won't break the intermediate state of the tree. Each patch should be atomic.
[1] http://dustin.sallings.org/2010/03/28/git-test-sequence.html
To be perfectly clear, please feel free to add my reviewed-by to 1-12 after you do two things: 1. Run them through git test-sequence 2. Minor fix in 9
On 1 February 2015 at 22:16, Amit Kucheria amit.kucheria@linaro.org wrote:
On Mon, Feb 2, 2015 at 11:40 AM, Amit Kucheria amit.kucheria@linaro.org wrote:
Hi Lisa,
On Mon, Feb 2, 2015 at 7:34 AM, Lisa Nguyen lisa.nguyen@linaro.org wrote:
Changes in v2:
- Reorganized previous patchset and recreated patches based on
logical change
- Rewritten logic to find certain attributes in sysfs
[Let's try again...]
Looks much better and easier to review. Still a few more things for the perfect patchset though :)
You've conflated several things into one big patch series - removal of bashisms, bug fixes, better error handling, new features.
Patches 1-12 seem to contain all the bashism removal. Let us get those merged first after you've run them through git test-sequence[1]. This'll make sure that the change from /bin/bash to /bin/sh in the first patch won't break the intermediate state of the tree. Each patch should be atomic.
[1] http://dustin.sallings.org/2010/03/28/git-test-sequence.html
To be perfectly clear, please feel free to add my reviewed-by to 1-12 after you do two things:
- Run them through git test-sequence
- Minor fix in 9
Ack, will do those two steps.
Thanks for your review!