diff mbox

[pmqa] pm-qa: show proper result status for tests

Message ID 1365515437-3050-1-git-send-email-sanjay.rawat@linaro.org
State New
Headers show

Commit Message

Sanjay Singh Rawat April 9, 2013, 1:50 p.m. UTC
Change the result message for each subtest. Report total pass and fail count
for subtests.

O/P logs:
cpufreq_06.5/cpu3: checking deviation for frequency 2.0 GHz...              Ok
cpufreq_06.6/cpu3: checking deviation for frequency 1.8 GHz...              Ok
cpufreq_06.7/cpu3: checking deviation for frequency 1.6 GHz...              Ok
cpufreq_06.8/cpu3: checking deviation for frequency 1.4 GHz...              Ok
cpufreq_06.9/cpu3: checking deviation for frequency 1.2 GHz...              Ok
cpufreq_06.10/cpu3: checking deviation for frequency 1000.0 MHz...          Err
cpufreq_06.11/cpu3: checking deviation for frequency 800.0 MHz...           Err
-------- total = 48
-------- pass = 36
-------- fail = 12

Signed-off-by: Sanjay Singh Rawat <sanjay.rawat@linaro.org>
---
 cpufreq/cpufreq_01.sh        |    1 +
 cpufreq/cpufreq_02.sh        |    1 +
 cpufreq/cpufreq_03.sh        |    1 +
 cpufreq/cpufreq_04.sh        |    1 +
 cpufreq/cpufreq_05.sh        |    1 +
 cpufreq/cpufreq_06.sh        |    1 +
 cpufreq/cpufreq_07.sh        |    1 +
 cpufreq/cpufreq_08.sh        |    1 +
 cpufreq/cpufreq_09.sh        |    1 +
 cpuhotplug/1_sanity_check.sh |    1 +
 cpuhotplug/cpuhotplug_01.sh  |    1 +
 cpuhotplug/cpuhotplug_02.sh  |    1 +
 cpuhotplug/cpuhotplug_03.sh  |    3 ++-
 cpuhotplug/cpuhotplug_04.sh  |    1 +
 cpuhotplug/cpuhotplug_05.sh  |    1 +
 cpuhotplug/cpuhotplug_06.sh  |    1 +
 cpuhotplug/cpuhotplug_07.sh  |    1 +
 cpuhotplug/cpuhotplug_08.sh  |    1 +
 cpuhotplug/z_sanity_check.sh |    1 +
 cpuidle/cpuidle_01.sh        |    1 +
 cpuidle/cpuidle_02.sh        |    1 +
 cpuidle/cpuidle_03.sh        |    1 +
 cpuidle/cpuidle_sanity.sh    |    1 +
 include/functions.sh         |   17 +++++++++++++++--
 powertop/powertop_01.sh      |    1 +
 powertop/powertop_sanity.sh  |    1 +
 suspend/suspend_01.sh        |    1 +
 suspend/suspend_02.sh        |    1 +
 suspend/suspend_03.sh        |    1 +
 suspend/suspend_04.sh        |    1 +
 suspend/suspend_05.sh        |    1 +
 thermal/thermal_01.sh        |    1 +
 thermal/thermal_02.sh        |    1 +
 thermal/thermal_03.sh        |    1 +
 thermal/thermal_04.sh        |    1 +
 thermal/thermal_05.sh        |    1 +
 thermal/thermal_06.sh        |    1 +
 thermal/thermal_sanity.sh    |    1 +
 38 files changed, 53 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/cpufreq/cpufreq_01.sh b/cpufreq/cpufreq_01.sh
index f4fc178..dd93c29 100755
--- a/cpufreq/cpufreq_01.sh
+++ b/cpufreq/cpufreq_01.sh
@@ -30,3 +30,4 @@  source ../include/functions.sh
 FILES="scaling_available_frequencies scaling_cur_freq scaling_setspeed"
 
 for_each_cpu check_cpufreq_files $FILES
