diff options
Diffstat (limited to 'recipes-test/ddt-runner/files/scripts/b4860qds-64b')
5 files changed, 222 insertions, 0 deletions
diff --git a/recipes-test/ddt-runner/files/scripts/b4860qds-64b/ethernet b/recipes-test/ddt-runner/files/scripts/b4860qds-64b/ethernet new file mode 100755 index 0000000..5355f10 --- /dev/null +++ b/recipes-test/ddt-runner/files/scripts/b4860qds-64b/ethernet | |||
@@ -0,0 +1,88 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | ethernet_interface="eth1" | ||
4 | ethernet_ping_ipaddr="172.21.3.22" | ||
5 | ethernet_ipaddr=$1 | ||
6 | |||
7 | IFCONFIG=`which ifconfig` | ||
8 | |||
9 | $IFCONFIG $ethernet_interface up | ||
10 | $IFCONFIG | grep $ethernet_interface | ||
11 | if [ $? -ne 0 ]; then | ||
12 | echo "FAIL: $ethernet_interface is not up" | ||
13 | exit 1 | ||
14 | else | ||
15 | echo "PASS: $ethernet_interface is up" | ||
16 | fi | ||
17 | |||
18 | if [ "x$ethernet_ipaddr" != "x" ]; then | ||
19 | $IFCONFIG $ethernet_interface $ethernet_ipaddr | ||
20 | fi | ||
21 | |||
22 | $IFCONFIG $ethernet_interface |grep 'inet addr:' |sed -e 's@inet addr:@@' |sed q | awk '{print $1}' | ||
23 | if [ $? -ne 0 ]; then | ||
24 | echo "FAIL: ipaddr of $ethernet_interface setup failed" | ||
25 | exit 1 | ||
26 | else | ||
27 | echo "PASS: ipaddr of $ethernet_interface setup success" | ||
28 | fi | ||
29 | |||
30 | mindatasize=56 | ||
31 | maxdatasize=650 | ||
32 | stepsize=100 | ||
33 | iteration=1 | ||
34 | datasize=$mindatasize | ||
35 | logfile=`/bin/mktemp` | ||
36 | statistics=`/bin/mktemp` | ||
37 | error=0 | ||
38 | |||
39 | trap cleanup SIGHUP SIGINT SIGTERM | ||
40 | |||
41 | clean_tasks() { | ||
42 | echo "Executing clean up tasks" | ||
43 | rm -f $logfile $statistics | ||
44 | } | ||
45 | |||
46 | cleanup() { | ||
47 | echo "Aborting script execution" | ||
48 | clean_tasks | ||
49 | exit 0 | ||
50 | } | ||
51 | |||
52 | echo "start ping test for $ethernet_interface..." | ||
53 | |||
54 | while [ $datasize -le $maxdatasize ]; do | ||
55 | for i in `seq 1 $iteration`; do | ||
56 | ping -c 1 -s $datasize $ethernet_ping_ipaddr > $statistics | ||
57 | ping_err=`echo $?` | ||
58 | echo "" && cat $statistics | grep -r "PING" | ||
59 | cat $statistics | grep -r "received" | ||
60 | [ `echo $?` -eq 0 ] || packets_received=0 && \ | ||
61 | packets_received=`cat $statistics | \ | ||
62 | grep -r "received" | awk '{print$4}'` | ||
63 | |||
64 | # Evaluate possible errors on the ping operation | ||
65 | if [ $ping_err -ne 0 ] || [ $packets_received -eq 0 ]; then | ||
66 | error=1 | ||
67 | echo -e `cat $statistics | grep -r PING` >> $logfile | ||
68 | echo -e "Size: $datasize Iteration: $i\n" >> $logfile | ||
69 | fi | ||
70 | done | ||
71 | let datasize=$datasize+$stepsize | ||
72 | done | ||
73 | |||
74 | # Report failures | ||
75 | if [ $error -eq 1 ]; then | ||
76 | echo -e "=================== error report ===================\n" | ||
77 | cat $logfile | ||
78 | echo -e "====================================================\n" | ||
79 | clean_tasks | ||
80 | echo -e "FAIL: ping test for $ethernet_interface failed\n" | ||
81 | exit 1 | ||
82 | else | ||
83 | clean_tasks | ||
84 | echo -e "PASS: ping test for $ethernet_interface success\n" | ||
85 | fi | ||
86 | |||
87 | echo "PASS: $ethernet_interface test passed" | ||
88 | exit 0 | ||
diff --git a/recipes-test/ddt-runner/files/scripts/b4860qds-64b/flash b/recipes-test/ddt-runner/files/scripts/b4860qds-64b/flash new file mode 100755 index 0000000..5728b73 --- /dev/null +++ b/recipes-test/ddt-runner/files/scripts/b4860qds-64b/flash | |||
@@ -0,0 +1,20 @@ | |||
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 b4860qds-64b and there might be | ||
5 | # possibility of corrupting data even if we backup in test script. | ||
6 | |||
7 | if part_num=`cat /proc/mtd | grep -c 'mtd'`; then | ||
8 | echo "PASS: show $part_num partitions" | ||
9 | else | ||
10 | echo "FAIL: show $part_num partitions" | ||
11 | fi | ||
12 | |||
13 | for((part=0; part<$part_num-1; part++)); | ||
14 | do | ||
15 | if [ $(mtd_debug info /dev/mtd$part | grep -c 'mtd.type') ]; then | ||
16 | echo "PASS: show partition $part debug info" | ||
17 | else | ||
18 | echo "FAIL: show partition $part debug info" | ||
19 | fi | ||
20 | done | ||
diff --git a/recipes-test/ddt-runner/files/scripts/b4860qds-64b/i2c b/recipes-test/ddt-runner/files/scripts/b4860qds-64b/i2c new file mode 100755 index 0000000..5b312b9 --- /dev/null +++ b/recipes-test/ddt-runner/files/scripts/b4860qds-64b/i2c | |||
@@ -0,0 +1,24 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | if I2C_ADAPTERS=$(i2cdetect -l |wc -l); then | ||
4 | echo "PASS: found $I2C_ADAPTERS i2c adapters" | ||
5 | else | ||
6 | echo "FAIL: no i2c adapters found" | ||
7 | exit 1 | ||
8 | fi | ||
9 | |||
10 | if [ -z "$adapters" ]; then | ||
11 | adapters=0 | ||
12 | fi | ||
13 | |||
14 | while [ $adapters -lt $I2C_ADAPTERS ] | ||
15 | do | ||
16 | i2cdetect -y $adapters | ||
17 | if [ $? -ne 0 ]; then | ||
18 | echo "FAIL: detect i2c adapter $adapters failed" | ||
19 | else | ||
20 | echo "PASS: detect i2c adapter $adapters success" | ||
21 | fi | ||
22 | adapters=`expr $adapters + 1` | ||
23 | sleep 1 | ||
24 | done | ||
diff --git a/recipes-test/ddt-runner/files/scripts/b4860qds-64b/rtc b/recipes-test/ddt-runner/files/scripts/b4860qds-64b/rtc new file mode 100755 index 0000000..0d38293 --- /dev/null +++ b/recipes-test/ddt-runner/files/scripts/b4860qds-64b/rtc | |||
@@ -0,0 +1,42 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | RTC_DEVICE="/dev/rtc" | ||
4 | |||
5 | if [ ! -e $RTC_DEVICE ]; then | ||
6 | echo "FAIL: rtc device does not exist" | ||
7 | exit 1 | ||
8 | else | ||
9 | echo "PASS: rtc device exists" | ||
10 | fi | ||
11 | |||
12 | /sbin/hwclock -f $RTC_DEVICE | ||
13 | if [ $? -ne 0 ]; then | ||
14 | echo "FAIL: rtc device open failed" | ||
15 | exit 1 | ||
16 | else | ||
17 | echo "PASS: rtc device open success" | ||
18 | fi | ||
19 | |||
20 | |||
21 | /sbin/hwclock --systohc | ||
22 | if [ $? -ne 0 ]; then | ||
23 | echo "FAIL: sync system clock and hardware clock failed" | ||
24 | exit 1 | ||
25 | else | ||
26 | echo "PASS: sync system clock and hardware clock success" | ||
27 | fi | ||
28 | |||
29 | RTC_TIME=$(/sbin/hwclock -r |awk '{print $4}') | ||
30 | echo $RTC_TIME | ||
31 | SYS_TIME=$(date +%m/%d/%Y-%X |awk '{print $1}' |awk -F- '{print $2}') | ||
32 | echo $SYS_TIME | ||
33 | |||
34 | if [ "$RTC_TIME" = "$SYS_TIME" ] ; then | ||
35 | echo "PASS: system time same with hardware time" | ||
36 | else | ||
37 | echo "FAIL: system time different with hardware time" | ||
38 | exit 1 | ||
39 | fi | ||
40 | |||
41 | echo "PASS: rtc test successful" | ||
42 | exit 0 | ||
diff --git a/recipes-test/ddt-runner/files/scripts/b4860qds-64b/spi b/recipes-test/ddt-runner/files/scripts/b4860qds-64b/spi new file mode 100755 index 0000000..b03431e --- /dev/null +++ b/recipes-test/ddt-runner/files/scripts/b4860qds-64b/spi | |||
@@ -0,0 +1,48 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | #An spi flash M25P80 connect to b4860qds-64b 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 | |||
7 | MTD_CHAR_DEVICE="/dev/mtd4" | ||
8 | MTD_BLOCK_DEVICE="/dev/mtdblock4" | ||
9 | |||
10 | if [ ! -e $MTD_CHAR_DEVICE ]; then | ||
11 | echo "FAIL: spi flash device $MTD_CHAR_DEVICE does not exist" | ||
12 | exit 1 | ||
13 | else | ||
14 | echo "PASS: spi flash device $MTD_CHAR_DEVICE exists" | ||
15 | fi | ||
16 | |||
17 | if [ ! -e $MTD_BLOCK_DEVICE ]; then | ||
18 | echo "FAIL: spi flash device $MTD_BLOCK_DEVICE does not exist" | ||
19 | exit 1 | ||
20 | else | ||
21 | echo "PASS: spi flash device $MTD_BLOCK_DEVICE exists" | ||
22 | fi | ||
23 | |||
24 | /usr/sbin/flash_erase -j $MTD_CHAR_DEVICE 0 0 | ||
25 | if [ $? -ne 0 ]; then | ||
26 | echo "FAIL: format spi flash device $MTD_BLOCK_DEVICE fail" | ||
27 | exit 1 | ||
28 | else | ||
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 | ||
45 | fi | ||
46 | |||
47 | echo "PASS: spi bus test passed" | ||
48 | exit 0 | ||