diff mbox

[pmqa] test feature supported before running suite

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

Commit Message

Sanjay Singh Rawat Jan. 29, 2014, 7:03 a.m. UTC
add a basic sanity file which will check for feature support and
will proceed only if feature supported

Signed-off-by: Sanjay Singh Rawat <sanjay.rawat@linaro.org>
---

- sanity file will run first to check for feature support.
- added entry for sanity file for android
- this will need a change in the lava pm-qa trigger script for the
  tests, will make the change separately now.

regards,
sanjay
---
 cpufreq/Android.mk               |    2 +-
 cpufreq/cpufreq_sanity.sh        |   40 +++++++++++++++++++++++++++++++++
 cpufreq/cpufreq_sanity.txt       |    1 +
 cpuhotplug/Android.mk            |    2 +-
 cpuhotplug/cpuhotplug_sanity.sh  |   45 ++++++++++++++++++++++++++++++++++++++
 cpuhotplug/cpuhotplug_sanity.txt |    1 +
 cpuidle/Android.mk               |    2 +-
 cpuidle/cpuidle_sanity.sh        |    8 +++++--
 cpuidle/cpuidle_sanity.txt       |    2 +-
 thermal/Android.mk               |    2 +-
 thermal/thermal_sanity.sh        |    7 +++++-
 11 files changed, 104 insertions(+), 8 deletions(-)
 create mode 100755 cpufreq/cpufreq_sanity.sh
 create mode 100644 cpufreq/cpufreq_sanity.txt
 create mode 100755 cpuhotplug/cpuhotplug_sanity.sh
 create mode 100644 cpuhotplug/cpuhotplug_sanity.txt
diff mbox

Patch

diff --git a/cpufreq/Android.mk b/cpufreq/Android.mk
index 2da6056..bd07fae 100644
--- a/cpufreq/Android.mk
+++ b/cpufreq/Android.mk
@@ -14,5 +14,5 @@  define $(module_name)_add_executable
     include $(BUILD_PREBUILT)
 endef
 
-test_num := 01 02 03 04 05 06 07 08 09
+test_num := sanity 01 02 03 04 05 06 07 08 09
 $(foreach item,$(test_num),$(eval $(call $(module_name)_add_executable, $(module_name)_$(item))))
diff --git a/cpufreq/cpufreq_sanity.sh b/cpufreq/cpufreq_sanity.sh
new file mode 100755
index 0000000..7eb2728
--- /dev/null
+++ b/cpufreq/cpufreq_sanity.sh
@@ -0,0 +1,40 @@ 
+#!/bin/bash
+#
+# PM-QA validation test suite for the power management on Linux
+#
+# Copyright (C) 2014, 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:
+#     Sanjay Singh Rawat <sanjay.rawat@linaro.org>
+#       - initial API and implementation
+#
+
+source ../include/functions.sh
+
+check_cpufreq_sysfs_entry() {
+
+    local dirpath=$CPU_PATH/cpufreq
+
+    test -d $dirpath
+    if [ $? -ne 0 ]; then
+        echo "cpufreq is not enabled. Skipping all cpufreq tests"
+        return 0
+    fi
+    return 1
+}
+
+check_cpufreq_sysfs_entry
diff --git a/cpufreq/cpufreq_sanity.txt b/cpufreq/cpufreq_sanity.txt
new file mode 100644
index 0000000..6390898
--- /dev/null
+++ b/cpufreq/cpufreq_sanity.txt
@@ -0,0 +1 @@ 
+cpufreq is not supported. Skipping all cpufreq tests...
diff --git a/cpuhotplug/Android.mk b/cpuhotplug/Android.mk
index c0e5694..7095044 100644
--- a/cpuhotplug/Android.mk
+++ b/cpuhotplug/Android.mk
@@ -14,7 +14,7 @@  define $(module_name)_add_executable
     include $(BUILD_PREBUILT)
 endef
 
-test_num := 01 02 03 04 05 06 07 08
+test_num := sanity 01 02 03 04 05 06 07 08
 $(foreach item,$(test_num),$(eval $(call $(module_name)_add_executable, $(module_name)_$(item))))
 
 define $(module_name)_etc_add_executable
