aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSanjay Singh Rawat <sanjay.rawat@linaro.org>2014-01-29 12:15:02 +0530
committerSanjay Singh Rawat <sanjay.rawat@linaro.org>2014-02-20 11:41:06 +0530
commit736aef65e8b9200a4974ed8df8bedeb0adf62217 (patch)
tree4059c8ca941e130eaa6f51e1ea6f59f8e82a8942
parentd5963e55e84ba19740993e177b463a31e2dd8859 (diff)
test feature supported before running suite
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>
-rw-r--r--cpufreq/Android.mk2
-rwxr-xr-xcpufreq/cpufreq_03.sh6
-rwxr-xr-xcpufreq/cpufreq_04.sh6
-rwxr-xr-xcpufreq/cpufreq_05.sh6
-rwxr-xr-xcpufreq/cpufreq_06.sh6
-rwxr-xr-xcpufreq/cpufreq_07.sh6
-rwxr-xr-xcpufreq/cpufreq_08.sh6
-rwxr-xr-xcpufreq/cpufreq_09.sh6
-rwxr-xr-xcpufreq/cpufreq_sanity.sh46
-rw-r--r--cpufreq/cpufreq_sanity.txt1
-rw-r--r--cpuhotplug/Android.mk2
-rwxr-xr-xcpuhotplug/cpuhotplug_sanity.sh51
-rw-r--r--cpuhotplug/cpuhotplug_sanity.txt1
-rw-r--r--cpuidle/Android.mk2
-rwxr-xr-xcpuidle/cpuidle_02.sh6
-rwxr-xr-xcpuidle/cpuidle_03.sh6
-rw-r--r--cpuidle/cpuidle_04.sh6
-rwxr-xr-xcpuidle/cpuidle_sanity.sh14
-rw-r--r--cpuidle/cpuidle_sanity.txt2
-rw-r--r--thermal/Android.mk2
-rwxr-xr-xthermal/thermal_sanity.sh13
-rw-r--r--thermal/thermal_sanity.txt2
-rwxr-xr-xutils/utils_sanity.sh39
23 files changed, 168 insertions, 69 deletions
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_03.sh b/cpufreq/cpufreq_03.sh
index 1e19e72..65a6ad7 100755
--- a/cpufreq/cpufreq_03.sh
+++ b/cpufreq/cpufreq_03.sh
@@ -27,12 +27,6 @@
source ../include/functions.sh
-is_root
-if [ $? -ne 0 ]; then
- log_skip "user is not root"
- exit 0
-fi
-
check_governor() {
local cpu=$1
diff --git a/cpufreq/cpufreq_04.sh b/cpufreq/cpufreq_04.sh
index e75d9cb..d4ed1bd 100755
--- a/cpufreq/cpufreq_04.sh
+++ b/cpufreq/cpufreq_04.sh
@@ -27,12 +27,6 @@
source ../include/functions.sh
-is_root
-if [ $? -ne 0 ]; then
- log_skip "user is not root"
- exit 0
-fi
-
check_frequency() {
local cpu=$1
diff --git a/cpufreq/cpufreq_05.sh b/cpufreq/cpufreq_05.sh
index 86c8b56..93fce78 100755
--- a/cpufreq/cpufreq_05.sh
+++ b/cpufreq/cpufreq_05.sh
@@ -27,12 +27,6 @@
source ../include/functions.sh
-is_root
-if [ $? -ne 0 ]; then
- log_skip "user is not root"
- exit 0
-fi
-
save_governors
trap restore_governors SIGHUP SIGINT SIGTERM
diff --git a/cpufreq/cpufreq_06.sh b/cpufreq/cpufreq_06.sh
index 7a3dd4b..65e824f 100755
--- a/cpufreq/cpufreq_06.sh
+++ b/cpufreq/cpufreq_06.sh
@@ -101,12 +101,6 @@ check_deviation() {
for_each_frequency $cpu check_freq_deviation
}
-is_root
-if [ $? -ne 0 ]; then
- log_skip "user is not root"
- exit 0
-fi
-
supported=$(cat $CPU_PATH/cpu0/cpufreq/scaling_available_governors | grep "userspace")
if [ -z "$supported" ]; then
log_skip "userspace not supported"
diff --git a/cpufreq/cpufreq_07.sh b/cpufreq/cpufreq_07.sh
index 029a5bd..c9d49f0 100755
--- a/cpufreq/cpufreq_07.sh
+++ b/cpufreq/cpufreq_07.sh
@@ -77,12 +77,6 @@ check_ondemand() {
return 1
}
-is_root
-if [ $? -ne 0 ]; then
- log_skip "user is not root"
- exit 0
-fi
-
supported=$(cat $CPU_PATH/cpu0/cpufreq/scaling_available_governors | grep "ondemand")
if [ -z "$supported" ]; then
log_skip "ondemand not supported"
diff --git a/cpufreq/cpufreq_08.sh b/cpufreq/cpufreq_08.sh
index 996472c..d9104f6 100755
--- a/cpufreq/cpufreq_08.sh
+++ b/cpufreq/cpufreq_08.sh
@@ -66,12 +66,6 @@ check_userspace() {
save_governors
-is_root
-if [ $? -ne 0 ]; then
- log_skip "user is not root"
- exit 0
-fi
-
supported=$(cat $CPU_PATH/cpu0/cpufreq/scaling_available_governors | grep "userspace")
if [ -z "$supported" ]; then
log_skip "userspace not supported"
diff --git a/cpufreq/cpufreq_09.sh b/cpufreq/cpufreq_09.sh
index 08b7cb1..7b65eec 100755
--- a/cpufreq/cpufreq_09.sh
+++ b/cpufreq/cpufreq_09.sh
@@ -62,12 +62,6 @@ check_powersave() {
save_governors
-is_root
-if [ $? -ne 0 ]; then
- log_skip "user is not root"
- exit 0
-fi
-
supported=$(cat $CPU_PATH/cpu0/cpufreq/scaling_available_governors | grep "powersave")
if [ -z "$supported" ]; then
log_skip "powersave not supported"
diff --git a/cpufreq/cpufreq_sanity.sh b/cpufreq/cpufreq_sanity.sh
new file mode 100755
index 0000000..a5dda60
--- /dev/null
+++ b/cpufreq/cpufreq_sanity.sh
@@ -0,0 +1,46 @@
+#!/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
+
+is_root
+if [ $? -ne 0 ]; then
+ log_skip "user is not root"
+ exit 0
+fi
+
+check_cpufreq_sysfs_entry() {
+
+ local dirpath=$CPU_PATH/cpufreq
+
+ test -d $dirpath
+ if [ $? -ne 0 ]; then
+ echo "cpufreq is not supported. 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..bee26be
--- /dev/null
+++ b/cpufreq/cpufreq_sanity.txt
@@ -0,0 +1 @@
+cpufreq is not supported or not the root user. 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..ef63adb
--- /dev/null
+++ b/cpuhotplug/cpuhotplug_sanity.sh
@@ -0,0 +1,51 @@
+#!/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
+
+is_root
+if [ $? -ne 0 ]; then
+ log_skip "user is not root"
+ exit 0
+fi
+
+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 supported. 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..a372bd1
--- /dev/null
+++ b/cpuhotplug/cpuhotplug_sanity.txt
@@ -0,0 +1 @@
+cpuhotplug is not supported or not the root user. 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_02.sh b/cpuidle/cpuidle_02.sh
index 77261c4..0056382 100755
--- a/cpuidle/cpuidle_02.sh
+++ b/cpuidle/cpuidle_02.sh
@@ -29,11 +29,5 @@ source ../include/functions.sh
CPUIDLE_KILLER=./cpuidle_killer
-is_root
-if [ $? -ne 0 ]; then
- log_skip "user is not root"
- exit 0
-fi
-
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 1138207..663d385 100755
--- a/cpuidle/cpuidle_03.sh
+++ b/cpuidle/cpuidle_03.sh
@@ -49,12 +49,6 @@ check_cpuidle_kill() {
check "cpuidle program runs successfully (120 secs)" "./$CPUIDLE_KILLER"
}
-is_root
-if [ $? -ne 0 ]; then
- log_skip "user is not root"
- exit 0
-fi
-
trap "restore_cpus; sigtrap" SIGHUP SIGINT SIGTERM
for_each_cpu check_cpuidle_kill
diff --git a/cpuidle/cpuidle_04.sh b/cpuidle/cpuidle_04.sh
index 028b3ee..b9dd1ce 100644
--- a/cpuidle/cpuidle_04.sh
+++ b/cpuidle/cpuidle_04.sh
@@ -27,12 +27,6 @@ source ../include/functions.sh
CPUIDLE_STATS=./cpuidle_stats
-is_root
-if [ $? -ne 0 ]; then
- log_skip "user is not root"
- exit 0
-fi
-
check_cpuidle_stats() {
trace-cmd record -e cpu_idle
trace-cmd report trace.dat > trace-cpuidle.dat
diff --git a/cpuidle/cpuidle_sanity.sh b/cpuidle/cpuidle_sanity.sh
index 568c129..99f05b3 100755
--- a/cpuidle/cpuidle_sanity.sh
+++ b/cpuidle/cpuidle_sanity.sh
@@ -25,12 +25,22 @@
source ../include/functions.sh
+is_root
+if [ $? -ne 0 ]; then
+ log_skip "user is not root"
+ exit 0
+fi
+
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 supported. 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..42d1a5e 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 or not the root user. 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..93b2b9c 100755
--- a/thermal/thermal_sanity.sh
+++ b/thermal/thermal_sanity.sh
@@ -26,9 +26,20 @@
source ../include/functions.sh
source ../include/thermal_functions.sh
+is_root
+if [ $? -ne 0 ]; then
+ log_skip "user is not root"
+ exit 0
+fi
+
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
diff --git a/thermal/thermal_sanity.txt b/thermal/thermal_sanity.txt
index 0834ebb..7125642 100644
--- a/thermal/thermal_sanity.txt
+++ b/thermal/thermal_sanity.txt
@@ -1 +1 @@
-thermal zone is not available. Skipping all tests...
+thermal zone is not available or not the root user. Skipping all tests...
diff --git a/utils/utils_sanity.sh b/utils/utils_sanity.sh
new file mode 100755
index 0000000..84f4905
--- /dev/null
+++ b/utils/utils_sanity.sh
@@ -0,0 +1,39 @@
+#!/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
+
+is_root
+if [ $? -ne 0 ]; then
+ log_skip "user is not root"
+ exit 0
+fi
+
+check_utils() {
+ # just returning SUCCESS, so suite doesn't break
+ return 1
+}
+
+check_utils