summaryrefslogtreecommitdiffstats
path: root/recipes-test/ddt-runner/files/scripts/keystone-evm
diff options
context:
space:
mode:
authorTudor Florea <tudor.florea@enea.com>2014-10-10 00:31:33 +0200
committerTudor Florea <tudor.florea@enea.com>2014-10-10 00:53:44 +0200
commitcd3411088f6bb4393d79c50b5f7eef3f11a83435 (patch)
treee1b44fd7c353d9018f489d03f3dea78bc876b94a /recipes-test/ddt-runner/files/scripts/keystone-evm
downloadmeta-enea-cd3411088f6bb4393d79c50b5f7eef3f11a83435.tar.gz
initial commit for Enea Linux 4.0-140929daisy-140929
Migrated from the internal git server on the daisy-enea-point-release branch Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'recipes-test/ddt-runner/files/scripts/keystone-evm')
-rwxr-xr-xrecipes-test/ddt-runner/files/scripts/keystone-evm/ethernet88
-rwxr-xr-xrecipes-test/ddt-runner/files/scripts/keystone-evm/flash49
-rwxr-xr-xrecipes-test/ddt-runner/files/scripts/keystone-evm/i2c44
-rwxr-xr-xrecipes-test/ddt-runner/files/scripts/keystone-evm/spi48
4 files changed, 229 insertions, 0 deletions
diff --git a/recipes-test/ddt-runner/files/scripts/keystone-evm/ethernet b/recipes-test/ddt-runner/files/scripts/keystone-evm/ethernet
new file mode 100755
index 0000000..10a74fa
--- /dev/null
+++ b/recipes-test/ddt-runner/files/scripts/keystone-evm/ethernet
@@ -0,0 +1,88 @@
1#!/bin/sh
2
3ethernet_interface="eth1"
4#sestord02 ip address
5ethernet_ping_ipaddr="172.21.3.22"
6ethernet_ipaddr=$1
7
8IFCONFIG=`which ifconfig`
9
10$IFCONFIG $ethernet_interface up
11$IFCONFIG | grep $ethernet_interface
12if [ $? -ne 0 ]; then
13 echo "FAIL: $ethernet_interface is not up"
14 exit 1
15else
16 echo "PASS: $ethernet_interface is up"
17fi
18
19if [ "x$ethernet_ipaddr" != "x" ]; then
20 $IFCONFIG $ethernet_interface $ethernet_ipaddr
21fi
22
23$IFCONFIG $ethernet_interface |grep 'inet addr:' |sed -e 's@inet addr:@@' |sed q | awk '{print $1}'
24if [ $? -ne 0 ]; then
25 echo "FAIL: ipaddr of $ethernet_interface setup failed"
26 exit 1
27else
28 echo "PASS: ipaddr of $ethernet_interface setup success"
29fi
30
31mindatasize=56
32maxdatasize=650
33stepsize=100
34iteration=1
35datasize=$mindatasize
36logfile=`/bin/mktemp`
37statistics=`/bin/mktemp`
38error=0
39
40trap cleanup SIGHUP SIGINT SIGTERM
41
42clean_tasks() {
43 echo "Executing clean up tasks"
44 rm -f $logfile $statistics
45}
46
47cleanup() {
48 echo "Aborting script execution"
49 clean_tasks
50 exit 0
51}
52
53echo "start ping test for $ethernet_interface..."
54
55while [ $datasize -le $maxdatasize ]; do
56 for i in `seq 1 $iteration`; do
57 ping -c 1 -s $datasize $ethernet_ping_ipaddr > $statistics
58 ping_err=`echo $?`
59 echo "" && cat $statistics | grep -r "PING"
60 cat $statistics | grep -r "received"
61 [ `echo $?` -eq 0 ] || packets_received=0 && \
62 packets_received=`cat $statistics | \
63 grep -r "received" | awk '{print$4}'`
64
65 # Evaluate possible errors on the ping operation
66 if [ $ping_err -ne 0 ] || [ $packets_received -eq 0 ]; then
67 error=1
68 echo -e `cat $statistics | grep -r PING` >> $logfile
69 echo -e "Size: $datasize Iteration: $i\n" >> $logfile
70 fi
71 done
72 let datasize=$datasize+$stepsize
73done
74
75# Report failures
76if [ $error -eq 1 ]; then
77 echo -e "=================== error report ===================\n"
78 cat $logfile
79 echo -e "====================================================\n"
80 clean_tasks
81 echo -e "FAIL: ping test for $ethernet_interface failed\n"
82 exit 1
83else
84 clean_tasks
85 echo -e "PASS: ping test for $ethernet_interface success\n"
86fi
87
88exit 0
diff --git a/recipes-test/ddt-runner/files/scripts/keystone-evm/flash b/recipes-test/ddt-runner/files/scripts/keystone-evm/flash
new file mode 100755
index 0000000..ed2a619
--- /dev/null
+++ b/recipes-test/ddt-runner/files/scripts/keystone-evm/flash
@@ -0,0 +1,49 @@
1#!/bin/sh
2#
3# This script is used to test flash driver functionality. I removed the write
4# operations since all partition are in use in keystone-evm and there might be
5# possibility of corrupting data even if we backup in test script.
6
7if part_num=`cat /proc/mtd | grep -c 'mtd'`; then
8 echo "PASS: show $part_num partitions"
9else
10 echo "FAIL: show $part_num partitions"
11 exit 1
12fi
13
14for((part=0; part<$part_num; part++));
15do
16 if [ $(mtd_debug info /dev/mtd$part | grep -c 'mtd.type') ]; then
17 echo "PASS: show partition $part debug info"
18 else
19 echo "FAIL: show partition $part debug info"
20 exit 1
21 fi
22done
23
24READ_TEST=`find / -name mtd_readtest.ko -print`
25
26if [ ! -e $READ_TEST ]; then
27 echo "FAIL: $READ_TEST does not exist"
28 exit 1
29else
30 echo "PASS: $READ_TEST exists"
31fi
32
33for((part=0; part<$part_num; part++));
34do
35 dmesg -c
36
37 insmod $READ_TEST dev=$part
38
39 finish=`dmesg | grep -c 'mtd_readtest: finished'`
40 if [ $finish -eq 1 ]; then
41 echo "PASS: read test $part"
42 else
43 echo "FAIL: read test $part"
44 rmmod $READ_TEST
45 exit 1
46 fi
47
48 rmmod $READ_TEST
49done
diff --git a/recipes-test/ddt-runner/files/scripts/keystone-evm/i2c b/recipes-test/ddt-runner/files/scripts/keystone-evm/i2c
new file mode 100755
index 0000000..fd033bc
--- /dev/null
+++ b/recipes-test/ddt-runner/files/scripts/keystone-evm/i2c
@@ -0,0 +1,44 @@
1#!/bin/sh
2# This script is used to test i2c bus functionality for keystone-evm board.
3
4if I2C_ADAPTERS=$(i2cdetect -l |wc -l); then
5 echo "PASS: found $I2C_ADAPTERS i2c adapters"
6else
7 echo "FAIL: no i2c adapters found"
8 exit 1
9fi
10
11if [ -z "$adapters" ]; then
12 adapters=0
13fi
14
15while [ $adapters -lt $I2C_ADAPTERS ]
16do
17 i2cdetect -y $adapters
18 if [ $? -ne 0 ]; then
19 echo "FAIL: detect i2c adapter $adapters failed"
20 else
21 echo "PASS: detect i2c adapter $adapters success"
22 fi
23 adapters=`expr $adapters + 1`
24 sleep 1
25done
26
27i2cdetect -y 0
28if [ $? -ne 0 ]; then
29 echo "FAIL: detect i2c bus 0 fail"
30 exit 1
31else
32 echo "PASS: detect i2c bus 0 success"
33fi
34
35#i2c bus 0, device address 0x52, DDR3 DIMM Socket 1, SPD EEPROM
36i2cdump -f -y 0 0x52 |grep UG51U6400N8SU
37if [ $? -ne 0 ]; then
38 echo "FAIL: read SPD EEPROM on i2c bus 0 fail"
39 exit 1
40else
41 echo "PASS: read SPD EEPROM on i2c bus 0 success"
42fi
43
44
diff --git a/recipes-test/ddt-runner/files/scripts/keystone-evm/spi b/recipes-test/ddt-runner/files/scripts/keystone-evm/spi
new file mode 100755
index 0000000..bcebef9
--- /dev/null
+++ b/recipes-test/ddt-runner/files/scripts/keystone-evm/spi
@@ -0,0 +1,48 @@
1#!/bin/sh
2
3#An spi flash M25P80 connect to keystone-evm cpu by spi bus, so the method
4#is to read/write spi flash to verify whether the spi bus driver worked
5#or not.
6
7MTD_CHAR_DEVICE="/dev/mtd4"
8MTD_BLOCK_DEVICE="/dev/mtdblock4"
9
10if [ ! -e $MTD_CHAR_DEVICE ]; then
11 echo "FAIL: spi flash device $MTD_CHAR_DEVICE does not exist"
12 exit 1
13else
14 echo "PASS: spi flash device $MTD_CHAR_DEVICE exists"
15fi
16
17if [ ! -e $MTD_BLOCK_DEVICE ]; then
18 echo "FAIL: spi flash device $MTD_BLOCK_DEVICE does not exist"
19 exit 1
20else
21 echo "PASS: spi flash device $MTD_BLOCK_DEVICE exists"
22fi
23
24/usr/sbin/flash_erase -j $MTD_CHAR_DEVICE 0 0
25if [ $? -ne 0 ]; then
26 echo "FAIL: format spi flash device $MTD_BLOCK_DEVICE fail"
27 exit 1
28else
29 mkdir -p /mnt/spi
30 mount -t jffs2 $MTD_BLOCK_DEVICE /mnt/spi
31 if [ $? -ne 0 ]; then
32 echo "FAIL: mount spi flash device $MTD_BLOCK_DEVICE fail"
33 exit 1
34 else
35 cp /bin/busybox /mnt/spi
36 ls /mnt/spi |grep busybox
37 if [ $? -ne 0 ]; then
38 echo "FAIL: read or write spi flash device $MTD_BLOCK_DEVICE fail"
39 exit 1
40 else
41 umount $MTD_BLOCK_DEVICE
42 echo "PASS: read or write spi flash device $MTD_BLOCK_DEVICE success"
43 fi
44 fi
45fi
46
47echo "PASS: spi bus test passed"
48exit 0