diff --git a/cpuhotplug/cpuhotplug_sanity.sh b/cpuhotplug/cpuhotplug_sanity.sh
new file mode 100755
index 0000000..01ed591
--- /dev/null
+++ b/cpuhotplug/cpuhotplug_sanity.sh
@@ -0,0 +1,45 @@ 
+#!/bin/bash
+#
+# PM-QA validation test suite for the power management on Linux
+#
+# Copyright (C) 2014, 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:
+#     Sanjay Singh Rawat <sanjay.rawat@linaro.org>
+#       - initial API and implementation
+#
+
+source ../include/functions.sh
+
+check_cpuhotplug_sysfs_entry() {
+
+    cpus=$(ls $CPU_PATH | grep "cpu[0-9].*")
+
+    for cpu in $cpus; do
+        # assuming cpu0 can't be plugged out
+        if [ $cpu != "cpu0" ]; then
+            test -f $CPU_PATH/$cpu/online
+            if [ $? -ne 0 ]; then
+                echo "cpuhotplug is not enabled. Skipping all cpuhotplug tests"
+                return 0
+            fi
+        fi
+    done
+    return 1
+}
+
+check_cpuhotplug_sysfs_entry
diff --git a/cpuhotplug/cpuhotplug_sanity.txt b/cpuhotplug/cpuhotplug_sanity.txt
new file mode 100644
index 0000000..96b6d29
--- /dev/null
+++ b/cpuhotplug/cpuhotplug_sanity.txt
@@ -0,0 +1 @@ 
+cpuhotplug is not supported. Skipping all cpuhotplug tests...
diff --git a/cpuidle/Android.mk b/cpuidle/Android.mk
index 2f302d7..07972de 100644
--- a/cpuidle/Android.mk
+++ b/cpuidle/Android.mk
@@ -14,7 +14,7 @@  define $(module_name)_add_executable
     include $(BUILD_PREBUILT)
 endef
 
-test_num := 01 02 03
+test_num := sanity 01 02 03
 $(foreach item,$(test_num),$(eval $(call $(module_name)_add_executable, $(module_name)_$(item))))
 
 include $(CLEAR_VARS)
diff --git a/cpuidle/cpuidle_sanity.sh b/cpuidle/cpuidle_sanity.sh
index 568c129..e59bbd9 100755
--- a/cpuidle/cpuidle_sanity.sh
+++ b/cpuidle/cpuidle_sanity.sh
@@ -29,8 +29,12 @@  check_cpuidle_sysfs_entry() {
 
     local dirpath=$CPU_PATH/cpuidle
 
-    test -d $dirpath && return 1 || return 0
+    test -d $dirpath
+    if [ $? -ne 0 ]; then
+        echo "cpuidle is not enabled. Skipping all cpuidle tests"
+        return 0
+    fi
+    return 1
 }
 
 check_cpuidle_sysfs_entry
-test_status_show
diff --git a/cpuidle/cpuidle_sanity.txt b/cpuidle/cpuidle_sanity.txt
index 03d3f7c..4928c88 100644
--- a/cpuidle/cpuidle_sanity.txt
+++ b/cpuidle/cpuidle_sanity.txt
@@ -1 +1 @@ 
-cpuidle is not enabled. Skipping all cpudile tests...
+cpuidle is not supported. Skipping all cpuidle tests...
diff --git a/thermal/Android.mk b/thermal/Android.mk
index d950a14..de4edbf 100644
--- a/thermal/Android.mk
+++ b/thermal/Android.mk
@@ -14,5 +14,5 @@  define $(module_name)_add_executable
     include $(BUILD_PREBUILT)
 endef
 
-test_num := 01 02 03 04 05 06
+test_num := sanity 01 02 03 04 05 06
 $(foreach item,$(test_num),$(eval $(call $(module_name)_add_executable, $(module_name)_$(item))))
diff --git a/thermal/thermal_sanity.sh b/thermal/thermal_sanity.sh
index 25cbab9..d7181c0 100755
--- a/thermal/thermal_sanity.sh
+++ b/thermal/thermal_sanity.sh
@@ -28,7 +28,12 @@  source ../include/thermal_functions.sh
 
 check_thermal_zone() {
 
-    test -d $THERMAL_PATH && return 1 || return 0
+    test -d $THERMAL_PATH
+    if [ $? -ne 0 ]; then
+        echo "thermal zone is not available. Skipping all tests"
+        return 0
+    fi
+    return 1
 }
 
 check_thermal_zone