+test_status_show
diff --git a/cpufreq/cpufreq_02.sh b/cpufreq/cpufreq_02.sh
index aeecd45..1ec725f 100755
--- a/cpufreq/cpufreq_02.sh
+++ b/cpufreq/cpufreq_02.sh
@@ -30,3 +30,4 @@  source ../include/functions.sh
 FILES="scaling_available_governors scaling_governor"
 
 for_each_cpu check_cpufreq_files $FILES
+test_status_show
diff --git a/cpufreq/cpufreq_03.sh b/cpufreq/cpufreq_03.sh
index 65aed52..ae32fee 100755
--- a/cpufreq/cpufreq_03.sh
+++ b/cpufreq/cpufreq_03.sh
@@ -49,3 +49,4 @@  if [ $(id -u) != 0 ]; then
 fi
 
 for_each_cpu for_each_governor check_governor || exit 1
+test_status_show
diff --git a/cpufreq/cpufreq_04.sh b/cpufreq/cpufreq_04.sh
index f044164..3edf83f 100755
--- a/cpufreq/cpufreq_04.sh
+++ b/cpufreq/cpufreq_04.sh
@@ -57,3 +57,4 @@  if [ -z "$supported" ]; then
 else
     for_each_cpu for_each_frequency check_frequency || exit 1
 fi
+test_status_show
diff --git a/cpufreq/cpufreq_05.sh b/cpufreq/cpufreq_05.sh
index f4cc997..a0b82f4 100755
--- a/cpufreq/cpufreq_05.sh
+++ b/cpufreq/cpufreq_05.sh
@@ -98,3 +98,4 @@  if [ $nrcpus > 1 ]; then
 fi
 
 restore_governors
+test_status_show
diff --git a/cpufreq/cpufreq_06.sh b/cpufreq/cpufreq_06.sh
index cb45e4b..08f7a6d 100755
--- a/cpufreq/cpufreq_06.sh
+++ b/cpufreq/cpufreq_06.sh
@@ -121,3 +121,4 @@  for_each_cpu check_deviation
 
 restore_frequencies
 restore_governors
+test_status_show
diff --git a/cpufreq/cpufreq_07.sh b/cpufreq/cpufreq_07.sh
index 354ed46..516e0a7 100755
--- a/cpufreq/cpufreq_07.sh
+++ b/cpufreq/cpufreq_07.sh
@@ -95,3 +95,4 @@  trap "restore_governors; sigtrap" SIGHUP SIGINT SIGTERM
 for_each_cpu check_ondemand
 
 restore_governors
+test_status_show
diff --git a/cpufreq/cpufreq_08.sh b/cpufreq/cpufreq_08.sh
index 328b4f5..d78c191 100755
--- a/cpufreq/cpufreq_08.sh
+++ b/cpufreq/cpufreq_08.sh
@@ -82,3 +82,4 @@  trap "restore_governors; sigtrap" SIGHUP SIGINT SIGTERM
 for_each_cpu check_userspace
 
 restore_governors
+test_status_show
diff --git a/cpufreq/cpufreq_09.sh b/cpufreq/cpufreq_09.sh
index c1d1a7b..3ffccec 100755
--- a/cpufreq/cpufreq_09.sh
+++ b/cpufreq/cpufreq_09.sh
@@ -78,3 +78,4 @@  trap "restore_governors; sigtrap" SIGHUP SIGINT SIGTERM
 for_each_cpu check_powersave
 
 restore_governors
+test_status_show
diff --git a/cpuhotplug/1_sanity_check.sh b/cpuhotplug/1_sanity_check.sh
index 50ebbcc..e091879 100755
--- a/cpuhotplug/1_sanity_check.sh
+++ b/cpuhotplug/1_sanity_check.sh
@@ -37,3 +37,4 @@  sanity_check() {
 }
 
 check "all cpu are online" "sanity_check"
