From 2a7348129a42f21095fcd62e47a035f78d254130 Mon Sep 17 00:00:00 2001 From: Adrian Dudau Date: Thu, 12 Dec 2013 17:36:38 +0100 Subject: initial commit of Enea Linux 3.1 Migrated from the internal git server on the dora-enea branch Signed-off-by: Adrian Dudau --- .../ddt-runner/files/scripts/p4080ds/ethernet | 88 ++++++++++++++++++ .../ddt-runner/files/scripts/p4080ds/flash | 20 +++++ recipes-test/ddt-runner/files/scripts/p4080ds/i2c | 24 +++++ recipes-test/ddt-runner/files/scripts/p4080ds/rtc | 42 +++++++++ recipes-test/ddt-runner/files/scripts/p4080ds/sdhc | 65 ++++++++++++++ recipes-test/ddt-runner/files/scripts/p4080ds/spi | 48 ++++++++++ recipes-test/ddt-runner/files/scripts/p4080ds/usb | 100 +++++++++++++++++++++ 7 files changed, 387 insertions(+) create mode 100755 recipes-test/ddt-runner/files/scripts/p4080ds/ethernet create mode 100755 recipes-test/ddt-runner/files/scripts/p4080ds/flash create mode 100755 recipes-test/ddt-runner/files/scripts/p4080ds/i2c create mode 100755 recipes-test/ddt-runner/files/scripts/p4080ds/rtc create mode 100755 recipes-test/ddt-runner/files/scripts/p4080ds/sdhc create mode 100755 recipes-test/ddt-runner/files/scripts/p4080ds/spi create mode 100755 recipes-test/ddt-runner/files/scripts/p4080ds/usb (limited to 'recipes-test/ddt-runner/files/scripts/p4080ds') diff --git a/recipes-test/ddt-runner/files/scripts/p4080ds/ethernet b/recipes-test/ddt-runner/files/scripts/p4080ds/ethernet new file mode 100755 index 0000000..5355f10 --- /dev/null +++ b/recipes-test/ddt-runner/files/scripts/p4080ds/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/p4080ds/flash b/recipes-test/ddt-runner/files/scripts/p4080ds/flash new file mode 100755 index 0000000..19f95aa --- /dev/null +++ b/recipes-test/ddt-runner/files/scripts/p4080ds/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 p4080ds 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/p4080ds/i2c b/recipes-test/ddt-runner/files/scripts/p4080ds/i2c new file mode 100755 index 0000000..5b312b9 --- /dev/null +++ b/recipes-test/ddt-runner/files/scripts/p4080ds/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/p4080ds/rtc b/recipes-test/ddt-runner/files/scripts/p4080ds/rtc new file mode 100755 index 0000000..0d38293 --- /dev/null +++ b/recipes-test/ddt-runner/files/scripts/p4080ds/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/p4080ds/sdhc b/recipes-test/ddt-runner/files/scripts/p4080ds/sdhc new file mode 100755 index 0000000..31a7c2f --- /dev/null +++ b/recipes-test/ddt-runner/files/scripts/p4080ds/sdhc @@ -0,0 +1,65 @@ +#!/bin/sh +# This script is used to test sdhc functionality for p4080ds. +# 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/p4080ds/spi b/recipes-test/ddt-runner/files/scripts/p4080ds/spi new file mode 100755 index 0000000..b4df851 --- /dev/null +++ b/recipes-test/ddt-runner/files/scripts/p4080ds/spi @@ -0,0 +1,48 @@ +#!/bin/sh + +#An spi flash M25P80 connect to p4080 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 diff --git a/recipes-test/ddt-runner/files/scripts/p4080ds/usb b/recipes-test/ddt-runner/files/scripts/p4080ds/usb new file mode 100755 index 0000000..970e913 --- /dev/null +++ b/recipes-test/ddt-runner/files/scripts/p4080ds/usb @@ -0,0 +1,100 @@ +#!/bin/sh +# +# This script is used to test usb functionality for p4080ds. +# + +result=0 +devpath="" +usbinfo="" + +usbutils_is_installed=`which lsusb` +if [ -z $usbutils_is_installed ]; then + echo "FAIL: Cannot find lsusb" + exit 1 +fi + +usbdev_num=`lsusb | grep -v root\ hub | wc -l` +if [ $usbdev_num -eq 0 ]; then + echo "FAIL: USB device is not connected" + exit 1 +else + echo "$usbdev_num USB device(s) connected" +fi + +sd=`ls -l /dev/sd[^0-9] | awk '{print $5 $6 "," $10}'` +if [ -z "$sd" ]; then + echo "FAIL: find sd device" + exit 1 +else + echo "PASS: find sd device" +fi + +HDPARM=`which hdparm` +if [ -z $HDPARM ]; then + result=$? + echo "FAIL: find hdparm" +fi + echo "PASS: find hdparm" + +for s in $sd +do + devpath=`echo "$s" | awk -F "," '{print "/sys/dev/block/" $1 ":" $2}'` + usbinfo=`ls -l $devpath | grep usb` + + if [ -z "$usbinfo" ] ; then + continue + fi + + s=`echo "$s" | awk -F "," '{print $3}'` + + echo "Testing $s" + $HDPARM -I $s + if [ $? -ne 0 ]; then + result=$? + echo "FAIL: $HDPARM -I $s Detailed/current information directly from $s" + else + echo "PASS: $HDPARM -I $s Detailed/current information directly from $s" + fi + + $HDPARM -tT $s + if [ $? -ne 0 ]; then + result=$? + echo "FAIL: $HDPARM -tT $s Perform device/cache read timings on $s" + else + echo "PASS: $HDPARM -tT $s Perform device/cache read timings on $s" + fi + + mkdir -p /mnt/usb_tmp + for partition in `ls "$s"[1-9]` + do + echo "Testing $partition" + + mount "$partition" /mnt/usb_tmp + if [ $? -ne 0 ]; then + result=$? + echo "FAIL: mount $s" + else + echo "PASS: mount $s" + dd if=/dev/urandom of=/mnt/usb_tmp/writefile bs=1M count=50 + if [ $? -ne 0 ]; then + result=$? + echo "FAIL: write test on $s" + else + echo "PASS: write test on $s" + rm -f /mnt/usb_tmp/writefile + fi + dd if=$s of=/mnt/usb_tmp/readfile bs=1M count=10 + if [ $? -ne 0 ]; then + result=$? + echo "FAIL: read test on $s" + else + echo "PASS: read test on $s" + rm -f /mnt/usb_tmp/readfile + fi + umount /mnt/usb_tmp + fi + done + + rm -fr /mnt/usb_tmp +done +exit $result -- cgit v1.2.3-54-g00ecf