summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaresh Kamboju <naresh.kamboju@linaro.org>2016-09-08 13:59:43 +0530
committerMilosz Wasilewski <milosz.wasilewski@linaro.org>2016-10-07 12:24:26 +0000
commit896f013eb09684c827032ba90a0e859cb4180e3c (patch)
treeb843b46891e10507bf25dcfa8ef275f85b3506f7
parentad19d88c2ff9210931b374ddafa89afd6885a1d6 (diff)
v2: linux: Adding device-tree test
Change-Id: Ibd60ca556a6bd577e23c8bd43de993602fe77e68 Signed-off-by: Naresh Kamboju <naresh.kamboju@linaro.org>
-rwxr-xr-xautomated/linux/device-tree/device-tree.sh63
-rw-r--r--automated/linux/device-tree/device-tree.yaml30
2 files changed, 93 insertions, 0 deletions
diff --git a/automated/linux/device-tree/device-tree.sh b/automated/linux/device-tree/device-tree.sh
new file mode 100755
index 0000000..41be06e
--- /dev/null
+++ b/automated/linux/device-tree/device-tree.sh
@@ -0,0 +1,63 @@
+#!/bin/bash
+#
+# Device Tree test cases
+#
+# Copyright (C) 2016, 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: Ricardo Salveti <rsalveti@linaro.org>
+# Maintainer: Naresh Kamboju <naresh.kamboju@linaro.org>
+
+. ../../lib/sh-test-lib
+
+OUTPUT="$(pwd)/output"
+RESULT_FILE="${OUTPUT}/result.txt"
+SYSFS_DEVICE_TREE="/sys/firmware/devicetree/base/"
+DEVICE_TREE="/proc/device-tree"
+MODEL="model"
+COMPATIBLE="compatible"
+DT_SKIP_LIST_1="device-tree-${MODEL} device-tree-${COMPATIBLE}"
+DT_SKIP_LIST_2="device_tree ${DT_SKIP_LIST_1}"
+
+# Check if /proc/device-tree is available
+device_tree() {
+ [ -d "${DEVICE_TREE}" ]
+ exit_on_fail "device-tree" "${DT_SKIP_LIST_1}"
+}
+
+# Check device tree property
+device_tree_property() {
+ [ "$#" -ne 1 ] && error_msg "Usage: device_tree_property test"
+ local test="$1"
+
+ DATA="$(cat "${DEVICE_TREE}/${test}")"
+ [ -n "${DATA}" ]
+ check_return "device-tree-"${test}""
+}
+
+# Test run.
+! check_root && error_msg "This script must be run as root"
+[ -d "${OUTPUT}" ] && mv "${OUTPUT}" "${OUTPUT}_$(date +%Y%m%d%H%M%S)"
+mkdir -p "${OUTPUT}"
+
+CONFIG_PROC_FS=$(zcat /proc/config.gz | grep CONFIG_PROC_FS)
+CONFIG_OF=$(zcat /proc/config.gz | grep "CONFIG_OF=")
+
+[ "${CONFIG_PROC_FS}" = "CONFIG_PROC_FS=y" ] && [ "${CONFIG_OF}" = "CONFIG_OF=y" ] && [ -d "${SYSFS_DEVICE_TREE}" ]
+exit_on_fail "device-tree-Kconfig" "${DT_SKIP_LIST_2}"
+device_tree
+device_tree_property "${MODEL}"
+device_tree_property "${COMPATIBLE}"
diff --git a/automated/linux/device-tree/device-tree.yaml b/automated/linux/device-tree/device-tree.yaml
new file mode 100644
index 0000000..7c0a8ee
--- /dev/null
+++ b/automated/linux/device-tree/device-tree.yaml
@@ -0,0 +1,30 @@
+metadata:
+ name: device-tree
+ format: "Lava-Test-Shell Test Definition 1.0"
+ description: "Device tree test to check the folder structure. The test verifies that device-tree
+ is available and contains model name of the board."
+ maintainer:
+ - milosz.wasilewski@linaro.org
+ - naresh.kamboju@linaro.org
+ os:
+ - debian
+ - ubuntu
+ - centos
+ - fedora
+ scope:
+ - functional
+ devices:
+ - panda
+ - panda-es
+ - arndale
+ - vexpress-tc2
+ - beaglebone-black
+ - juno
+ - hi6220-hikey
+ - apq8016-sbc
+
+run:
+ steps:
+ - cd automated/linux/device-tree
+ - ./device-tree.sh
+ - ../../utils/send-to-lava.sh ./output/result.txt