summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-09-13 17:16:45 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-09-14 17:28:04 +0200
commit5d87035f9a5e48041e1f63b6cfc09d2ba85ee84b (patch)
tree55b26c1dc7fa90b23b593d69d2b76d8e6b7fb17d
parenta8bf787b4232beef67a3643d858166f776bb829d (diff)
This add basic hardware tests for Renesas R-Car Gen3 boards as well as a script detecting hardware at firstboot. Change-Id: I8e5ac92e5761bd4eeafae3b7ae5adde431d28931 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-rw-r--r--meta-agl-bsp/recipes-bsp/platform-test/files/platform-test.tar.gzbin0 -> 2946 bytes
-rw-r--r--meta-agl-bsp/recipes-bsp/platform-test/files/platform-test/Makefile.kingfisher m3ulcb41
-rw-r--r--meta-agl-bsp/recipes-bsp/platform-test/files/platform-test/Makefile.m3ulcb19
-rwxr-xr-xmeta-agl-bsp/recipes-bsp/platform-test/files/platform-test/detect-board.sh80
-rw-r--r--meta-agl-bsp/recipes-bsp/platform-test/files/platform-test/tests/common.sh19
-rwxr-xr-xmeta-agl-bsp/recipes-bsp/platform-test/files/platform-test/tests/test-BT_HCI10
-rwxr-xr-xmeta-agl-bsp/recipes-bsp/platform-test/files/platform-test/tests/test-CAN12
-rwxr-xr-xmeta-agl-bsp/recipes-bsp/platform-test/files/platform-test/tests/test-Ethernet12
-rwxr-xr-xmeta-agl-bsp/recipes-bsp/platform-test/files/platform-test/tests/test-GPS41
-rwxr-xr-xmeta-agl-bsp/recipes-bsp/platform-test/files/platform-test/tests/test-HDMI17
-rwxr-xr-xmeta-agl-bsp/recipes-bsp/platform-test/files/platform-test/tests/test-IIO16
-rwxr-xr-xmeta-agl-bsp/recipes-bsp/platform-test/files/platform-test/tests/test-Radio15
-rwxr-xr-xmeta-agl-bsp/recipes-bsp/platform-test/files/platform-test/tests/test-USB17
-rwxr-xr-xmeta-agl-bsp/recipes-bsp/platform-test/files/platform-test/tests/test-Wifi43
-rwxr-xr-xmeta-agl-bsp/recipes-bsp/platform-test/files/run-ptest5
-rw-r--r--meta-agl-bsp/recipes-bsp/platform-test/platform-test_%.bb39
-rw-r--r--meta-agl-profile-core/recipes-platform/packagegroups/packagegroup-agl-core-boot.bb1
17 files changed, 387 insertions, 0 deletions
diff --git a/meta-agl-bsp/recipes-bsp/platform-test/files/platform-test.tar.gz b/meta-agl-bsp/recipes-bsp/platform-test/files/platform-test.tar.gz
new file mode 100644
index 0000000..edb25a5
--- /dev/null
+++ b/meta-agl-bsp/recipes-bsp/platform-test/files/platform-test.tar.gz
Binary files differ
diff --git a/meta-agl-bsp/recipes-bsp/platform-test/files/platform-test/Makefile.kingfisher m3ulcb b/meta-agl-bsp/recipes-bsp/platform-test/files/platform-test/Makefile.kingfisher m3ulcb
new file mode 100644
index 0000000..6975586
--- /dev/null
+++ b/meta-agl-bsp/recipes-bsp/platform-test/files/platform-test/Makefile.kingfisher m3ulcb
@@ -0,0 +1,41 @@
+#!/usr/bin/make
+
+ETHERNET_DEV=eth0
+WIFI_CONNMANCTL_TECHNOLOGY=wifi
+CAN_DEV=can0 can1
+GPS_DEV=/dev/ttySC2
+HDMI_DEV=HDMI-A-1 HDMI-A-2 HDMI-LVDS-1
+IIO_DEV=/sys/bus/iio/devices/iio:device0/*_raw
+USB_BUS_NB=2
+
+test-all: test
+
+test: test-bt_hci test-can test-ethernet test-gps test-hdmi test-iio test-radio test-usb test-wifi
+
+test-bt_hci: tests/test-BT_HCI
+ tests/test-BT_HCI
+
+test-can: tests/test-CAN
+ tests/test-CAN $(CAN_DEV)
+
+test-ethernet: tests/test-Ethernet
+ tests/test-Ethernet $(ETHERNET_DEV)
+
+test-gps: tests/test-GPS
+ tests/test-GPS $(GPS_DEV)
+
+test-hdmi: tests/test-HDMI
+ tests/test-HDMI $(HDMI_DEV)
+
+test-iio: tests/test-IIO
+ tests/test-GPS $(IIO_DEV)
+
+test-radio: tests/test-Radio
+ tests/test-Radio
+
+test-usb: tests/test-USB
+ tests/test-USB $(USB_BUS_NB)
+
+test-wifi: tests/test-Wifi
+ tests/test-Wifi $(WIFI_CONNMANCTL_TECHNOLOGY)
+
diff --git a/meta-agl-bsp/recipes-bsp/platform-test/files/platform-test/Makefile.m3ulcb b/meta-agl-bsp/recipes-bsp/platform-test/files/platform-test/Makefile.m3ulcb
new file mode 100644
index 0000000..c6be740
--- /dev/null
+++ b/meta-agl-bsp/recipes-bsp/platform-test/files/platform-test/Makefile.m3ulcb
@@ -0,0 +1,19 @@
+#!/usr/bin/make
+
+ETHERNET_DEV=eth0
+HDMI_DEV=HDMI-A-1
+USB_BUS_NB=2
+
+test: test-ethernet test-hdmi test-usb
+
+test-all: test
+
+test-ethernet: tests/test-Ethernet
+ tests/test-Ethernet $(ETHERNET_DEV)
+
+test-hdmi: tests/test-HDMI
+ tests/test-HDMI $(HDMI_DEV)
+
+test-usb: tests/test-USB
+ tests/test-USB $(USB_BUS_NB)
+
diff --git a/meta-agl-bsp/recipes-bsp/platform-test/files/platform-test/detect-board.sh b/meta-agl-bsp/recipes-bsp/platform-test/files/platform-test/detect-board.sh
new file mode 100755
index 0000000..b7beb86
--- /dev/null
+++ b/meta-agl-bsp/recipes-bsp/platform-test/files/platform-test/detect-board.sh
@@ -0,0 +1,80 @@
+#!/bin/bash
+
+###########################################################################
+# Copyright (C) 2018 IoT.bzh
+#
+# Author: Romain Forlot <romain.forlot@iot.bzh>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###########################################################################
+
+
+PLATFORM_HW_INFO=/etc/platform-hw-info
+
+detect_can() {
+ echo "export CAN_DEV=\"$(echo $(for x in $(ls -d /sys/class/net/*); do [ $(cat ${x}/type) -eq 128 ] && echo -n $(basename $x); echo -n ' '; done))\"" >> $PLATFORM_HW_INFO
+}
+
+detect_eth() {
+ echo "export ETH_DEV=\"$(echo $(for x in $(ls -d /sys/class/net/*); do [ $(cat ${x}/type) -eq 1 ] && echo -n $(basename $x); echo -n ' '; done))\"" >> $PLATFORM_HW_INFO
+}
+
+detect_wifi() {
+ echo "export WIFI_DEV=\"$(echo $(for x in $(ls -d /sys/class/net/*/wireless 2> /dev/null); do echo -n $(basename $(dirname $x)); echo -n ' '; done))\"" >> $PLATFORM_HW_INFO
+}
+
+detect_bt() {
+ echo "export BT_DEV=\"$(echo $(ls -x /sys/class/bluetooth))\"" >> $PLATFORM_HW_INFO
+}
+
+detect_cpu_nb() {
+ echo "export CPU_N=\"$(grep processor /proc/cpuinfo | wc -l)\"" >> $PLATFORM_HW_INFO
+}
+
+detect_mem_total() {
+ echo "export MEM_TOTAL=\"$(cat /proc/meminfo | grep MemTotal | grep -Eo '[[:digit:]]* kB')\"" >> $PLATFORM_HW_INFO
+}
+
+detect_hardware() {
+ detect_can
+ detect_eth
+ detect_wifi
+ detect_bt
+ detect_cpu_nb
+ detect_mem_total
+}
+
+detect_renesas() {
+ if [ "$(grep -i $1 /sys/devices/soc0/family)" ]
+ then
+ SOC_ID=$(cat /sys/devices/soc0/soc_id)
+ echo "export SOC_ID=\"${SOC_ID}\"" > $PLATFORM_HW_INFO
+ echo "export FAMILY=\"$(cat /sys/devices/soc0/family)\"" >> $PLATFORM_HW_INFO
+ echo "export SOC_REVISION=\"$(cat /sys/devices/soc0/revision)\"" >> $PLATFORM_HW_INFO
+ echo "export BOARD_ID=\"$(echo $(tr '\0' '\n' < /sys/firmware/devicetree/base/compatible | sed -r -e '/'${SOC_ID}'/d' -e 's:.*,(.*):\1:' | tr '\n' ' '))\"" >> $PLATFORM_HW_INFO
+ echo "export CPU_ARCH=\"$(grep MODALIAS /sys/devices/system/cpu/cpu0/uevent | sed -r 's:.*type\:([a-z0-9]*)\:.*$:\1:')\"" >> $PLATFORM_HW_INFO
+ echo "export CPU_COMPATIBLE_0=\"$(grep OF_COMPATIBLE_0 /sys/devices/system/cpu/cpu0/uevent | cut -d',' -f2)\"" >> $PLATFORM_HW_INFO
+ echo "export CPU_COMPATIBLE_1=\"$(grep OF_COMPATIBLE_1 /sys/devices/system/cpu/cpu0/uevent | cut -d',' -f2)\"" >> $PLATFORM_HW_INFO
+
+ detect_hardware
+
+ exit
+ fi
+}
+
+for gen in Gen3
+do
+ detect_renesas $gen
+done
+
+
diff --git a/meta-agl-bsp/recipes-bsp/platform-test/files/platform-test/tests/common.sh b/meta-agl-bsp/recipes-bsp/platform-test/files/platform-test/tests/common.sh
new file mode 100644
index 0000000..a4c7be5
--- /dev/null
+++ b/meta-agl-bsp/recipes-bsp/platform-test/files/platform-test/tests/common.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+start_test() {
+ echo "##############################"
+ echo "# Starting test: $* #"
+ echo "##############################"
+}
+
+pass() {
+ echo "PASS: $*"
+}
+
+fail() {
+ echo "FAIL: $*"
+}
+
+fail() {
+ echo "SKIP: $*"
+}
diff --git a/meta-agl-bsp/recipes-bsp/platform-test/files/platform-test/tests/test-BT_HCI b/meta-agl-bsp/recipes-bsp/platform-test/files/platform-test/tests/test-BT_HCI
new file mode 100755
index 0000000..d6a9aaf
--- /dev/null
+++ b/meta-agl-bsp/recipes-bsp/platform-test/files/platform-test/tests/test-BT_HCI
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+SCRIPT_DIR=$( cd "$( dirname "$0" )" && pwd )
+. ${SCRIPT_DIR}/common.sh
+
+TEST_MSG="HCI BT device detection"
+
+HCI_DEV=$(hcitool dev | sed '1d')
+
+[ "${HCI_DEV}" ] && pass ${TEST_MSG} || fail ${TEST_MSG}
diff --git a/meta-agl-bsp/recipes-bsp/platform-test/files/platform-test/tests/test-CAN b/meta-agl-bsp/recipes-bsp/platform-test/files/platform-test/tests/test-CAN
new file mode 100755
index 0000000..23a0888
--- /dev/null
+++ b/meta-agl-bsp/recipes-bsp/platform-test/files/platform-test/tests/test-CAN
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+SCRIPT_DIR=$( cd "$( dirname "$0" )" && pwd )
+. ${SCRIPT_DIR}/common.sh
+
+TEST_MSG="CAN device detection: "
+
+for dev in $*
+do
+ ip link show dev ${dev} &> /dev/null
+ [ $? -eq 0 ] && pass ${TEST_MSG} $dev || fail ${TEST_MSG} $dev
+done
diff --git a/meta-agl-bsp/recipes-bsp/platform-test/files/platform-test/tests/test-Ethernet b/meta-agl-bsp/recipes-bsp/platform-test/files/platform-test/tests/test-Ethernet
new file mode 100755
index 0000000..c97bfa9
--- /dev/null
+++ b/meta-agl-bsp/recipes-bsp/platform-test/files/platform-test/tests/test-Ethernet
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+SCRIPT_DIR=$( cd "$( dirname "$0" )" && pwd )
+. ${SCRIPT_DIR}/common.sh
+
+TEST_MSG="Ethernet device detection: "
+
+for dev in $*
+do
+ ip link show dev ${dev} &> /dev/null
+ [ $? -eq 0 ] && pass ${TEST_MSG} $dev || fail ${TEST_MSG} $dev
+done
diff --git a/meta-agl-bsp/recipes-bsp/platform-test/files/platform-test/tests/test-GPS b/meta-agl-bsp/recipes-bsp/platform-test/files/platform-test/tests/test-GPS
new file mode 100755
index 0000000..8d8916a
--- /dev/null
+++ b/meta-agl-bsp/recipes-bsp/platform-test/files/platform-test/tests/test-GPS
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+SCRIPT_DIR=$( cd "$( dirname "$0" )" && pwd )
+. ${SCRIPT_DIR}/common.sh
+
+TEST_DEV_PRESENCE_MSG="GPS device detection"
+TEST_DUMP_DEVICE_MSG="GPS dump test"
+
+test_dev_presence() {
+ ls ${1} &> /dev/null
+ if [ $? -eq 0 ]
+ then
+ pass ${TEST_DEV_PRESENCE_MSG}
+ else
+ fail ${TEST_DEV_PRESENCE_MSG}
+ fi
+}
+
+test_dump_device() {
+ GPS_DUMP_FILE=/tmp/gps-dump-test.log
+ cat ${1} &> ${GPS_DUMP_FILE} &
+ DUMP_PID=$!
+ sleep 1
+ kill ${DUMP_PID}
+ if [ $(ls -l ${GPS_DUMP_FILE} | awk '{print $5}') -gt 0 ]
+ then
+ pass ${TEST_DUMP_DEVICE_MSG}
+ else
+ fail ${TEST_DUMP_DEVICE_MSG}
+ fi
+}
+
+RESULT=$(test_dev_presence $1)
+if [ "$(echo $RESULT | cut -d':' -f1)" = "PASS" ]
+then
+ RESULT="${RESULT}\n$(test_dump_device $1)"
+else
+ RESULT="${RESULT}\n$(skip ${TEST_DUMP_DEVICE_MSG})"
+fi
+
+echo -e "$RESULT"
diff --git a/meta-agl-bsp/recipes-bsp/platform-test/files/platform-test/tests/test-HDMI b/meta-agl-bsp/recipes-bsp/platform-test/files/platform-test/tests/test-HDMI
new file mode 100755
index 0000000..82dd5bb
--- /dev/null
+++ b/meta-agl-bsp/recipes-bsp/platform-test/files/platform-test/tests/test-HDMI
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+SCRIPT_DIR=$( cd "$( dirname "$0" )" && pwd )
+. ${SCRIPT_DIR}/common.sh
+
+TEST_MSG="HDMI devices detection card: "
+
+for dev in $*
+do
+ RET=$(cat /sys/class/drm/card*-${dev}/status 2> /dev/null)
+ if [ "${RET}" = "connected" ] || [ "${RET}" = "disconnected" ]
+ then
+ pass ${TEST_MSG} $dev
+ else
+ fail ${TEST_MSG} $dev
+ fi
+done
diff --git a/meta-agl-bsp/recipes-bsp/platform-test/files/platform-test/tests/test-IIO b/meta-agl-bsp/recipes-bsp/platform-test/files/platform-test/tests/test-IIO
new file mode 100755
index 0000000..cfe272b
--- /dev/null
+++ b/meta-agl-bsp/recipes-bsp/platform-test/files/platform-test/tests/test-IIO
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+SCRIPT_DIR=$( cd "$( dirname "$0" )" && pwd )
+. ${SCRIPT_DIR}/common.sh
+
+TEST_MSG="IIO Devices Gyro/Accell detection"
+
+IIO_DUMP_FILE=/tmp/gps-dump-test.log
+cat $* &> ${IIO_DUMP_FILE}
+
+if [ $(ls -l ${IIO_DUMP_FILE} | awk '{print $5}') -gt 0 ]
+then
+ pass ${TEST_MSG}
+else
+ fail ${TEST_MSG}
+fi
diff --git a/meta-agl-bsp/recipes-bsp/platform-test/files/platform-test/tests/test-Radio b/meta-agl-bsp/recipes-bsp/platform-test/files/platform-test/tests/test-Radio
new file mode 100755
index 0000000..3d4d1bd
--- /dev/null
+++ b/meta-agl-bsp/recipes-bsp/platform-test/files/platform-test/tests/test-Radio
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+SCRIPT_DIR=$( cd "$( dirname "$0" )" && pwd )
+. ${SCRIPT_DIR}/common.sh
+
+TEST_MSG="Radio device detection"
+
+RADIO_DEV=$(arecord -l | grep "radio")
+
+if [ "${RADIO_DEV}" ]
+then
+ pass ${TEST_MSG}
+else
+ fail ${TEST_MSG}
+fi
diff --git a/meta-agl-bsp/recipes-bsp/platform-test/files/platform-test/tests/test-USB b/meta-agl-bsp/recipes-bsp/platform-test/files/platform-test/tests/test-USB
new file mode 100755
index 0000000..189dd02
--- /dev/null
+++ b/meta-agl-bsp/recipes-bsp/platform-test/files/platform-test/tests/test-USB
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+SCRIPT_DIR=$( cd "$( dirname "$0" )" && pwd )
+. ${SCRIPT_DIR}/common.sh
+
+TEST_MSG="USB bus detection: "
+
+for dev in $(seq 1 $1)
+do
+ RET=$(lsusb -s ${dev}:)
+ if [ "${RET}" ]
+ then
+ pass ${TEST_MSG} $dev
+ else
+ fail ${TEST_MSG} $dev
+ fi
+done
diff --git a/meta-agl-bsp/recipes-bsp/platform-test/files/platform-test/tests/test-Wifi b/meta-agl-bsp/recipes-bsp/platform-test/files/platform-test/tests/test-Wifi
new file mode 100755
index 0000000..10d1eca
--- /dev/null
+++ b/meta-agl-bsp/recipes-bsp/platform-test/files/platform-test/tests/test-Wifi
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+SCRIPT_DIR=$( cd "$( dirname "$0" )" && pwd )
+. ${SCRIPT_DIR}/common.sh
+
+TEST_ENABLE_WIFI_MSG="Wifi enable device"
+TEST_SCAN_WIFI_MSG="Wifi scan available networks"
+TEST_SERVICES_MSG="Wifi services"
+
+# Ensuring that wifi is disable to avoid error message that it was already enable
+connmanctl disable wifi &> /dev/null
+
+RET=$(connmanctl enable wifi)
+if [ $? -eq 0 ] && [ ! "$(echo $RET | awk '{print $1}')" = "Error" ]
+then
+ pass $TEST_ENABLE_WIFI_MSG
+else
+ fail $TEST_ENABLE_WIFI_MSG
+ skip $TEST_SCAN_WIFI_MSG
+ skip $TEST_SERVICES_MSG
+ exit 1
+fi
+
+sleep 1
+RET=$(connmanctl scan wifi)
+if [ $? -eq 0 ] && [ ! "$(echo $RET | awk '{print $1}')" = "Error" ]
+then
+ pass $TEST_SCAN_WIFI_MSG
+else
+ fail $TEST_SCAN_WIFI_MSG
+ skip $TEST_SERVICES_MSG
+ exit 2
+fi
+
+RET=$(connmanctl services)
+if [ $? -eq 0 ] && [ ! "$(echo $RET | awk '{print $1}')" = "Error" ]
+then
+ pass $TEST_SERVICES_MSG
+else
+ fail $TEST_SERVICES_MSG
+ exit 3
+fi
+
diff --git a/meta-agl-bsp/recipes-bsp/platform-test/files/run-ptest b/meta-agl-bsp/recipes-bsp/platform-test/files/run-ptest
new file mode 100755
index 0000000..a73d96e
--- /dev/null
+++ b/meta-agl-bsp/recipes-bsp/platform-test/files/run-ptest
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+detect-board.sh
+source /etc/platform-hw-info
+make -f "Makefile.${BOARD_ID}"
diff --git a/meta-agl-bsp/recipes-bsp/platform-test/platform-test_%.bb b/meta-agl-bsp/recipes-bsp/platform-test/platform-test_%.bb
new file mode 100644
index 0000000..3361b58
--- /dev/null
+++ b/meta-agl-bsp/recipes-bsp/platform-test/platform-test_%.bb
@@ -0,0 +1,39 @@
+SUMMARY = "Basic hardware tests for different platform"
+DESCRIPTION = "Test hardware of different platforms."
+#HOMEPAGE = "https://gerrit.automotivelinux.org/gerrit/#/admin/projects/apps/app-afb-test"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
+
+SRC_URI = "file://${PN}.tar.gz \
+ file://run-ptest \
+"
+
+SRC_URI[md5sum]="5717b7fcaf8b6654238853768cbfc267"
+
+RDEPENDS_${PN} += "bash"
+RDEPENDS_${PN}-ptest += "bash make"
+
+PV = "${AGLVERSION}"
+
+S = "${WORKDIR}/${PN}"
+
+inherit ptest
+
+FILES_${PN} = "${sysconfdir}/agl-postinsts/detect-board.sh \
+ ${bindir}/detect-board.sh \
+"
+
+do_compile() {
+}
+
+do_install() {
+ install -D ${S}/detect-board.sh ${D}${sysconfdir}/agl-postinsts/detect-board.sh
+ install -D ${S}/detect-board.sh ${D}${bindir}/detect-board.sh
+}
+
+do_install_ptest() {
+ install -d ${D}${PTEST_PATH}/tests
+ install -D ${S}/Makefile* ${D}${PTEST_PATH}
+ install -D ${S}/tests/* ${D}${PTEST_PATH}/tests
+}
+
diff --git a/meta-agl-profile-core/recipes-platform/packagegroups/packagegroup-agl-core-boot.bb b/meta-agl-profile-core/recipes-platform/packagegroups/packagegroup-agl-core-boot.bb
index 1633fed..0404541 100644
--- a/meta-agl-profile-core/recipes-platform/packagegroups/packagegroup-agl-core-boot.bb
+++ b/meta-agl-profile-core/recipes-platform/packagegroups/packagegroup-agl-core-boot.bb
@@ -36,6 +36,7 @@ RDEPENDS_${PN} = "\
busybox \
rng-tools \
run-agl-postinsts \
+ platform-test \
${@bb.utils.contains("DISTRO_FEATURES", "sysvinit", "${SYSVINIT_SCRIPTS}", "", d)} \
${@bb.utils.contains("MACHINE_FEATURES", "keyboard", "${VIRTUAL-RUNTIME_keymaps}", "", d)} \
netbase \