cpufreq : add smp support for avail_freq01.sh

Make the test for all cpus

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
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.
-###
+# 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.
 
-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
+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