summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorMilosz Wasilewski <milosz.wasilewski@linaro.org>2014-10-31 14:58:39 +0000
committerMilosz Wasilewski <milosz.wasilewski@linaro.org>2014-11-20 14:15:00 +0000
commit50c45cddb7d30c865ca5573941ea46436037a2c9 (patch)
tree6ccc285c9adc4d09ce7af3b442df9f283343b135 /android
parent3d6d14b9f79a99813247725078e1dc03ec0c6369 (diff)
android: added boot time test case
The script uses dmesg and logcat to calculate time from begenning of boot till displaying home screen. Change-Id: I7ce98301da750b51b611dd48450855e56e14f257 Signed-off-by: Milosz Wasilewski <milosz.wasilewski@linaro.org>
Diffstat (limited to 'android')
-rw-r--r--android/boottime.yaml27
-rwxr-xr-xandroid/scripts/boot_time.sh57
2 files changed, 84 insertions, 0 deletions
diff --git a/android/boottime.yaml b/android/boottime.yaml
new file mode 100644
index 0000000..5da119b
--- /dev/null
+++ b/android/boottime.yaml
@@ -0,0 +1,27 @@
+metadata:
+ name: android-boottime
+ format: "Lava-Test-Shell Test Definition 1.0"
+ description: "Checks android boot time to UI
+ It relies on the dmesg and logcat information"
+ maintainer:
+ - milosz.wasilewski@linaro.org
+ - yongqin.liu@linaro.org
+ os:
+ - android
+ scope:
+ - functional
+ devices:
+ - juno
+
+run:
+ steps:
+ - "./android/scripts/boot_time.sh"
+ - "dmesg > dmesg.log"
+ - lava-test-run-attach dmesg.log text/plain
+ - "logcat -d *:V > logcat_all.log"
+ - lava-test-run-attach logcat_all.log text/plain
+ - "logcat -d -b events > logcat_events.log"
+ - lava-test-run-attach logcat_events.log text/plain
+
+parse:
+ pattern: "^TEST\\s(?P<test_case_id>\\w+):\\s(?P<result>\\w+)\\s(?P<measurement>\\-?\\d+\\.?\\d+?)\\s(?P<units>\\w+)"
diff --git a/android/scripts/boot_time.sh b/android/scripts/boot_time.sh
new file mode 100755
index 0000000..5e2fe37
--- /dev/null
+++ b/android/scripts/boot_time.sh
@@ -0,0 +1,57 @@
+#!/system/bin/sh
+#
+# Android boot time test.
+#
+# Copyright (C) 2014, Linaro Limited.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Author: Yongqin Liu <yongqin.liu@linaro.org>
+# Author: Milosz Wasilewski <milosz.wasilewski@linaro.org>
+#
+# Use the following information in logcat to record the android boot time
+# I/SurfaceFlinger( 683): Boot is finished (91104 ms)
+# Use dmesg to check the boot time from beginning of clock ticks
+# to the moment rootfs is mounted.
+# The test requires dc to be available in rootfs
+
+CONSOLE_SECONDS_START=`dmesg | awk '{print $2}' | awk '{FS="]"; print $1}' | grep -v "^0.0" | head -1`
+CONSOLE_SECONDS_END=`dmesg | grep "Freeing unused kernel memory" | tail -n 1 | tr -s " " | cut -d [ -f 2 | cut -d ] -f 1`
+echo "$CONSOLE_SECONDS_END $CONSOLE_SECONDS_START - p"
+CONSOLE_SECONDS=`echo "$CONSOLE_SECONDS_END $CONSOLE_SECONDS_START - p" | dc`
+
+echo "TEST KERNEL_BOOT_TIME: pass $CONSOLE_SECONDS s"
+
+TIME_INFO=$(logcat -d -s SurfaceFlinger:I|grep "Boot is finished")
+if [ -z "${TIME_INFO}" ]; then
+ echo "TEST ANDROID_BOOT_TIME: fail -1 ms"
+fi
+TIME_VALUE=$(echo "${TIME_INFO}"|cut -d\( -f2)
+TIME_VALUE=$(echo ${TIME_VALUE}|awk '{print $1}')
+echo "TEST ANDROID_BOOT_TIME: pass ${TIME_VALUE} ms"
+
+SERVICE_START_TIME_INFO=$(dmesg |grep "healthd:"|head -n1)
+SERVICE_START_TIME_END=$(echo "$SERVICE_START_TIME_INFO"|cut -d] -f 1|cut -d[ -f2| tr -d " ")
+if [ -z "${SERVICE_START_TIME_END}" ]; then
+ echo "TEST ANDROID_SERVICE_START_TIME: fail -1 s"
+else
+ SERVICE_START_TIME=`echo "$SERVICE_START_TIME_END $CONSOLE_SECONDS_START - p" | dc`
+ echo "TEST ANDROID_SERVICE_START_TIME: pass ${SERVICE_START_TIME} s"
+fi
+
+echo "$CONSOLE_SECONDS $TIME_VALUE 1000 / + p"
+TOTAL_SECONDS=`echo "$CONSOLE_SECONDS $TIME_VALUE 1000 / + p" | dc`
+echo "TEST TOTAL_BOOT_TIME: pass $TOTAL_SECONDS s"
+exit 0