change options for numerical comparision

use directory test option for cpufreq test and add warning message
for hotplug 07 test

Signed-off-by: Carlos Hernandez <ceh@ti.com>
Signed-off-by: Sanjay Singh Rawat <sanjay.rawat@linaro.org>
diff --git a/cpufreq/cpufreq_03.sh b/cpufreq/cpufreq_03.sh
index d41a979..0c59ce8 100755
--- a/cpufreq/cpufreq_03.sh
+++ b/cpufreq/cpufreq_03.sh
@@ -43,7 +43,7 @@
     set_governor $cpu $oldgov
 }
 
-if [ $(id -u) != 0 ]; then
+if [ $(id -u) -ne 0 ]; then
     log_skip "run as non-root"
     exit 0
 fi
diff --git a/cpufreq/cpufreq_04.sh b/cpufreq/cpufreq_04.sh
index 6092535..530366a 100755
--- a/cpufreq/cpufreq_04.sh
+++ b/cpufreq/cpufreq_04.sh
@@ -46,7 +46,7 @@
     set_governor $cpu $oldgov
 }
 
-if [ $(id -u) != 0 ]; then
+if [ $(id -u) -ne 0 ]; then
     log_skip "run as non-root"
     exit 0
 fi
diff --git a/cpufreq/cpufreq_05.sh b/cpufreq/cpufreq_05.sh
index 72ca554..7830118 100755
--- a/cpufreq/cpufreq_05.sh
+++ b/cpufreq/cpufreq_05.sh
@@ -27,7 +27,7 @@
 
 source ../include/functions.sh
 
-if [ $(id -u) != 0 ]; then
+if [ $(id -u) -ne 0 ]; then
     log_skip "run as non-root"
     exit 0
 fi
@@ -55,7 +55,7 @@
     local cpu=$1
     local gov=$2
 
-    if [ -e $CPU_PATH/$cpu/cpufreq/$gov ]; then
+    if [ -d $CPU_PATH/$cpu/cpufreq/$gov ]; then
         GOV_PATH=$CPU_PATH/$cpu/cpufreq/$gov
     else
         GOV_PATH=$CPU_PATH/cpufreq/$gov
@@ -97,7 +97,7 @@
 
 # if more than one cpu, combine governors
 nrcpus=$(ls $CPU_PATH | grep "cpu[0-9].*" | wc -l)
-if [ $nrcpus > 1 ]; then
+if [ $nrcpus -gt 1 ]; then
     affected=$(cat $CPU_PATH/cpu0/cpufreq/affected_cpus | grep 1)
     if [ -z $affected ]; then
         switch_ondemand cpu0
diff --git a/cpufreq/cpufreq_06.sh b/cpufreq/cpufreq_06.sh
index bfd38c9..25c473e 100755
--- a/cpufreq/cpufreq_06.sh
+++ b/cpufreq/cpufreq_06.sh
@@ -37,7 +37,7 @@
     set_frequency $cpu $freq
 
     result=$($CPUCYCLE $cpu)
-    if [ $? != 0 ]; then
+    if [ $? -ne 0 ]; then
 	return 1
     fi
 
@@ -101,7 +101,7 @@
     for_each_frequency $cpu check_freq_deviation
 }
 
-if [ $(id -u) != 0 ]; then
+if [ $(id -u) -ne 0 ]; then
     log_skip "run as non-root"
     exit 0
 fi
diff --git a/cpufreq/cpufreq_07.sh b/cpufreq/cpufreq_07.sh
index 1e6bdbe..abfad7f 100755
--- a/cpufreq/cpufreq_07.sh
+++ b/cpufreq/cpufreq_07.sh
@@ -42,7 +42,7 @@
     # wait for a quescient point
     for i in $(seq 1 10); do
 
-	if [ "$minfreq" == "$(get_frequency $cpu)" ]; then
+	if [ "$minfreq" -eq "$(get_frequency $cpu)" ]; then
 
 	    $CPUBURN $cpu &
 	    pid=$!
@@ -77,7 +77,7 @@
     return 1
 }
 
-if [ $(id -u) != 0 ]; then
+if [ $(id -u) -ne 0 ]; then
     log_skip "run as non-root"
     exit 0
 fi
diff --git a/cpufreq/cpufreq_08.sh b/cpufreq/cpufreq_08.sh
index a2f395b..79008f0 100755
--- a/cpufreq/cpufreq_08.sh
+++ b/cpufreq/cpufreq_08.sh
@@ -66,7 +66,7 @@
 
 save_governors
 
-if [ $(id -u) != 0 ]; then
+if [ $(id -u) -ne 0 ]; then
     log_skip "run as non-root"
     exit 0
 fi
diff --git a/cpufreq/cpufreq_09.sh b/cpufreq/cpufreq_09.sh
index 1381efc..a0c1171 100755
--- a/cpufreq/cpufreq_09.sh
+++ b/cpufreq/cpufreq_09.sh
@@ -53,7 +53,7 @@
     kill $pid
 
     check "'powersave' frequency $(frequnit $minfreq) is fixed" "test \"$curfreq\" == \"$minfreq\""
-    if [ "$?" != "0" ]; then
+    if [ "$?" -ne "0" ]; then
 	return 1
     fi
 
@@ -62,7 +62,7 @@
 
 save_governors
 
-if [ $(id -u) != 0 ]; then
+if [ $(id -u) -ne 0 ]; then
     log_skip "run as non-root"
     exit 0
 fi
diff --git a/cpuhotplug/cpuhotplug_07.sh b/cpuhotplug/cpuhotplug_07.sh
index 0ec67fc..d3674d2 100755
--- a/cpuhotplug/cpuhotplug_07.sh
+++ b/cpuhotplug/cpuhotplug_07.sh
@@ -34,7 +34,9 @@
         if [ $? -eq 0 ]; then
              return 0
         fi
