aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Lezcano <daniel.lezcano@linaro.org>2011-06-06 14:23:37 +0200
committerDaniel Lezcano <daniel.lezcano@linaro.org>2011-06-06 14:23:37 +0200
commita0eb574b50036ff68728412e5758c69e73245137 (patch)
treecbfe45b70be1ca7977e00b1223937245d3a31e54
parent6fec1077cee2bbaad7a785c0cfff4ad4bbe384be (diff)
cpufreq : add smp support for avail_freq01.sh
Make the test for all cpus Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
-rwxr-xr-xtestcases/cpufreq/avail_freq01.sh56
1 files changed, 32 insertions, 24 deletions
diff --git a/testcases/cpufreq/avail_freq01.sh b/testcases/cpufreq/avail_freq01.sh
index 489c1ea..793c9bd 100755
--- a/testcases/cpufreq/avail_freq01.sh
+++ b/testcases/cpufreq/avail_freq01.sh
@@ -12,30 +12,38 @@
# Contributors:
# Torez Smith <torez.smith@linaro.org> (IBM Corporation)
# - initial API and implementation
+ # Daniel Lezcano <daniel.lezcano@linaro.org> (IBM Corporation)
+ # - Added SMP support
#******************************************************************************/
-###
- # To test ability to monitor and/or alter cpu frequency on the board, assure
- # basic files are there.
-###
-
-if [ -d /sys/devices/system/cpu/cpu0/cpufreq ] ; then
- if [ ! -f /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies ] ; then
- echo "NA no added frequencies"
- exit -1;
- fi
- if [ ! -f /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq ] ; then
- echo "FAIL missing current frequency file"
- exit -1;
- fi
- if [ ! -f /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed ] ; then
- echo "FAIL missing file to set frequency speed"
- exit -1;
- fi
- echo "PASS `cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies `"
- exit 0;
-else
- echo "NA no added frequencies"
- exit -1;
-fi
+# Description : We are checking the frequency scaling file system is
+# available. This test checks we have the framework to run the other
+# tests in order to test the ability to monitor and/or alter cpu
+# frequency on the board, let's assure the basic files are there.
+
+CPU_PATH="/sys/devices/system/cpu"
+
+check_freq() {
+ if [ ! -f $CPU_PATH/$1/cpufreq/scaling_available_frequencies ] ; then
+ echo "NA no added frequencies"
+ return 1;
+ fi
+
+ if [ ! -f $CPU_PATH/$1/cpufreq/scaling_cur_freq ] ; then
+ echo "missing current frequency file"
+ return 1;
+ fi
+
+ if [ ! -f $CPU_PATH/$1/cpufreq/scaling_setspeed ] ; then
+ echo "missing file to set frequency speed"
+ return 1;
+ fi
+
+ echo "PASS `cat $CPU_PATH/$1/cpufreq/scaling_available_frequencies `"
+ return 0;
+}
+
+for i in $(ls $CPU_PATH | grep "cpu[0-9].*"); do
+ check_freq $i
+done