Display all skipped test results in LAVA

Allow LAVA to record all the skipped test cases including
the ones that will not be executed due to failed
sanity checks. This enhancement will keep the number of PM-QA
results more consistent across multiple platforms.

Fix for Bug #386:
https://bugs.linaro.org/show_bug.cgi?id=386

Signed-off-by: Lisa Nguyen <lisa.nguyen@linaro.org>
diff --git a/Test.mk b/Test.mk
index df9cd62..66fe44b 100644
--- a/Test.mk
+++ b/Test.mk
@@ -49,8 +49,9 @@
 	@echo "###"
 	-@./$< 2> $@
 else
-run_tests: $(SNT)
-	@cat $(<:.sh=.txt)
+run_tests:
+	./$(SNT)
+#	@cat $(<:.sh=.txt)
 endif
 
 clean:
diff --git a/cpufreq/cpufreq_06.sh b/cpufreq/cpufreq_06.sh
index 65e824f..e2e708a 100755
--- a/cpufreq/cpufreq_06.sh
+++ b/cpufreq/cpufreq_06.sh
@@ -104,7 +104,7 @@
 supported=$(cat $CPU_PATH/cpu0/cpufreq/scaling_available_governors | grep "userspace")
 if [ -z "$supported" ]; then
     log_skip "userspace not supported"
-    exit 0
+    return 0
 fi
 
 save_governors
diff --git a/cpufreq/cpufreq_08.sh b/cpufreq/cpufreq_08.sh
index d9104f6..2250017 100755
--- a/cpufreq/cpufreq_08.sh
+++ b/cpufreq/cpufreq_08.sh
@@ -69,7 +69,7 @@
 supported=$(cat $CPU_PATH/cpu0/cpufreq/scaling_available_governors | grep "userspace")
 if [ -z "$supported" ]; then
     log_skip "userspace not supported"
-    exit 0
+    return 0
 fi
 
 trap "restore_governors; sigtrap" SIGHUP SIGINT SIGTERM
diff --git a/cpufreq/cpufreq_09.sh b/cpufreq/cpufreq_09.sh
index 7b65eec..62c953d 100755
--- a/cpufreq/cpufreq_09.sh
+++ b/cpufreq/cpufreq_09.sh
@@ -65,7 +65,7 @@
 supported=$(cat $CPU_PATH/cpu0/cpufreq/scaling_available_governors | grep "powersave")
 if [ -z "$supported" ]; then
     log_skip "powersave not supported"
-    exit 0
+    return 0
 fi
 
 trap "restore_governors; sigtrap" SIGHUP SIGINT SIGTERM
diff --git a/cpufreq/cpufreq_sanity.sh b/cpufreq/cpufreq_sanity.sh
index a5dda60..e3518b8 100755
--- a/cpufreq/cpufreq_sanity.sh
+++ b/cpufreq/cpufreq_sanity.sh
@@ -38,6 +38,7 @@
     test -d $dirpath
     if [ $? -ne 0 ]; then
         echo "cpufreq is not supported. Skipping all cpufreq tests"
+        skip_tests cpufreq
         return 0
     fi
     return 1
diff --git a/cpuhotplug/cpuhotplug_sanity.sh b/cpuhotplug/cpuhotplug_sanity.sh
index 2ad24ff..9a9df25 100755
--- a/cpuhotplug/cpuhotplug_sanity.sh
+++ b/cpuhotplug/cpuhotplug_sanity.sh
@@ -37,6 +37,7 @@
 
     if [ $cpunum -eq 1 ]; then
         echo "skip test, uniprocessor system"
+        skip_tests cpuhotplug
         return 0
     fi
 
@@ -46,6 +47,7 @@
             test -f $CPU_PATH/$cpu/online
             if [ $? -ne 0 ]; then
                 echo "cpuhotplug is not supported. Skipping all cpuhotplug tests"
+                skip_tests cpuhotplug
                 return 0
             fi
         fi
diff --git a/cpuidle/cpuidle_sanity.sh b/cpuidle/cpuidle_sanity.sh
index 99f05b3..65fe549 100755
--- a/cpuidle/cpuidle_sanity.sh
+++ b/cpuidle/cpuidle_sanity.sh
@@ -38,6 +38,7 @@
     test -d $dirpath
     if [ $? -ne 0 ]; then
         echo "cpuidle is not supported. Skipping all cpuidle tests"
+        skip_tests cpuidle
         return 0
     fi
     return 1
diff --git a/include/functions.sh b/include/functions.sh
index 3163456..ebe96ad 100644
--- a/include/functions.sh
+++ b/include/functions.sh
@@ -60,6 +60,17 @@
     echo " "
 }
 
+skip_tests() {
+    dir=$1
+
+    test_script_list=$(ls ../$1/*.sh | grep -v 'sanity.sh$' | grep -v '00.sh$')
+
+    for test_script in $test_script_list; do
+        test_case=$(basename $test_script .sh)
+        echo "$test_case: skip"
+    done
+}
+
 log_begin() {
     printf "%-76s" "$TEST_NAME.$INC$CPU: $@... "
     INC=$(($INC+1))
diff --git a/thermal/thermal_sanity.sh b/thermal/thermal_sanity.sh
index b995faf..c9149c0 100755
--- a/thermal/thermal_sanity.sh
+++ b/thermal/thermal_sanity.sh
@@ -37,6 +37,7 @@
     test -d $THERMAL_PATH
     if [ $? -ne 0 ]; then
         echo "thermal zone is not available. Skipping all tests"
+        skip_tests thermal
         return 0
     fi
     return 1