+	log_skip "warning: udev monitor not running"
     done
+    return 1
 }
 
 check_notification() {
diff --git a/cpuidle/cpuidle_02.sh b/cpuidle/cpuidle_02.sh
index 8d4b476..e604a8b 100755
--- a/cpuidle/cpuidle_02.sh
+++ b/cpuidle/cpuidle_02.sh
@@ -29,7 +29,7 @@
 
 CPUIDLE_KILLER=./cpuidle_killer
 
-if [ $(id -u) != 0 ]; then
+if [ $(id -u) -ne 0 ]; then
     log_skip "run as non-root"
     exit 0
 fi
diff --git a/cpuidle/cpuidle_03.sh b/cpuidle/cpuidle_03.sh
index 251ee3e..b07bc89 100755
--- a/cpuidle/cpuidle_03.sh
+++ b/cpuidle/cpuidle_03.sh
@@ -29,7 +29,7 @@
 
 CPUIDLE_KILLER=./cpuidle_killer
 
-if [ $(id -u) != 0 ]; then
+if [ $(id -u) -ne 0 ]; then
     log_skip "run as non-root"
     exit 0
 fi
@@ -49,7 +49,7 @@
     check "cpuidle program runs successfully (120 secs)" "./$CPUIDLE_KILLER"
 }
 
-if [ $(id -u) != 0 ]; then
+if [ $(id -u) -ne 0 ]; then
     log_skip "run as non-root"
     exit 0
 fi
diff --git a/cpuidle/cpuidle_04.sh b/cpuidle/cpuidle_04.sh
index 7ec12d3..1688873 100644
--- a/cpuidle/cpuidle_04.sh
+++ b/cpuidle/cpuidle_04.sh
@@ -27,7 +27,7 @@
 
 CPUIDLE_STATS=./cpuidle_stats
 
-if [ $(id -u) != 0 ]; then
+if [ $(id -u) -ne 0 ]; then
     log_skip "run as non-root"
     exit 0
 fi
diff --git a/include/functions.sh b/include/functions.sh
index 874d2d2..7009fa3 100644
--- a/include/functions.sh
+++ b/include/functions.sh
@@ -126,12 +126,12 @@
     local nrfreq=
 
     latency=$(cat $dirpath/cpuinfo_transition_latency)
-    if [ $? != 0 ]; then
+    if [ $? -ne 0 ]; then
 	return 1
     fi
 
     nrfreq=$(cat $dirpath/scaling_available_frequencies | wc -w)
-    if [ $? != 0 ]; then
+    if [ $? -ne 0 ]; then
 	return 1
     fi
 
@@ -226,7 +226,7 @@
     log_begin "checking $descr"
 
     $func $@
-    if [ $? != 0 ]; then
+    if [ $? -ne 0 ]; then
 	log_end "Err"
 	fail_count=$(($fail_count + 1))
 	return 1
diff --git a/include/suspend_functions.sh b/include/suspend_functions.sh
index f06689f..1e8a793 100644
--- a/include/suspend_functions.sh
+++ b/include/suspend_functions.sh
@@ -44,7 +44,7 @@
 timer_sleep=20
 
 # root is needed to fiddle with the clock and use the rtc wakeups.
-if [ $(id -u) != 0 ]; then
+if [ $(id -u) -ne 0 ]; then
 	log_skip "run as non-root"
 	exit 0
 fi
diff --git a/include/thermal_functions.sh b/include/thermal_functions.sh
index 8a4d627..1f1991f 100644
--- a/include/thermal_functions.sh
+++ b/include/thermal_functions.sh
@@ -181,7 +181,7 @@
 
     local flag=0
     for cpu in $(ls $CPU_PATH | grep "cpu[0-9].*"); do
-	if [ $before_freq_list[$index] != $afterf_req_list[$index] ] ; then
+	if [ $before_freq_list[$index] -ne $afterf_req_list[$index] ] ; then
 	    flag=1	
 	fi
         index=$((index + 1)) 
@@ -275,7 +275,7 @@
         return
     fi
 
-    if [ "$gpu_pid" != 0 ]; then
+    if [ "$gpu_pid" -ne 0 ]; then
 	kill -9 $gpu_pid
     fi
 }
diff --git a/thermal/thermal_03.sh b/thermal/thermal_03.sh
index ff3ac12..cf53a1a 100755
--- a/thermal/thermal_03.sh
+++ b/thermal/thermal_03.sh
@@ -32,7 +32,7 @@
 cpu_pid=0
 
 heater_kill() {
-    if [ $cpu_pid != 0 ]; then
+    if [ $cpu_pid -ne 0 ]; then
 	kill -9 $cpu_pid
     fi
     kill_glmark2
diff --git a/thermal/thermal_04.sh b/thermal/thermal_04.sh
index 9275dcf..99a3430 100755
--- a/thermal/thermal_04.sh
+++ b/thermal/thermal_04.sh
@@ -31,7 +31,7 @@
 pid=0
 
 heater_kill() {
-    if [ $pid != 0 ]; then
+    if [ $pid -ne 0 ]; then
 	kill -9 $pid
     fi
 }
diff --git a/thermal/thermal_06.sh b/thermal/thermal_06.sh
index 2cb263f..92c987a 100755
--- a/thermal/thermal_06.sh
+++ b/thermal/thermal_06.sh
@@ -38,7 +38,7 @@
 cpu_pid=0
 
 heater_kill() {
-    if [ $cpu_pid != 0 ]; then
+    if [ $cpu_pid -ne 0 ]; then
 	kill -9 $cpu_pid
     fi
     kill_glmark2