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/bsc9131rdb/ethernet | 89 ++++++++++++++++++++++ .../ddt-runner/files/scripts/bsc9131rdb/flash | 48 ++++++++++++ .../ddt-runner/files/scripts/bsc9131rdb/i2c | 75 ++++++++++++++++++ .../ddt-runner/files/scripts/bsc9131rdb/preempt_rt | 33 ++++++++ .../ddt-runner/files/scripts/bsc9131rdb/spi | 56 ++++++++++++++ .../ddt-runner/files/scripts/bsc9131rdb/watchdog | 64 ++++++++++++++++ 6 files changed, 365 insertions(+) create mode 100755 recipes-test/ddt-runner/files/scripts/bsc9131rdb/ethernet create mode 100755 recipes-test/ddt-runner/files/scripts/bsc9131rdb/flash create mode 100755 recipes-test/ddt-runner/files/scripts/bsc9131rdb/i2c create mode 100755 recipes-test/ddt-runner/files/scripts/bsc9131rdb/preempt_rt create mode 100755 recipes-test/ddt-runner/files/scripts/bsc9131rdb/spi create mode 100755 recipes-test/ddt-runner/files/scripts/bsc9131rdb/watchdog (limited to 'recipes-test/ddt-runner/files/scripts/bsc9131rdb') diff --git a/recipes-test/ddt-runner/files/scripts/bsc9131rdb/ethernet b/recipes-test/ddt-runner/files/scripts/bsc9131rdb/ethernet new file mode 100755 index 0000000..df64e08 --- /dev/null +++ b/recipes-test/ddt-runner/files/scripts/bsc9131rdb/ethernet @@ -0,0 +1,89 @@ +#!/bin/sh +# This script is used to test ethernet interface for bsc9131rdb. + +ethernet_interface="eth0" +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/bsc9131rdb/flash b/recipes-test/ddt-runner/files/scripts/bsc9131rdb/flash new file mode 100755 index 0000000..66631ba --- /dev/null +++ b/recipes-test/ddt-runner/files/scripts/bsc9131rdb/flash @@ -0,0 +1,48 @@ +#!/bin/sh +# +# This script is used to test flash driver functionality. I removed the tests +# which include write operations since all partition are in use in bsc9131rdb +# 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: $part_num partitions found" +else + echo "FAIL: $part_num partitions found" + exit 1 +fi + +for((part=0; part<$part_num; 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" + exit 1 + fi +done + +READ_TEST=`find / -name mtd_readtest.ko -print` + +if [ ! -e $READ_TEST ]; then + echo "FAIL: $READ_TEST does not exist" + exit 1 +else + echo "PASS: $READ_TEST exists" +fi + +for((part=0; part<$part_num; part++)); +do + dmesg -c > NULL + + modprobe $READ_TEST dev=$part + + bad_num=`dmesg | grep -c 'bad'` + if [ $bad_num -eq 0 ]; then + echo "PASS: read test for partition $part" + else + echo "FAIL: read test for partition $part" + fi + + rmmod $READ_TEST +done diff --git a/recipes-test/ddt-runner/files/scripts/bsc9131rdb/i2c b/recipes-test/ddt-runner/files/scripts/bsc9131rdb/i2c new file mode 100755 index 0000000..c4acd8e --- /dev/null +++ b/recipes-test/ddt-runner/files/scripts/bsc9131rdb/i2c @@ -0,0 +1,75 @@ +#!/bin/sh +# This script is used to test i2c interface for bsc9131rdb + +I2C_DETECT=`which i2cdetect` +if [ "x$I2C_DETECT" != "x" ]; then + echo "PASS: i2cdetect found" +else + echo "FAIL: i2cdetect not found" + exit 1 +fi + +I2C_SET=`which i2cset` +if [ "x$I2C_SET" != "x" ]; then + echo "PASS: i2cset found" +else + echo "FAIL: i2cset not found" + exit 1 +fi + +I2C_GET=`which i2cget` +if [ "x$I2C_GET" != "x" ]; then + echo "PASS: i2cget found" +else + echo "FAIL: i2cget not found" + exit 1 +fi + +if I2C_ADAPTERS=`$I2C_DETECT -l |wc -l`; then + echo "PASS: $I2C_ADAPTERS i2c adapters found" +else + echo "FAIL: no i2c adapters found" + exit 1 +fi + +adapters=0 +while [ $adapters -lt $I2C_ADAPTERS ] +do + $I2C_DETECT -y $adapters + if [ $? -ne 0 ]; then + echo "FAIL: detect i2c adapter $adapters fail" + else + echo "PASS: detect i2c adapter $adapters success" + fi + adapters=`expr $adapters + 1` + sleep 1 +done + +# Area of bus:i2c-0 addr:0x52 is free to read and write +$I2C_SET -y 0 0x52 0 0x55 +if [ $? -eq 0 ]; then + echo "PASS: i2c_set -y 0 0x52 0 0x55 success" +else + echo "FAIL: i2c_set -y 0 0x52 0 0x55 fail" +fi + +num=`$I2C_GET -y 0 0x52 0 | grep -c '0x55'` +if [ $num -eq 1 ]; then + echo "PASS: i2c_get -y 0 0x52 0 success" +else + echo "FAIL: i2c_get -y 0 0x52 0 fail" +fi + +$I2C_SET -y 0 0x52 0 0xaa +if [ $? -eq 0 ]; then + echo "PASS: i2c_set -y 0 0x52 0 0xaa success" +else + echo "FAIL: i2c_set -y 0 0x52 0 0xaa fail" +fi + +num=`$I2C_GET -y 0 0x52 0 | grep -c '0xaa'` +if [ $num -eq 1 ]; then + echo "PASS: i2c_get -y 0 0x52 0 success" +else + echo "FAIL: i2c_get -y 0 0x52 0 fail" +fi diff --git a/recipes-test/ddt-runner/files/scripts/bsc9131rdb/preempt_rt b/recipes-test/ddt-runner/files/scripts/bsc9131rdb/preempt_rt new file mode 100755 index 0000000..111cfa2 --- /dev/null +++ b/recipes-test/ddt-runner/files/scripts/bsc9131rdb/preempt_rt @@ -0,0 +1,33 @@ +#!/bin/sh +# +#This script is to test PREEMPT RT on target +# + +uname -a | grep "PREEMPT RT" +if [ $? -ne 0 ]; then + echo "FAIL: The kernel include real-time patch" + echo 1 +fi + echo "PASS: The kernel include real-time patch" + +ps | grep '\(\[irq/\)' +if [ $? -ne 0 ]; then + echo "FAIL: The IRQ handlers are treated by a patched kernel in kernel thread context." + exit 1 +fi + echo "PASS: The IRQ handlers are treated by a patched kernel in kernel thread context." + +cyclictest -t5 -p 80 -i 10000 -l 100 +if [ $? -ne 0 ]; then + echo "FAIL: Test case: POSIX interval timer, Interval 10000 micro seconds,. 100 loops." + exit 1 +fi + echo "PASS: Test case: POSIX interval timer, Interval 10000 micro seconds,. 100 loops." + +cyclictest -t5 -p 80 -n -i 10000 -l 100 +if [ $? -ne 0 ]; then + echo "FAIL: Test case: clock_nanosleep(TIME_ABSTIME), Interval 10000 micro seconds,. 100 loops." + exit 1 +fi + echo "PASS: Test case: clock_nanosleep(TIME_ABSTIME), Interval 10000 micro seconds,. 100 loops." + diff --git a/recipes-test/ddt-runner/files/scripts/bsc9131rdb/spi b/recipes-test/ddt-runner/files/scripts/bsc9131rdb/spi new file mode 100755 index 0000000..3386d6c --- /dev/null +++ b/recipes-test/ddt-runner/files/scripts/bsc9131rdb/spi @@ -0,0 +1,56 @@ +#!/bin/sh +# This script is used to test spi flash functionality for bsc9131rdb. An spi +# flash M25P80 connect to bsc9131 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/mtd8" +MTD_BLOCK_DEVICE="/dev/mtdblock8" + +FLASH_ERASE=`which flash_erase` +if [ "x$FLASH_ERASE" != "x" ]; then + echo "PASS: flash_erase found" +else + echo "FAIL: flash_erase not found" + exit 1 +fi + +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 + +$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 + file_num=`ls /mnt/spi |grep -c 'busybox'` + if [ $file_num -eq 1 ]; then + rm /mnt/spi/busybox + umount $MTD_BLOCK_DEVICE + echo "PASS: read or write spi flash device $MTD_BLOCK_DEVICE success" + else + echo "FAIL: read or write spi flash device $MTD_BLOCK_DEVICE fail" + exit 1 + fi + fi +fi + +echo "PASS: spi bus test passed" +exit 0 diff --git a/recipes-test/ddt-runner/files/scripts/bsc9131rdb/watchdog b/recipes-test/ddt-runner/files/scripts/bsc9131rdb/watchdog new file mode 100755 index 0000000..71429fc --- /dev/null +++ b/recipes-test/ddt-runner/files/scripts/bsc9131rdb/watchdog @@ -0,0 +1,64 @@ +#!/bin/sh +# +# This script is used to test watchdog functionality for bsc9131rdb. + +WATCHDOG=`which watchdog` +if [ "x$WATCHDOG" != "x" ]; then + echo "PASS: watchdog found" +else + echo "FAIL: watchdog not found" + exit 1 +fi + +WATCHDOG_CONF=/etc/watchdog.conf +if [ -f $WATCHDOG_CONF ]; then + echo "PASS: watchdog config file found" + sed -i '23,23 s/#//' $WATCHDOG_CONF +else + echo "FAIL: watchdog config file not found" + exit 1 +fi + +$WATCHDOG -v /dev/watchdog +watchdog_thread=`ps | grep -c 'watchdog -v /dev/watchdog'` +if [ $watchdog_thread -eq 2 ]; then + echo "PASS: Watchdog daemon started successfully" +else + echo "FAIL: Failed to start watchdog daemon" + exit 1 +fi + +sleep 5s + +killall watchdog + +retry=0 +while [ $retry -lt 10 ] +do + watchdog_thread=`ps | grep -c 'watchdog -v /dev/watchdog'` + if [ $watchdog_thread -eq 1 ]; then + echo "PASS: Watchdog daemon stopped successfully" + break; + fi + sleep 1s + retry=`expr $retry + 1` +done + +if [ $retry -eq 10 ]; then + echo "FAIL: Failed to stop watchdog daemon" +fi + +found=0 +while read line +do + result=`echo $line | grep -c 'still alive after 1 interval'` + if [ $result -eq 1 ]; then + echo "PASS: Watchdog is still alive after 1 interval" + found=1 + fi +done < /var/log/messages + +if [ $found -eq 0 ]; then + echo "FAIL: Watchdog is not alive after 1 interval" +fi + -- cgit v1.2.3-54-g00ecf