+test_status_show
diff --git a/cpuhotplug/cpuhotplug_01.sh b/cpuhotplug/cpuhotplug_01.sh
index 83fc17a..a1dfe93 100755
--- a/cpuhotplug/cpuhotplug_01.sh
+++ b/cpuhotplug/cpuhotplug_01.sh
@@ -34,3 +34,4 @@  for i in $FILES; do
 done
 
 for_each_cpu check_cpuhotplug_files online
+test_status_show
diff --git a/cpuhotplug/cpuhotplug_02.sh b/cpuhotplug/cpuhotplug_02.sh
index 4273f65..2c582cf 100755
--- a/cpuhotplug/cpuhotplug_02.sh
+++ b/cpuhotplug/cpuhotplug_02.sh
@@ -58,3 +58,4 @@  check_state() {
 }
 
 for_each_cpu check_state
+test_status_show
diff --git a/cpuhotplug/cpuhotplug_03.sh b/cpuhotplug/cpuhotplug_03.sh
index 51cde18..d4816ca 100755
--- a/cpuhotplug/cpuhotplug_03.sh
+++ b/cpuhotplug/cpuhotplug_03.sh
@@ -48,4 +48,5 @@  check_affinity_fails() {
     return 0
 }
 
-for_each_cpu check_affinity_fails
\ No newline at end of file
+for_each_cpu check_affinity_fails
+test_status_show
diff --git a/cpuhotplug/cpuhotplug_04.sh b/cpuhotplug/cpuhotplug_04.sh
index 753cf55..67098e1 100755
--- a/cpuhotplug/cpuhotplug_04.sh
+++ b/cpuhotplug/cpuhotplug_04.sh
@@ -69,3 +69,4 @@  check_task_migrate() {
 }
 
 for_each_cpu check_task_migrate
+test_status_show
diff --git a/cpuhotplug/cpuhotplug_05.sh b/cpuhotplug/cpuhotplug_05.sh
index 12df3c4..98371d4 100755
--- a/cpuhotplug/cpuhotplug_05.sh
+++ b/cpuhotplug/cpuhotplug_05.sh
@@ -47,3 +47,4 @@  check_procinfo() {
 }
 
 for_each_cpu check_procinfo
+test_status_show
diff --git a/cpuhotplug/cpuhotplug_06.sh b/cpuhotplug/cpuhotplug_06.sh
index ce4ffeb..1f2641d 100755
--- a/cpuhotplug/cpuhotplug_06.sh
+++ b/cpuhotplug/cpuhotplug_06.sh
@@ -47,3 +47,4 @@  check_procinfo() {
 }
 
 for_each_cpu check_procinfo
+test_status_show
diff --git a/cpuhotplug/cpuhotplug_07.sh b/cpuhotplug/cpuhotplug_07.sh
index 72d9744..6486dd7 100755
--- a/cpuhotplug/cpuhotplug_07.sh
+++ b/cpuhotplug/cpuhotplug_07.sh
@@ -64,3 +64,4 @@  check_notification() {
 }
 
 for_each_cpu check_notification
+test_status_show
diff --git a/cpuhotplug/cpuhotplug_08.sh b/cpuhotplug/cpuhotplug_08.sh
index e996f11..d413595 100755
--- a/cpuhotplug/cpuhotplug_08.sh
+++ b/cpuhotplug/cpuhotplug_08.sh
@@ -47,3 +47,4 @@  random_stress() {
 }
 
 for i in $(seq 1 50); do random_stress || break; done
+test_status_show
diff --git a/cpuhotplug/z_sanity_check.sh b/cpuhotplug/z_sanity_check.sh
index 43051ac..c39413e 100755
--- a/cpuhotplug/z_sanity_check.sh
+++ b/cpuhotplug/z_sanity_check.sh
@@ -37,3 +37,4 @@  sanity_check() {
 }
 
 check "all cpu are back online" "sanity_check"
