summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorMilosz Wasilewski <milosz.wasilewski@linaro.org>2013-11-26 12:07:17 +0000
committerLinaro Code Review <review@review.linaro.org>2013-11-26 12:07:17 +0000
commit726aa08a90a219ae9a3102b673ec4cd061a66b41 (patch)
tree60a23a0f837763344074a379052523f2dfc30f00 /android
parent61cb1a85897d254cd5801d92f2e374a78743efda (diff)
parent5eea59cdc19e6e04f95a2be0bedbdd175b081299 (diff)
Merge "Add Device Tree test for Linaro Android."
Diffstat (limited to 'android')
-rw-r--r--android/devicetree-android.yaml30
-rwxr-xr-xandroid/scripts/devicetree-android.sh95
2 files changed, 125 insertions, 0 deletions
diff --git a/android/devicetree-android.yaml b/android/devicetree-android.yaml
new file mode 100644
index 0000000..b037a3a
--- /dev/null
+++ b/android/devicetree-android.yaml
@@ -0,0 +1,30 @@
+metadata:
+ name: device-tree
+ format: "Lava-Test-Shell Test Definition 1.0"
+ description: "Test Device Tree on Linaro Android"
+ os:
+ - android
+ devices:
+ - panda
+ - panda-es
+ - vexpress-a9
+ - vexpress-tc2
+ - highbank
+ - rtsm_foundation-armv8
+ - rtsm_fvp_base-aemv8a
+ - arndale
+ - aa9
+ scope:
+ - functional
+ environment:
+ - lava-test-shell
+
+run:
+ steps:
+ - "./android/scripts/devicetree-android.sh"
+
+parse:
+ pattern: "(?P<test_case_id>[a-zA-Z0-9_-]+):\\s(?P<result>\\w+)"
+ fixupdict:
+ FAIL: fail
+ PASS: pass
diff --git a/android/scripts/devicetree-android.sh b/android/scripts/devicetree-android.sh
new file mode 100755
index 0000000..7822f45
--- /dev/null
+++ b/android/scripts/devicetree-android.sh
@@ -0,0 +1,95 @@
+#!/system/bin/sh
+#
+# Device Tree test cases for Linaro Android
+#
+# Copyright (C) 2013, 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: Botao Sun <botao.sun@linaro.org>
+
+function check_return_fail() {
+ if [ $? -ne 0 ]; then
+ fail_test "$1"
+ return 0
+ else
+ return 1
+ fi
+}
+
+function fail_test() {
+ local reason=$1
+ echo "${TEST}: FAIL - ${reason}"
+}
+
+function pass_test() {
+ echo "${TEST}: PASS"
+}
+
+function check_root() {
+ if [ `whoami` == "root" ]; then
+ return 0
+ else
+ return 1
+ fi
+}
+
+## Test case definitions
+
+# Check if /proc/device-tree is available
+test_has_proc_device_tree() {
+ TEST="has_proc_device_tree"
+
+ if [ ! -d /proc/device-tree ]; then
+ fail_test "Unable to find /proc/device-tree"
+ return 1
+ fi
+
+ find /proc/device-tree
+
+ pass_test
+}
+
+# Check if model is not empty
+test_device_tree_model_not_empty() {
+ TEST="device_tree_model_not_empty"
+
+ if [ ! -f /proc/device-tree/model ]; then
+ fail_test "Unable to find /proc/device-tree/model"
+ return 1
+ fi
+
+ model=`cat /proc/device-tree/model`
+ if [ -z "$model" ]; then
+ fail_test "Empty model description at /proc/device-tree/model"
+ return 1
+ fi
+
+ echo "MODEL: $model" 1>&2
+
+ pass_test
+}
+
+# check we're root
+if ! check_root; then
+ error_msg "Please run the test case as root"
+fi
+
+# run the tests
+test_has_proc_device_tree
+test_device_tree_model_not_empty
+
+# clean exit so lava-test can trust the results
+exit 0