diff options
author | Adrian Dudau <adrian.dudau@enea.com> | 2013-12-12 17:36:38 +0100 |
---|---|---|
committer | Adrian Dudau <adrian.dudau@enea.com> | 2013-12-12 17:36:38 +0100 |
commit | 2a7348129a42f21095fcd62e47a035f78d254130 (patch) | |
tree | 544dc8019a8f8cb684ace8674193605e607f9964 /recipes-test/ddt-runner/files/scripts/bsc9131rdb | |
download | meta-enea-master.tar.gz |
Migrated from the internal git server on the dora-enea branch
Signed-off-by: Adrian Dudau <adrian.dudau@enea.com>
Diffstat (limited to 'recipes-test/ddt-runner/files/scripts/bsc9131rdb')
6 files changed, 365 insertions, 0 deletions
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 @@ | |||
1 | #!/bin/sh | ||
2 | # This script is used to test ethernet interface for bsc9131rdb. | ||
3 | |||
4 | ethernet_interface="eth0" | ||
5 | ethernet_ping_ipaddr="172.21.3.22" | ||
6 | ethernet_ipaddr=$1 | ||
7 | |||
8 | IFCONFIG=`which ifconfig` | ||
9 | |||
10 | $IFCONFIG $ethernet_interface up | ||
11 | $IFCONFIG | grep $ethernet_interface | ||
12 | if [ $? -ne 0 ]; then | ||
13 | echo "FAIL: $ethernet_interface is not up" | ||
14 | exit 1 | ||
15 | else | ||
16 | echo "PASS: $ethernet_interface is up" | ||
17 | fi | ||
18 | |||
19 | if [ "x$ethernet_ipaddr" != "x" ]; then | ||
20 | $IFCONFIG $ethernet_interface $ethernet_ipaddr | ||
21 | fi | ||
22 | |||
23 | $IFCONFIG $ethernet_interface |grep 'inet addr:' |sed -e 's@inet addr:@@' |sed q | awk '{print $1}' | ||
24 | if [ $? -ne 0 ]; then | ||
25 | echo "FAIL: ipaddr of $ethernet_interface setup failed" | ||
26 | exit 1 | ||
27 | else | ||
28 | echo "PASS: ipaddr of $ethernet_interface setup success" | ||
29 | fi | ||
30 | |||
31 | mindatasize=56 | ||
32 | maxdatasize=650 | ||
33 | stepsize=100 | ||
34 | iteration=1 | ||
35 | datasize=$mindatasize | ||
36 | logfile=`/bin/mktemp` | ||
37 | statistics=`/bin/mktemp` | ||
38 | error=0 | ||
39 | |||
40 | trap cleanup SIGHUP SIGINT SIGTERM | ||
41 | |||
42 | clean_tasks() { | ||
43 | echo "Executing clean up tasks" | ||
44 | rm -f $logfile $statistics | ||
45 | } | ||
46 | |||
47 | cleanup() { | ||
48 | echo "Aborting script execution" | ||
49 | clean_tasks | ||
50 | exit 0 | ||
51 | } | ||
52 | |||
53 | echo "start ping test for $ethernet_interface..." | ||
54 | |||
55 | while [ $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 | ||
73 | done | ||
74 | |||
75 | # Report failures | ||
76 | if [ $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 | ||
83 | else | ||
84 | clean_tasks | ||
85 | echo -e "PASS: ping test for $ethernet_interface success\n" | ||
86 | fi | ||
87 | |||
88 | echo "PASS: $ethernet_interface test passed" | ||
89 | 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 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # This script is used to test flash driver functionality. I removed the tests | ||
4 | # which include write operations since all partition are in use in bsc9131rdb | ||
5 | # and there might be possibility of corrupting data even if we backup in test | ||
6 | # script. | ||
7 | |||
8 | if part_num=`cat /proc/mtd | grep -c 'mtd'`; then | ||
9 | echo "PASS: $part_num partitions found" | ||
10 | else | ||
11 | echo "FAIL: $part_num partitions found" | ||
12 | exit 1 | ||
13 | fi | ||
14 | |||
15 | for((part=0; part<$part_num; part++)); | ||
16 | do | ||
17 | if [ $(mtd_debug info /dev/mtd$part | grep -c 'mtd.type') ]; then | ||
18 | echo "PASS: show partition $part debug info" | ||
19 | else | ||
20 | echo "FAIL: show partition $part debug info" | ||
21 | exit 1 | ||
22 | fi | ||
23 | done | ||
24 | |||
25 | READ_TEST=`find / -name mtd_readtest.ko -print` | ||
26 | |||
27 | if [ ! -e $READ_TEST ]; then | ||
28 | echo "FAIL: $READ_TEST does not exist" | ||
29 | exit 1 | ||
30 | else | ||
31 | echo "PASS: $READ_TEST exists" | ||
32 | fi | ||
33 | |||
34 | for((part=0; part<$part_num; part++)); | ||
35 | do | ||
36 | dmesg -c > NULL | ||
37 | |||
38 | modprobe $READ_TEST dev=$part | ||
39 | |||
40 | bad_num=`dmesg | grep -c 'bad'` | ||
41 | if [ $bad_num -eq 0 ]; then | ||
42 | echo "PASS: read test for partition $part" | ||
43 | else | ||
44 | echo "FAIL: read test for partition $part" | ||
45 | fi | ||
46 | |||
47 | rmmod $READ_TEST | ||
48 | 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 @@ | |||
1 | #!/bin/sh | ||
2 | # This script is used to test i2c interface for bsc9131rdb | ||
3 | |||
4 | I2C_DETECT=`which i2cdetect` | ||
5 | if [ "x$I2C_DETECT" != "x" ]; then | ||
6 | echo "PASS: i2cdetect found" | ||
7 | else | ||
8 | echo "FAIL: i2cdetect not found" | ||
9 | exit 1 | ||
10 | fi | ||
11 | |||
12 | I2C_SET=`which i2cset` | ||
13 | if [ "x$I2C_SET" != "x" ]; then | ||
14 | echo "PASS: i2cset found" | ||
15 | else | ||
16 | echo "FAIL: i2cset not found" | ||
17 | exit 1 | ||
18 | fi | ||
19 | |||
20 | I2C_GET=`which i2cget` | ||
21 | if [ "x$I2C_GET" != "x" ]; then | ||
22 | echo "PASS: i2cget found" | ||
23 | else | ||
24 | echo "FAIL: i2cget not found" | ||
25 | exit 1 | ||
26 | fi | ||
27 | |||
28 | if I2C_ADAPTERS=`$I2C_DETECT -l |wc -l`; then | ||
29 | echo "PASS: $I2C_ADAPTERS i2c adapters found" | ||
30 | else | ||
31 | echo "FAIL: no i2c adapters found" | ||
32 | exit 1 | ||
33 | fi | ||
34 | |||
35 | adapters=0 | ||
36 | while [ $adapters -lt $I2C_ADAPTERS ] | ||
37 | do | ||
38 | $I2C_DETECT -y $adapters | ||
39 | if [ $? -ne 0 ]; then | ||
40 | echo "FAIL: detect i2c adapter $adapters fail" | ||
41 | else | ||
42 | echo "PASS: detect i2c adapter $adapters success" | ||
43 | fi | ||
44 | adapters=`expr $adapters + 1` | ||
45 | sleep 1 | ||
46 | done | ||
47 | |||
48 | # Area of bus:i2c-0 addr:0x52 is free to read and write | ||
49 | $I2C_SET -y 0 0x52 0 0x55 | ||
50 | if [ $? -eq 0 ]; then | ||
51 | echo "PASS: i2c_set -y 0 0x52 0 0x55 success" | ||
52 | else | ||
53 | echo "FAIL: i2c_set -y 0 0x52 0 0x55 fail" | ||
54 | fi | ||
55 | |||
56 | num=`$I2C_GET -y 0 0x52 0 | grep -c '0x55'` | ||
57 | if [ $num -eq 1 ]; then | ||
58 | echo "PASS: i2c_get -y 0 0x52 0 success" | ||
59 | else | ||
60 | echo "FAIL: i2c_get -y 0 0x52 0 fail" | ||
61 | fi | ||
62 | |||
63 | $I2C_SET -y 0 0x52 0 0xaa | ||
64 | if [ $? -eq 0 ]; then | ||
65 | echo "PASS: i2c_set -y 0 0x52 0 0xaa success" | ||
66 | else | ||
67 | echo "FAIL: i2c_set -y 0 0x52 0 0xaa fail" | ||
68 | fi | ||
69 | |||
70 | num=`$I2C_GET -y 0 0x52 0 | grep -c '0xaa'` | ||
71 | if [ $num -eq 1 ]; then | ||
72 | echo "PASS: i2c_get -y 0 0x52 0 success" | ||
73 | else | ||
74 | echo "FAIL: i2c_get -y 0 0x52 0 fail" | ||
75 | 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 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | #This script is to test PREEMPT RT on target | ||
4 | # | ||
5 | |||
6 | uname -a | grep "PREEMPT RT" | ||
7 | if [ $? -ne 0 ]; then | ||
8 | echo "FAIL: The kernel include real-time patch" | ||
9 | echo 1 | ||
10 | fi | ||
11 | echo "PASS: The kernel include real-time patch" | ||
12 | |||
13 | ps | grep '\(\[irq/\)' | ||
14 | if [ $? -ne 0 ]; then | ||
15 | echo "FAIL: The IRQ handlers are treated by a patched kernel in kernel thread context." | ||
16 | exit 1 | ||
17 | fi | ||
18 | echo "PASS: The IRQ handlers are treated by a patched kernel in kernel thread context." | ||
19 | |||
20 | cyclictest -t5 -p 80 -i 10000 -l 100 | ||
21 | if [ $? -ne 0 ]; then | ||
22 | echo "FAIL: Test case: POSIX interval timer, Interval 10000 micro seconds,. 100 loops." | ||
23 | exit 1 | ||
24 | fi | ||
25 | echo "PASS: Test case: POSIX interval timer, Interval 10000 micro seconds,. 100 loops." | ||
26 | |||
27 | cyclictest -t5 -p 80 -n -i 10000 -l 100 | ||
28 | if [ $? -ne 0 ]; then | ||
29 | echo "FAIL: Test case: clock_nanosleep(TIME_ABSTIME), Interval 10000 micro seconds,. 100 loops." | ||
30 | exit 1 | ||
31 | fi | ||
32 | echo "PASS: Test case: clock_nanosleep(TIME_ABSTIME), Interval 10000 micro seconds,. 100 loops." | ||
33 | |||
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 @@ | |||
1 | #!/bin/sh | ||
2 | # This script is used to test spi flash functionality for bsc9131rdb. An spi | ||
3 | # flash M25P80 connect to bsc9131 cpu by spi bus, so the method is to read/write | ||
4 | # spi flash to verify whether the spi bus driver worked or not. | ||
5 | |||
6 | MTD_CHAR_DEVICE="/dev/mtd8" | ||
7 | MTD_BLOCK_DEVICE="/dev/mtdblock8" | ||
8 | |||
9 | FLASH_ERASE=`which flash_erase` | ||
10 | if [ "x$FLASH_ERASE" != "x" ]; then | ||
11 | echo "PASS: flash_erase found" | ||
12 | else | ||
13 | echo "FAIL: flash_erase not found" | ||
14 | exit 1 | ||
15 | fi | ||
16 | |||
17 | if [ ! -e $MTD_CHAR_DEVICE ]; then | ||
18 | echo "FAIL: spi flash device $MTD_CHAR_DEVICE does not exist" | ||
19 | exit 1 | ||
20 | else | ||
21 | echo "PASS: spi flash device $MTD_CHAR_DEVICE exists" | ||
22 | fi | ||
23 | |||
24 | if [ ! -e $MTD_BLOCK_DEVICE ]; then | ||
25 | echo "FAIL: spi flash device $MTD_BLOCK_DEVICE does not exist" | ||
26 | exit 1 | ||
27 | else | ||
28 | echo "PASS: spi flash device $MTD_BLOCK_DEVICE exists" | ||
29 | fi | ||
30 | |||
31 | $FLASH_ERASE -j $MTD_CHAR_DEVICE 0 0 | ||
32 | if [ $? -ne 0 ]; then | ||
33 | echo "FAIL: format spi flash device $MTD_BLOCK_DEVICE fail" | ||
34 | exit 1 | ||
35 | else | ||
36 | mkdir -p /mnt/spi | ||
37 | mount -t jffs2 $MTD_BLOCK_DEVICE /mnt/spi | ||
38 | if [ $? -ne 0 ]; then | ||
39 | echo "FAIL: mount spi flash device $MTD_BLOCK_DEVICE fail" | ||
40 | exit 1 | ||
41 | else | ||
42 | cp /bin/busybox /mnt/spi | ||
43 | file_num=`ls /mnt/spi |grep -c 'busybox'` | ||
44 | if [ $file_num -eq 1 ]; then | ||
45 | rm /mnt/spi/busybox | ||
46 | umount $MTD_BLOCK_DEVICE | ||
47 | echo "PASS: read or write spi flash device $MTD_BLOCK_DEVICE success" | ||
48 | else | ||
49 | echo "FAIL: read or write spi flash device $MTD_BLOCK_DEVICE fail" | ||
50 | exit 1 | ||
51 | fi | ||
52 | fi | ||
53 | fi | ||
54 | |||
55 | echo "PASS: spi bus test passed" | ||
56 | 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 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # This script is used to test watchdog functionality for bsc9131rdb. | ||
4 | |||
5 | WATCHDOG=`which watchdog` | ||
6 | if [ "x$WATCHDOG" != "x" ]; then | ||
7 | echo "PASS: watchdog found" | ||
8 | else | ||
9 | echo "FAIL: watchdog not found" | ||
10 | exit 1 | ||
11 | fi | ||
12 | |||
13 | WATCHDOG_CONF=/etc/watchdog.conf | ||
14 | if [ -f $WATCHDOG_CONF ]; then | ||
15 | echo "PASS: watchdog config file found" | ||
16 | sed -i '23,23 s/#//' $WATCHDOG_CONF | ||
17 | else | ||
18 | echo "FAIL: watchdog config file not found" | ||
19 | exit 1 | ||
20 | fi | ||
21 | |||
22 | $WATCHDOG -v /dev/watchdog | ||
23 | watchdog_thread=`ps | grep -c 'watchdog -v /dev/watchdog'` | ||
24 | if [ $watchdog_thread -eq 2 ]; then | ||
25 | echo "PASS: Watchdog daemon started successfully" | ||
26 | else | ||
27 | echo "FAIL: Failed to start watchdog daemon" | ||
28 | exit 1 | ||
29 | fi | ||
30 | |||
31 | sleep 5s | ||
32 | |||
33 | killall watchdog | ||
34 | |||
35 | retry=0 | ||
36 | while [ $retry -lt 10 ] | ||
37 | do | ||
38 | watchdog_thread=`ps | grep -c 'watchdog -v /dev/watchdog'` | ||
39 | if [ $watchdog_thread -eq 1 ]; then | ||
40 | echo "PASS: Watchdog daemon stopped successfully" | ||
41 | break; | ||
42 | fi | ||
43 | sleep 1s | ||
44 | retry=`expr $retry + 1` | ||
45 | done | ||
46 | |||
47 | if [ $retry -eq 10 ]; then | ||
48 | echo "FAIL: Failed to stop watchdog daemon" | ||
49 | fi | ||
50 | |||
51 | found=0 | ||
52 | while read line | ||
53 | do | ||
54 | result=`echo $line | grep -c 'still alive after 1 interval'` | ||
55 | if [ $result -eq 1 ]; then | ||
56 | echo "PASS: Watchdog is still alive after 1 interval" | ||
57 | found=1 | ||
58 | fi | ||
59 | done < /var/log/messages | ||
60 | |||
61 | if [ $found -eq 0 ]; then | ||
62 | echo "FAIL: Watchdog is not alive after 1 interval" | ||
63 | fi | ||
64 | |||