+test_status_show
diff --git a/cpuidle/cpuidle_01.sh b/cpuidle/cpuidle_01.sh
index 8fe2f5d..ec7b911 100755
--- a/cpuidle/cpuidle_01.sh
+++ b/cpuidle/cpuidle_01.sh
@@ -58,3 +58,4 @@  check_cpuidle_files() {
 check_cpuidle_files
 
 for_each_cpu check_cpuidle_state_files
+test_status_show
diff --git a/cpuidle/cpuidle_02.sh b/cpuidle/cpuidle_02.sh
index 1b155c1..491107b 100755
--- a/cpuidle/cpuidle_02.sh
+++ b/cpuidle/cpuidle_02.sh
@@ -35,3 +35,4 @@  if [ $(id -u) != 0 ]; then
 fi
 
 check "cpuidle program runs successfully (120 secs)" "./$CPUIDLE_KILLER"
+test_status_show
diff --git a/cpuidle/cpuidle_03.sh b/cpuidle/cpuidle_03.sh
index 22bca10..25cca1b 100755
--- a/cpuidle/cpuidle_03.sh
+++ b/cpuidle/cpuidle_03.sh
@@ -58,3 +58,4 @@  trap "restore_cpus; sigtrap" SIGHUP SIGINT SIGTERM
 
 for_each_cpu check_cpuidle_kill
 restore_cpus
+test_status_show
diff --git a/cpuidle/cpuidle_sanity.sh b/cpuidle/cpuidle_sanity.sh
index a8336fa..568c129 100755
--- a/cpuidle/cpuidle_sanity.sh
+++ b/cpuidle/cpuidle_sanity.sh
@@ -33,3 +33,4 @@  check_cpuidle_sysfs_entry() {
 }
 
 check_cpuidle_sysfs_entry
+test_status_show
diff --git a/include/functions.sh b/include/functions.sh
index 7ee809b..fa9a370 100644
--- a/include/functions.sh
+++ b/include/functions.sh
@@ -30,6 +30,17 @@  TEST_NAME=$(basename ${0%.sh})
 PREFIX=$TEST_NAME
 INC=0
 CPU=
+pass_count=0
+fail_count=0
+
+test_status_show() {
+    echo "-------- total = $(($pass_count + $fail_count))"
+    echo "-------- pass = $pass_count"
+    # report failure only if it is there
+    if [ $fail_count -ne 0 ] ; then
+      echo "-------- fail = $fail_count"
+    fi
+}
 
 log_begin() {
     printf "%-76s" "$TEST_NAME.$INC$CPU: $@... "
@@ -216,11 +227,13 @@  check() {
 
     $func $@
     if [ $? != 0 ]; then
-	log_end "fail"
+	log_end "Err"
+	fail_count=$(($fail_count + 1))
 	return 1
     fi
 
-    log_end "pass"
+    log_end "Ok"
+    pass_count=$(($pass_count + 1))
 
     return 0
 }
diff --git a/powertop/powertop_01.sh b/powertop/powertop_01.sh
index cf243f1..c66b725 100755
--- a/powertop/powertop_01.sh
+++ b/powertop/powertop_01.sh
@@ -56,3 +56,4 @@  run_powertop() {
 }
 
 run_powertop
+test_status_show
diff --git a/powertop/powertop_sanity.sh b/powertop/powertop_sanity.sh
index 3ae3065..060f85c 100755
--- a/powertop/powertop_sanity.sh
+++ b/powertop/powertop_sanity.sh
@@ -33,3 +33,4 @@  check_powertop() {
 }
 
 check_powertop
+test_status_show
diff --git a/suspend/suspend_01.sh b/suspend/suspend_01.sh
index e591dc9..6f36302 100755
--- a/suspend/suspend_01.sh
+++ b/suspend/suspend_01.sh
@@ -45,4 +45,5 @@  else
 fi
 
 restore_trace
+test_status_show
 rm -f "$LOGFILE"
diff --git a/suspend/suspend_02.sh b/suspend/suspend_02.sh
index 5e41d08..ceb6398 100755
--- a/suspend/suspend_02.sh
+++ b/suspend/suspend_02.sh
@@ -45,5 +45,6 @@  else
 fi
 
 restore_trace
+test_status_show
 rm -f "$LOGFILE"
 
diff --git a/suspend/suspend_03.sh b/suspend/suspend_03.sh
index b71966c..de81627 100755
--- a/suspend/suspend_03.sh
+++ b/suspend/suspend_03.sh
@@ -46,4 +46,5 @@  else
 fi
 
 restore_trace
+test_status_show
 rm -f "$LOGFILE"
diff --git a/suspend/suspend_04.sh b/suspend/suspend_04.sh
index 8947afd..0eb70dd 100755
--- a/suspend/suspend_04.sh
+++ b/suspend/suspend_04.sh
@@ -70,4 +70,5 @@  else
 fi
 
 restore_trace
+test_status_show
 rm -f "$LOGFILE"
diff --git a/suspend/suspend_05.sh b/suspend/suspend_05.sh
index a87490c..55396e5 100755
--- a/suspend/suspend_05.sh
+++ b/suspend/suspend_05.sh
@@ -90,4 +90,5 @@  else
 fi
 
 restore_trace
+test_status_show
 rm -f "$LOGFILE"
diff --git a/thermal/thermal_01.sh b/thermal/thermal_01.sh
index 390fbde..5a74296 100755
--- a/thermal/thermal_01.sh
+++ b/thermal/thermal_01.sh
@@ -83,3 +83,4 @@  for_each_thermal_zone check_thermal_zone_mode
 check_thermal_zone_trip_level
 
 check_thermal_zone_bindings
+test_status_show
diff --git a/thermal/thermal_02.sh b/thermal/thermal_02.sh
index d2cb32e..a78618c 100755
--- a/thermal/thermal_02.sh
+++ b/thermal/thermal_02.sh
@@ -63,3 +63,4 @@  check_cooling_device_states() {
 for_each_cooling_device check_cooling_device_attributes
 
 for_each_cooling_device check_cooling_device_states
+test_status_show
diff --git a/thermal/thermal_03.sh b/thermal/thermal_03.sh
index f2cfb81..92e9569 100755
--- a/thermal/thermal_03.sh
+++ b/thermal/thermal_03.sh
@@ -61,3 +61,4 @@  check_temperature_change() {
 trap "heater_kill; sigtrap" SIGHUP SIGINT SIGTERM
 
 for_each_thermal_zone check_temperature_change
+test_status_show
diff --git a/thermal/thermal_04.sh b/thermal/thermal_04.sh
index 7fe53e2..58aac43 100755
--- a/thermal/thermal_04.sh
+++ b/thermal/thermal_04.sh
@@ -81,3 +81,4 @@  verify_cooling_device_temp_change() {
 trap "heater_kill; sigtrap" SIGHUP SIGINT SIGTERM
 
 for_each_cooling_device verify_cooling_device_temp_change
+test_status_show
diff --git a/thermal/thermal_05.sh b/thermal/thermal_05.sh
index e7e2710..3dcaa8d 100755
--- a/thermal/thermal_05.sh
+++ b/thermal/thermal_05.sh
@@ -72,3 +72,4 @@  verify_cpufreq_cooling_device_action() {
     echo $prev_state_val > $dirpath/cur_state
 }
 for_each_cooling_device verify_cpufreq_cooling_device_action
+test_status_show
diff --git a/thermal/thermal_06.sh b/thermal/thermal_06.sh
index b0a9442..e170028 100755
--- a/thermal/thermal_06.sh
+++ b/thermal/thermal_06.sh
@@ -103,3 +103,4 @@  check_trip_point_change() {
 trap "heater_kill; sigtrap" SIGHUP SIGINT SIGTERM
 
 for_each_thermal_zone check_trip_point_change
+test_status_show
diff --git a/thermal/thermal_sanity.sh b/thermal/thermal_sanity.sh
index 7d4ca6c..37e4c88 100755
--- a/thermal/thermal_sanity.sh
+++ b/thermal/thermal_sanity.sh
@@ -31,3 +31,4 @@  check_thermal_zone() {
 }
 
 check_thermal_zone
+test_status_show