summaryrefslogtreecommitdiff
path: root/automated
diff options
context:
space:
mode:
authorChase Qi <chase.qi@linaro.org>2017-03-29 17:02:45 +0800
committerChase Qi <chase.qi@linaro.org>2017-03-29 17:02:45 +0800
commit9ad14134d69c00629290b96978704b0b0d6a4538 (patch)
tree348935d016f2ed19db35916ecbbfe8edf21549a1 /automated
parent398778587abb3419f561439e7d073cca50f3b1a1 (diff)
automated: android: add meminfo test
Change-Id: Ifaa744ea67ef3a4985f8afbbb2659c6ce5dcc3e9 Signed-off-by: Chase Qi <chase.qi@linaro.org>
Diffstat (limited to 'automated')
-rwxr-xr-xautomated/android/meminfo/meminfo.sh59
-rw-r--r--automated/android/meminfo/meminfo.yaml26
2 files changed, 85 insertions, 0 deletions
diff --git a/automated/android/meminfo/meminfo.sh b/automated/android/meminfo/meminfo.sh
new file mode 100755
index 0000000..1eac390
--- /dev/null
+++ b/automated/android/meminfo/meminfo.sh
@@ -0,0 +1,59 @@
+#!/bin/sh -e
+# shellcheck disable=SC1091
+
+OUTPUT="$(pwd)/output"
+RESULT_FILE="${OUTPUT}/result.txt"
+ANDROID_SERIAL=""
+BOOT_TIMEOUT="300"
+
+. ../../lib/sh-test-lib
+. ../../lib/android-test-lib
+
+parse_common_args "$@"
+initialize_adb
+wait_boot_completed "${BOOT_TIMEOUT}"
+create_out_dir "${OUTPUT}"
+
+info_msg "device-${ANDROID_SERIAL}: About to check meminfo..."
+adb shell 'cat /proc/meminfo 2>&1' | tee "${OUTPUT}/proc-meminfo"
+adb shell 'dumpsys meminfo 2>&1' | tee "${OUTPUT}/dumpsys-meminfo"
+
+## Parse proc-meminfo
+info_msg "Parsing results from proc-meminfo"
+logfile="${OUTPUT}/proc-meminfo"
+# Capacity info.
+grep -E ".+: +[0-9]+ kB" "${logfile}" \
+ | sed 's/://g' \
+ | awk '{printf("%s pass %s kb\n", $1, $2)}' \
+ | tee -a "${RESULT_FILE}"
+
+# HugePages info.
+grep "HugePages_" "${logfile}" \
+ | sed 's/://g' \
+ | awk '{printf("%s pass %s\n", $1, $2)}' \
+ | tee -a "${RESULT_FILE}"
+
+## Parse dumpsys-meminfo
+# Total, Free, Used and Lost RAM.
+info_msg "Parsing results from dumpsys-meminfo"
+logfile="${OUTPUT}/dumpsys-meminfo"
+grep -E "RAM: .+K" "${logfile}" \
+ | sed 's/://g' \
+ | awk '{printf("%s-%s pass %s K\n", $1, $2, substr($3, 1, length($3)-1))}' \
+ | tee -a "${RESULT_FILE}"
+
+# Detailed info on free RAM.
+line=$(grep "Free RAM:" "${logfile}")
+measurement=$(echo "${line}" | awk '{print substr($5, 1, length($5)-1)}')
+add_metric "Free-RAM-cached-pss" "pass" "${measurement}" "K"
+measurement=$(echo "${line}" | awk '{print substr($9, 1, length($9)-1)}')
+add_metric "Free-RAM-cached-kernel" "pass" "${measurement}" "K"
+measurement=$(echo "${line}" | awk '{print substr($13, 1, length($13)-1)}')
+add_metric "Free-RAM-free" "pass" "${measurement}" "K"
+
+# Detailed info on Used RAM.
+line=$(grep "Used RAM:" "${logfile}")
+measurement=$(echo "${line}" | awk '{print substr($5, 1, length($5)-1)}')
+add_metric "Used-RAM-used-pss" "pass" "${measurement}" "K"
+measurement=$(echo "${line}" | awk '{print substr($9, 1, length($9)-1)}')
+add_metric "Used-RAM-kernel" "pass" "${measurement}" "K"
diff --git a/automated/android/meminfo/meminfo.yaml b/automated/android/meminfo/meminfo.yaml
new file mode 100644
index 0000000..69fd484
--- /dev/null
+++ b/automated/android/meminfo/meminfo.yaml
@@ -0,0 +1,26 @@
+metadata:
+ name: meminfo
+ format: "Lava-Test-Shell Test Definition 1.0"
+ description: "Collect the information in /proc/meminfo after boot."
+ maintainer:
+ - yongqin.liu@linaro.org
+ - chase.qi@linaro.org
+ os:
+ - android
+ scope:
+ - functional
+ devices:
+ - juno
+ - hi6220-hikey
+
+params:
+ # Specify device serial no. when more than one device connected.
+ ANDROID_SERIAL: ""
+ # Specify timeout in seconds for wait_boot_completed.
+ BOOT_TIMEOUT: "300"
+
+run:
+ steps:
+ - cd ./automated/android/meminfo
+ - ./meminfo.sh -s "${ANDROID_SERIAL}" -t "${BOOT_TIMEOUT}"
+ - ../../utils/send-to-lava.sh ./output/result.txt