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/romley-ivb/ethernet | 88 ++++++++++++++++++ .../ddt-runner/files/scripts/romley-ivb/rtc | 42 +++++++++ .../ddt-runner/files/scripts/romley-ivb/sata | 81 +++++++++++++++++ .../ddt-runner/files/scripts/romley-ivb/usb | 100 +++++++++++++++++++++ 4 files changed, 311 insertions(+) create mode 100755 recipes-test/ddt-runner/files/scripts/romley-ivb/ethernet create mode 100755 recipes-test/ddt-runner/files/scripts/romley-ivb/rtc create mode 100755 recipes-test/ddt-runner/files/scripts/romley-ivb/sata create mode 100755 recipes-test/ddt-runner/files/scripts/romley-ivb/usb (limited to 'recipes-test/ddt-runner/files/scripts/romley-ivb') diff --git a/recipes-test/ddt-runner/files/scripts/romley-ivb/ethernet b/recipes-test/ddt-runner/files/scripts/romley-ivb/ethernet new file mode 100755 index 0000000..5355f10 --- /dev/null +++ b/recipes-test/ddt-runner/files/scripts/romley-ivb/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/romley-ivb/rtc b/recipes-test/ddt-runner/files/scripts/romley-ivb/rtc new file mode 100755 index 0000000..0d38293 --- /dev/null +++ b/recipes-test/ddt-runner/files/scripts/romley-ivb/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/romley-ivb/sata b/recipes-test/ddt-runner/files/scripts/romley-ivb/sata new file mode 100755 index 0000000..25bf15a --- /dev/null +++ b/recipes-test/ddt-runner/files/scripts/romley-ivb/sata @@ -0,0 +1,81 @@ +#!/bin/sh +# +#This script is to test sata devices on target +# +result=0 +devpath="" +satainfo="" +SD=`ls -l /dev/sd[^0-9] | awk '{print $5 $6 "," $10}'` +if [ -z "$SD" ]; then + echo "FAIL: find sata device" + exit 1 +else + echo "PASS: find sata 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}'` + satainfo=`ls -l $devpath | grep sata` + + if [ -z "$satainfo" ] ; 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/sata_tmp + for partition in `ls "$s"[1-9]` + do + mount "$partition" /mnt/sata_tmp + if [ $? -ne 0 ]; then + result=$? + echo "FAIL: Mount $s" + else + echo "PASS: Mount $s" + dd if=/dev/urandom of=/mnt/sata_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/sata_tmp/writefile + fi + dd if=$s of=/mnt/sata_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/sata_tmp/readfile + fi + umount /mnt/sata_tmp + fi + done + + rm -fr /mnt/sata_tmp +done +exit $result diff --git a/recipes-test/ddt-runner/files/scripts/romley-ivb/usb b/recipes-test/ddt-runner/files/scripts/romley-ivb/usb new file mode 100755 index 0000000..15c417a --- /dev/null +++ b/recipes-test/ddt-runner/files/scripts/romley-ivb/usb @@ -0,0 +1,100 @@ +#!/bin/sh +# +# This script is used to test usb functionality for romley-ivb. +# + +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