diff mbox

[pmqa] cpuidle: check feature enabled before starting

Message ID 1390568759-21594-1-git-send-email-sanjay.rawat@linaro.org
State New
Headers show

Commit Message

Sanjay Singh Rawat Jan. 24, 2014, 1:05 p.m. UTC
Signed-off-by: Sanjay Singh Rawat <sanjay.rawat@linaro.org>
---

As ubuntu and android have their own way of invoking the tests. Better
to have a function call in each script, to check for the feature state.

regards,
sanjay
---
 cpuidle/cpuidle_01.sh |    6 ++++++
 cpuidle/cpuidle_02.sh |    6 ++++++
 cpuidle/cpuidle_03.sh |    6 ++++++
 cpuidle/cpuidle_04.sh |    6 ++++++
 include/functions.sh  |    4 ++++
 5 files changed, 28 insertions(+)
 mode change 100644 => 100755 cpuidle/cpuidle_04.sh
diff mbox

Patch

diff --git a/cpuidle/cpuidle_01.sh b/cpuidle/cpuidle_01.sh
index 8aa62c2..b4260fa 100755
--- a/cpuidle/cpuidle_01.sh
+++ b/cpuidle/cpuidle_01.sh
@@ -30,6 +30,12 @@  source ../include/functions.sh
 STATES="desc latency name power time usage"
 FILES="current_driver current_governor_ro"
 
+cpuidle_enabled
+if [ $? -ne 0 ]; then
+    log_skip "cpuidle not supported"
+    exit 0
+fi
+
 check_cpuidle_state_files() {
 
     local dirpath=$CPU_PATH/$1/cpuidle
diff --git a/cpuidle/cpuidle_02.sh b/cpuidle/cpuidle_02.sh
index 77261c4..670f3f5 100755
--- a/cpuidle/cpuidle_02.sh
+++ b/cpuidle/cpuidle_02.sh
@@ -29,6 +29,12 @@  source ../include/functions.sh
 
 CPUIDLE_KILLER=./cpuidle_killer
 
+cpuidle_enabled
+if [ $? -ne 0 ]; then
+    log_skip "cpuidle not supported"
+    exit 0
+fi
+
 is_root
 if [ $? -ne 0 ]; then
     log_skip "user is not root"
diff --git a/cpuidle/cpuidle_03.sh b/cpuidle/cpuidle_03.sh
index 645a94d..5231d9d 100755
--- a/cpuidle/cpuidle_03.sh
+++ b/cpuidle/cpuidle_03.sh
@@ -29,6 +29,12 @@  source ../include/functions.sh
 
 CPUIDLE_KILLER=./cpuidle_killer
 
+cpuidle_enabled
+if [ $? -ne 0 ]; then
+    log_skip "cpuidle not supported"
+    exit 0
+fi
+
 is_root
 if [ $? -ne 0 ]; then
     log_skip "user is not root"
diff --git a/cpuidle/cpuidle_04.sh b/cpuidle/cpuidle_04.sh
old mode 100644
new mode 100755
index 028b3ee..5814653
--- a/cpuidle/cpuidle_04.sh
+++ b/cpuidle/cpuidle_04.sh
@@ -27,6 +27,12 @@  source ../include/functions.sh
 
 CPUIDLE_STATS=./cpuidle_stats
 
+cpuidle_enabled
+if [ $? -ne 0 ]; then
+    log_skip "cpuidle not supported"
+    exit 0
+fi
+
 is_root
 if [ $? -ne 0 ]; then
     log_skip "user is not root"
diff --git a/include/functions.sh b/include/functions.sh
index 728f186..2a9cf21 100644
--- a/include/functions.sh
+++ b/include/functions.sh
@@ -349,6 +349,10 @@  cpufreq_enabled() {
     test -d /sys/devices/system/cpu/cpufreq
 }
 
+cpuidle_enabled() {
+    test -d /sys/devices/system/cpu/cpuidle
+}
+
 # currently we support ubuntu and android
 get_os() {
     lsb_release -a 2>&1 | grep -i ubuntu > /dev/null