From cd3411088f6bb4393d79c50b5f7eef3f11a83435 Mon Sep 17 00:00:00 2001 From: Tudor Florea Date: Fri, 10 Oct 2014 00:31:33 +0200 Subject: initial commit for Enea Linux 4.0-140929 Migrated from the internal git server on the daisy-enea-point-release branch Signed-off-by: Tudor Florea --- .../ddt-runner/files/scripts/zc702-zynq7/ethernet | 88 ++++++++++++++++++++++ .../ddt-runner/files/scripts/zc702-zynq7/flash | 20 +++++ .../ddt-runner/files/scripts/zc702-zynq7/i2c | 24 ++++++ .../ddt-runner/files/scripts/zc702-zynq7/rtc | 42 +++++++++++ .../ddt-runner/files/scripts/zc702-zynq7/sdhc | 65 ++++++++++++++++ .../ddt-runner/files/scripts/zc702-zynq7/spi | 48 ++++++++++++ 6 files changed, 287 insertions(+) create mode 100755 recipes-test/ddt-runner/files/scripts/zc702-zynq7/ethernet create mode 100755 recipes-test/ddt-runner/files/scripts/zc702-zynq7/flash create mode 100755 recipes-test/ddt-runner/files/scripts/zc702-zynq7/i2c create mode 100755 recipes-test/ddt-runner/files/scripts/zc702-zynq7/rtc create mode 100755 recipes-test/ddt-runner/files/scripts/zc702-zynq7/sdhc create mode 100755 recipes-test/ddt-runner/files/scripts/zc702-zynq7/spi (limited to 'recipes-test/ddt-runner/files/scripts/zc702-zynq7') diff --git a/recipes-test/ddt-runner/files/scripts/zc702-zynq7/ethernet b/recipes-test/ddt-runner/files/scripts/zc702-zynq7/ethernet new file mode 100755 index 0000000..5355f10 --- /dev/null +++ b/recipes-test/ddt-runner/files/scripts/zc702-zynq7/ethernet @@ -0,0 +1,88 @@ +#!/bin/sh + +ethernet_interface="eth1" +ethernet_ping_ipaddr="172.21.3.22" +ethernet_ipaddr=$1 + +IFCONFIG=`which ifconfig` + +$IFCONFIG $ethernet_interface up +$IFCONFIG | grep $ethernet_interface +if [ $? -ne 0 ]; then + echo "FAIL: $ethernet_interface is not up" + exit 1 +else + echo "PASS: $ethernet_interface is up" +fi + +if [ "x$ethernet_ipaddr" != "x" ]; then + $IFCONFIG $ethernet_interface $ethernet_ipaddr +fi + +$IFCONFIG $ethernet_interface |grep 'inet addr:' |sed -e 's@inet addr:@@' |sed q | awk '{print $1}' +if [ $? -ne 0 ]; then + echo "FAIL: ipaddr of $ethernet_interface setup failed" + exit 1 +else + echo "PASS: ipaddr of $ethernet_interface setup success" +fi + +mindatasize=56 +maxdatasize=650 +stepsize=100 +iteration=1 +datasize=$mindatasize +logfile=`/bin/mktemp` +statistics=`/bin/mktemp` +error=0 + +trap cleanup SIGHUP SIGINT SIGTERM + +clean_tasks() { + echo "Executing clean up tasks" + rm -f $logfile $statistics +} + +cleanup() { + echo "Aborting script execution" + clean_tasks + exit 0 +} + +echo "start ping test for $ethernet_interface..." + +while [ $datasize -le $maxdatasize ]; do + for i in `seq 1 $iteration`; do + ping -c 1 -s $datasize $ethernet_ping_ipaddr > $statistics + ping_err=`echo $?` + echo "" && cat $statistics | grep -r "PING" + cat $statistics | grep -r "received" + [ `echo $?` -eq 0 ] || packets_received=0 && \ + packets_received=`cat $statistics | \ + grep -r "received" | awk '{print$4}'` + + # Evaluate possible errors on the ping operation + if [ $ping_err -ne 0 ] || [ $packets_received -eq 0 ]; then + error=1 + echo -e `cat $statistics | grep -r PING` >> $logfile + echo -e "Size: $datasize Iteration: $i\n" >> $logfile + fi + done + let datasize=$datasize+$stepsize +done + +# Report failures +if [ $error -eq 1 ]; then + echo -e "=================== error report ===================\n" + cat $logfile + echo -e "====================================================\n" + clean_tasks + echo -e "FAIL: ping test for $ethernet_interface failed\n" + exit 1 +else + clean_tasks + echo -e "PASS: ping test for $ethernet_interface success\n" +fi + +echo "PASS: $ethernet_interface test passed" +exit 0 diff --git a/recipes-test/ddt-runner/files/scripts/zc702-zynq7/flash b/recipes-test/ddt-runner/files/scripts/zc702-zynq7/flash new file mode 100755 index 0000000..7fa897c --- /dev/null +++ b/recipes-test/ddt-runner/files/scripts/zc702-zynq7/flash @@ -0,0 +1,20 @@ +#!/bin/sh +# +# This script is used to test flash driver functionality. I removed the write +# operations since all partition are in use in zc702-zynq7 and there might be +# possibility of corrupting data even if we backup in test script. + +if part_num=`cat /proc/mtd | grep -c 'mtd'`; then + echo "PASS: show $part_num partitions" +else + echo "FAIL: show $part_num partitions" +fi + +for((part=0; part<$part_num-1; part++)); +do + if [ $(mtd_debug info /dev/mtd$part | grep -c 'mtd.type') ]; then + echo "PASS: show partition $part debug info" + else + echo "FAIL: show partition $part debug info" + fi +done diff --git a/recipes-test/ddt-runner/files/scripts/zc702-zynq7/i2c b/recipes-test/ddt-runner/files/scripts/zc702-zynq7/i2c new file mode 100755 index 0000000..5b312b9 --- /dev/null +++ b/recipes-test/ddt-runner/files/scripts/zc702-zynq7/i2c @@ -0,0 +1,24 @@ +#!/bin/sh + +if I2C_ADAPTERS=$(i2cdetect -l |wc -l); then + echo "PASS: found $I2C_ADAPTERS i2c adapters" +else + echo "FAIL: no i2c adapters found" + exit 1 +fi + +if [ -z "$adapters" ]; then + adapters=0 +fi + +while [ $adapters -lt $I2C_ADAPTERS ] +do + i2cdetect -y $adapters + if [ $? -ne 0 ]; then + echo "FAIL: detect i2c adapter $adapters failed" + else + echo "PASS: detect i2c adapter $adapters success" + fi + adapters=`expr $adapters + 1` + sleep 1 +done diff --git a/recipes-test/ddt-runner/files/scripts/zc702-zynq7/rtc b/recipes-test/ddt-runner/files/scripts/zc702-zynq7/rtc new file mode 100755 index 0000000..0d38293 --- /dev/null +++ b/recipes-test/ddt-runner/files/scripts/zc702-zynq7/rtc @@ -0,0 +1,42 @@ +#!/bin/sh + +RTC_DEVICE="/dev/rtc" + +if [ ! -e $RTC_DEVICE ]; then + echo "FAIL: rtc device does not exist" + exit 1 +else + echo "PASS: rtc device exists" +fi + +/sbin/hwclock -f $RTC_DEVICE +if [ $? -ne 0 ]; then + echo "FAIL: rtc device open failed" + exit 1 +else + echo "PASS: rtc device open success" +fi + + +/sbin/hwclock --systohc +if [ $? -ne 0 ]; then + echo "FAIL: sync system clock and hardware clock failed" + exit 1 +else + echo "PASS: sync system clock and hardware clock success" +fi + +RTC_TIME=$(/sbin/hwclock -r |awk '{print $4}') +echo $RTC_TIME +SYS_TIME=$(date +%m/%d/%Y-%X |awk '{print $1}' |awk -F- '{print $2}') +echo $SYS_TIME + +if [ "$RTC_TIME" = "$SYS_TIME" ] ; then + echo "PASS: system time same with hardware time" +else + echo "FAIL: system time different with hardware time" + exit 1 +fi + +echo "PASS: rtc test successful" +exit 0 diff --git a/recipes-test/ddt-runner/files/scripts/zc702-zynq7/sdhc b/recipes-test/ddt-runner/files/scripts/zc702-zynq7/sdhc new file mode 100755 index 0000000..e341ebc --- /dev/null +++ b/recipes-test/ddt-runner/files/scripts/zc702-zynq7/sdhc @@ -0,0 +1,65 @@ +#!/bin/sh +# This script is used to test sdhc functionality for pandaboard. +# The content of SD will be lost by running this test case. + +SDHC_DEVICE="/dev/mmcblk0" +SDHC_DEVICE_PART="/dev/mmcblk0p1" +SFDISK=`which sfdisk` + +if [ -e $SDHC_DEVICE ]; then + echo "PASS: $SDHC_DEVICE device exists" +else + echo "FAIL: $SDHC_DEVICE does not exist" + exit 1 +fi + +if [ -e $SDHC_DEVICE_PART ]; then + echo "PASS: $SDHC_DEVICE_PART device exists" +elif [ ! -z $SFDISK ]; then + + echo "Try to create a partition" + +$SFDISK $SDHC_DEVICE << EOF +,,L +EOF + + if [ -e $SDHC_DEVICE_PART ]; then + echo "PASS: $SDHC_DEVICE_PART device exists" + else + echo "FAIL: $SDHC_DEVICE_PART does not exist" + exit 1 + fi + +else + echo "FAIL: $SDHC_DEVICE_PART does not exist" + exit 1 +fi + +mount |grep mmcblk0p1 +if [ $? -eq 0 ]; then + umount $SDHC_DEVICE_PART +fi + +/sbin/mkfs.ext2 $SDHC_DEVICE_PART +if [ $? -ne 0 ]; then + echo "FAIL: format $SDHC_DEVICE_PART fail" + exit 1 +else + mkdir -p /mnt/sdhc + mount $SDHC_DEVICE_PART /mnt/sdhc + if [ $? -ne 0 ]; then + echo "FAIL: mount $SDHC_DEVICE_PART fail" + exit 1 + else + cp /bin/busybox /mnt/sdhc + ls /mnt/sdhc |grep busybox + if [ $? -ne 0 ]; then + echo "FAIL: read or write $SDHC_DEVICE_PART fail" + exit 1 + else + umount $SDHC_DEVICE_PART + echo "PASS: read or write $SDHC_DEVICE_PART success" + fi + fi +fi + diff --git a/recipes-test/ddt-runner/files/scripts/zc702-zynq7/spi b/recipes-test/ddt-runner/files/scripts/zc702-zynq7/spi new file mode 100755 index 0000000..15df9bc --- /dev/null +++ b/recipes-test/ddt-runner/files/scripts/zc702-zynq7/spi @@ -0,0 +1,48 @@ +#!/bin/sh + +#An spi flash M25P80 connect to pandaboard cpu by spi bus, so the method +#is to read/write spi flash to verify whether the spi bus driver worked +#or not. + +MTD_CHAR_DEVICE="/dev/mtd4" +MTD_BLOCK_DEVICE="/dev/mtdblock4" + +if [ ! -e $MTD_CHAR_DEVICE ]; then + echo "FAIL: spi flash device $MTD_CHAR_DEVICE does not exist" + exit 1 +else + echo "PASS: spi flash device $MTD_CHAR_DEVICE exists" +fi + +if [ ! -e $MTD_BLOCK_DEVICE ]; then + echo "FAIL: spi flash device $MTD_BLOCK_DEVICE does not exist" + exit 1 +else + echo "PASS: spi flash device $MTD_BLOCK_DEVICE exists" +fi + +/usr/sbin/flash_erase -j $MTD_CHAR_DEVICE 0 0 +if [ $? -ne 0 ]; then + echo "FAIL: format spi flash device $MTD_BLOCK_DEVICE fail" + exit 1 +else + mkdir -p /mnt/spi + mount -t jffs2 $MTD_BLOCK_DEVICE /mnt/spi + if [ $? -ne 0 ]; then + echo "FAIL: mount spi flash device $MTD_BLOCK_DEVICE fail" + exit 1 + else + cp /bin/busybox /mnt/spi + ls /mnt/spi |grep busybox + if [ $? -ne 0 ]; then + echo "FAIL: read or write spi flash device $MTD_BLOCK_DEVICE fail" + exit 1 + else + umount $MTD_BLOCK_DEVICE + echo "PASS: read or write spi flash device $MTD_BLOCK_DEVICE success" + fi + fi +fi + +echo "PASS: spi bus test passed" +exit 0 -- cgit v1.2.3-54-g00ecf