summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChase Qi <chase.qi@linaro.org>2017-03-21 13:17:18 +0800
committerMilosz Wasilewski <milosz.wasilewski@linaro.org>2017-03-21 11:42:17 +0000
commitf9fbcba7a2baaf8eaa2758838134261a2f3770f0 (patch)
tree7aecee84f57de1ba021dc746cf421fd5d8ad1f72
parent6255e54db02fe7f82726a189d4295885d41e9d73 (diff)
automated: android: add busybox smoke test
Change-Id: I4ea462ff2e643d9016c9f2a25d85e14a6deb6fe7 Signed-off-by: Chase Qi <chase.qi@linaro.org>
-rwxr-xr-xautomated/android/busybox/busybox.sh20
-rw-r--r--automated/android/busybox/busybox.yaml20
-rwxr-xr-xautomated/android/busybox/device-script.sh56
3 files changed, 96 insertions, 0 deletions
diff --git a/automated/android/busybox/busybox.sh b/automated/android/busybox/busybox.sh
new file mode 100755
index 0000000..30141da
--- /dev/null
+++ b/automated/android/busybox/busybox.sh
@@ -0,0 +1,20 @@
+#!/bin/sh -e
+# Busybox smoke tests.
+
+OUTPUT="$(pwd)/output"
+
+# shellcheck disable=SC1091
+. ../../lib/sh-test-lib
+# shellcheck disable=SC1091
+. ../../lib/android-test-lib
+
+initialize_adb
+wait_boot_completed "300"
+create_out_dir "${OUTPUT}"
+
+adb_push "./device-script.sh" "/data/local/tmp/bin/"
+
+adb -s "${SN}" shell '/data/local/tmp/bin/device-script.sh 2>&1' \
+ | tee "${OUTPUT}/device-stdout.log"
+
+adb_pull "/data/local/tmp/busybox/result.txt" "${OUTPUT}/"
diff --git a/automated/android/busybox/busybox.yaml b/automated/android/busybox/busybox.yaml
new file mode 100644
index 0000000..21f9a6a
--- /dev/null
+++ b/automated/android/busybox/busybox.yaml
@@ -0,0 +1,20 @@
+metadata:
+ format: Lava-Test Test Definition 1.0
+ name: busybox
+ description: "Busybox smoke tests."
+ maintainer:
+ - chase.qi@linaro.org
+ os:
+ - android
+ scope:
+ - functional
+ devices:
+ - hi6220-hikey
+ - apq8016-sbc
+ - juno
+
+run:
+ steps:
+ - cd ./automated/android/busybox/
+ - ./busybox.sh
+ - ../../utils/send-to-lava.sh ./output/result.txt
diff --git a/automated/android/busybox/device-script.sh b/automated/android/busybox/device-script.sh
new file mode 100755
index 0000000..2130d85
--- /dev/null
+++ b/automated/android/busybox/device-script.sh
@@ -0,0 +1,56 @@
+#!/system/bin/sh
+# Busybox smoke tests.
+
+OUTPUT="/data/local/tmp/busybox/"
+RESULT_FILE="${OUTPUT}/result.txt"
+export RESULT_FILE
+
+rm -rf "${OUTPUT}"
+mkdir -p "${OUTPUT}"
+cd "${OUTPUT}" || exit
+
+check_return() {
+ exit_code="$?"
+ test_case="$1"
+ if [ "${exit_code}" -ne 0 ]; then
+ echo "${test_case} fail" | tee -a "${RESULT_FILE}"
+ else
+ echo "${test_case} pass" | tee -a "${RESULT_FILE}"
+ fi
+}
+
+if ! which busybox; then
+ echo "busybox-existence-check fail" | tee -a "${RESULT_FILE}"
+ exit 0
+fi
+
+busybox mkdir dir
+check_return "mkdir"
+
+busybox touch dir/file.txt
+check_return "touch"
+
+busybox ls dir/file.txt
+check_return "ls"
+
+busybox cp dir/file.txt dir/file.txt.bak
+check_return "cp"
+
+busybox rm dir/file.txt.bak
+check_return "rm"
+
+busybox echo 'busybox test' > dir/file.txt
+check_return "echo"
+
+busybox cat dir/file.txt
+check_return "cat"
+
+busybox grep 'busybox' dir/file.txt
+check_return "grep"
+
+# shellcheck disable=SC2016
+busybox awk '{printf("%s: awk\n", $0)}' dir/file.txt
+check_return "awk"
+
+busybox free
+check_return "free"