On 08/08/14 14:32, Sanjay Singh Rawat wrote:

On Friday 08 August 2014 10:43 AM, Amit Kucheria wrote:
On Fri, Aug 8, 2014 at 7:05 AM, Lisa Nguyen <lisa.ngu...@linaro.org> wrote:
Create a global variable that will look for number of cpus
for a platform and use it in multiple functions to make the
code simplier to read.
Agree with the patch.

Signed-off-by: Lisa Nguyen <lisa.ngu...@linaro.org>
---
diff --git a/cpuhotplug/cpuhotplug_sanity.sh b/cpuhotplug/cpuhotplug_sanity.sh
index d9b6af8..2ad24ff 100755
--- a/cpuhotplug/cpuhotplug_sanity.sh
+++ b/cpuhotplug/cpuhotplug_sanity.sh
@@ -33,7 +33,6 @@ fi

   check_cpuhotplug_sysfs_entry() {

-    cpus=$(ls $CPU_PATH | grep "cpu[0-9].*")
       cpunum=$(ls $CPU_PATH | grep "cpu[0-9].*" -c)

       if [ $cpunum -eq 1 ]; then
diff --git a/include/functions.sh b/include/functions.sh
index e0f08fb..74b2294 100644
--- a/include/functions.sh
+++ b/include/functions.sh
@@ -30,6 +30,7 @@ TEST_NAME=$(basename ${0%.sh})
   PREFIX=$TEST_NAME
   INC=0
   CPU=
+cpus=$(ls $CPU_PATH | grep "cpu[0-9].*")
Let's fix this properly while we're at it. We already have boards with
more than 10 cpus now - D01.

- Its fine, it will work. The sqare brackets filters the pattern, e.g.
with this filter

cpu1 and also all cpu1*** will be filtered IN.

- Issue with this filter here is it will return cpu is improper order, as

cpu0
cpu1
cpu10
cpu11
cpu12
cpu13
cpu14
cpu15
cpu2
cpu3
cpu4

so here after cpu1, cpu10 will be processed instead of logically cpu2.
We can sort using *-v*
option of ls here to get cpus sequentially

cpus=$(ls -1v $CPU_PATH | grep "cpu[0-9].*")



It might be worth checking that the CPUs you find are online. In an IKS system half the CPUs are offline.

--Chris

_______________________________________________
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev

Reply via email to