summaryrefslogtreecommitdiffstats
path: root/recipes-test/ddt-runner/files/scripts/acp3448v2
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-test/ddt-runner/files/scripts/acp3448v2')
-rwxr-xr-xrecipes-test/ddt-runner/files/scripts/acp3448v2/ethernet97
-rwxr-xr-xrecipes-test/ddt-runner/files/scripts/acp3448v2/flash45
-rwxr-xr-xrecipes-test/ddt-runner/files/scripts/acp3448v2/pci-express109
-rwxr-xr-xrecipes-test/ddt-runner/files/scripts/acp3448v2/usb100
4 files changed, 351 insertions, 0 deletions
diff --git a/recipes-test/ddt-runner/files/scripts/acp3448v2/ethernet b/recipes-test/ddt-runner/files/scripts/acp3448v2/ethernet
new file mode 100755
index 0000000..10a16b4
--- /dev/null
+++ b/recipes-test/ddt-runner/files/scripts/acp3448v2/ethernet
@@ -0,0 +1,97 @@
1#!/bin/sh
2#
3# This script is used to test ethernet functionality for acp3448v2.
4#
5
6ethernet_interface="eth0"
7ethernet_ping_ipaddr="172.21.3.22"
8ethernet_ipaddr=$1
9
10IFCONFIG=`which ifconfig`
11
12for((num=0; num<16; num++));
13do
14 ethernet_interface=eth$num
15 $IFCONFIG $ethernet_interface up
16 $IFCONFIG | grep $ethernet_interface
17 if [ $? -eq 0 ]; then
18 echo "PASS: $ethernet_interface is up"
19 break
20 fi
21done
22
23if [ $num -eq 16 ]; then
24 echo "FAIL: $ethernet_interface is not up"
25 exit 1
26fi
27
28if [ "x$ethernet_ipaddr" != "x" ]; then
29 $IFCONFIG $ethernet_interface $ethernet_ipaddr
30fi
31
32$IFCONFIG $ethernet_interface |grep 'inet addr:' |sed -e 's@inet addr:@@' |sed q | awk '{print $1}'
33if [ $? -ne 0 ]; then
34 echo "FAIL: ipaddr of $ethernet_interface setup failed"
35 exit 1
36else
37 echo "PASS: ipaddr of $ethernet_interface setup success"
38fi
39
40mindatasize=56
41maxdatasize=650
42stepsize=100
43iteration=1
44datasize=$mindatasize
45logfile=`/bin/mktemp`
46statistics=`/bin/mktemp`
47error=0
48
49trap cleanup SIGHUP SIGINT SIGTERM
50
51clean_tasks() {
52 echo "Executing clean up tasks"
53 rm -f $logfile $statistics
54}
55
56cleanup() {
57 echo "Aborting script execution"
58 clean_tasks
59 exit 0
60}
61
62echo "start ping test for $ethernet_interface..."
63
64while [ $datasize -le $maxdatasize ]; do
65 for i in `seq 1 $iteration`; do
66 ping -c 1 -s $datasize $ethernet_ping_ipaddr > $statistics
67 ping_err=`echo $?`
68 echo "" && cat $statistics | grep -r "PING"
69 cat $statistics | grep -r "received"
70 [ `echo $?` -eq 0 ] || packets_received=0 && \
71 packets_received=`cat $statistics | \
72 grep -r "received" | awk '{print$4}'`
73
74 # Evaluate possible errors on the ping operation
75 if [ $ping_err -ne 0 ] || [ $packets_received -eq 0 ]; then
76 error=1
77 echo -e `cat $statistics | grep -r PING` >> $logfile
78 echo -e "Size: $datasize Iteration: $i\n" >> $logfile
79 fi
80 done
81 let datasize=$datasize+$stepsize
82done
83
84# Report failures
85if [ $error -eq 1 ]; then
86 echo -e "=================== error report ===================\n"
87 cat $logfile
88 echo -e "====================================================\n"
89 clean_tasks
90 echo -e "FAIL: ping test for $ethernet_interface failed\n"
91 exit 1
92else
93 clean_tasks
94 echo -e "PASS: ping test for $ethernet_interface success\n"
95fi
96
97echo "PASS: $ethernet_interface test passed" exit 0
diff --git a/recipes-test/ddt-runner/files/scripts/acp3448v2/flash b/recipes-test/ddt-runner/files/scripts/acp3448v2/flash
new file mode 100755
index 0000000..30c5d06
--- /dev/null
+++ b/recipes-test/ddt-runner/files/scripts/acp3448v2/flash
@@ -0,0 +1,45 @@
1#!/bin/sh
2#
3# This script is used to test flash driver function.
4
5if part_num=`cat /proc/mtd | grep -c 'mtd'`; then
6 echo "PASS: show $part_num partitions"
7else
8 echo "FAIL: show $part_num partitions"
9fi
10
11for((part=0; part<$part_num-1; part++));
12do
13 if [ $(mtd_debug info /dev/mtd$part | grep -c 'mtd.type') ]; then
14 echo "PASS: show partition $part debug info"
15 else
16 echo "FAIL: show partition $part debug info"
17 fi
18done
19
20let "test_part=part_num-2"
21
22if [ $(flash_erase -j /dev/mtd${test_part} 0 0 | grep -c '100 % complete') ]; then
23 echo "PASS: erase and format partition ${test_part}"
24else
25 echo "FAIL: erase and format partition ${test_part}"
26fi
27
28mkdir -p /mnt/flash
29mount -t jffs2 /dev/mtdblock${test_part} /mnt/flash
30if [ $? -eq 0 ]; then
31 echo "PASS: mount partition ${test_part} as /mnt/flash"
32else
33 echo "FAIL: mount partition ${test_part} as /mnt/flash"
34fi
35
36cd /mnt/flash
37touch test
38if [ $(ls | grep -c 'test') ]; then
39 echo "PASS: touch a file on partition ${test_part}"
40else
41 echo "FAIL: touch a file on partition ${test_part}"
42fi
43
44cd ~
45umount /mnt/flash
diff --git a/recipes-test/ddt-runner/files/scripts/acp3448v2/pci-express b/recipes-test/ddt-runner/files/scripts/acp3448v2/pci-express
new file mode 100755
index 0000000..b04485f
--- /dev/null
+++ b/recipes-test/ddt-runner/files/scripts/acp3448v2/pci-express
@@ -0,0 +1,109 @@
1#!/bin/sh
2
3ethernet_interface="eth0"
4ethernet_ping_ipaddr="172.21.3.22"
5ethernet_ipaddr=$1
6
7#Intel Corporation 82574L Gigabit Network Card (intel e1000e)
8vendor_id="8086"
9product_id="10d3"
10
11#find vendor id & product id
12lspci -nn |grep $vendor_id:$product_id
13if [ $? -ne 0 ]; then
14 echo "FAIL: pci-e ethernet card device does not exist"
15 exit 1
16else
17 echo "PASS: got pci-e ethernet card device"
18fi
19
20setpci -v -d $vendor_id:$product_id latency_timer=b0
21if [ $? -ne 0 ]; then
22 echo "FAIL: parameter changes to pci config space failed"
23 exit 1
24else
25 echo "PASS: parameter changes to pci config space success"
26fi
27
28IFCONFIG=`which ifconfig`
29
30$IFCONFIG $ethernet_interface up
31$IFCONFIG | grep $ethernet_interface
32if [ $? -ne 0 ]; then
33 echo "FAIL: pci-e ethernet card device $ethernet_interface is not up"
34 exit 1
35else
36 echo "PASS: pci-e ethernet card device $ethernet_interface is up"
37fi
38
39if [ "x$ethernet_ipaddr" != "x" ]; then
40 $IFCONFIG $ethernet_interface $ethernet_ipaddr
41fi
42
43$IFCONFIG $ethernet_interface |grep 'inet addr:' |sed -e 's@inet addr:@@' |sed q | awk '{print $1}'
44if [ $? -ne 0 ]; then
45 echo "FAIL: ipaddr of pci-e ethernet card device $ethernet_interface setup failed"
46 exit 1
47else
48 echo "PASS: ipaddr of pci-e ethernet card device $ethernet_interface setup success"
49fi
50
51mindatasize=56
52maxdatasize=650
53stepsize=100
54iteration=1
55datasize=$mindatasize
56logfile=`/bin/mktemp`
57statistics=`/bin/mktemp`
58error=0
59
60trap cleanup SIGHUP SIGINT SIGTERM
61
62clean_tasks() {
63 echo "Executing clean up tasks"
64 rm -f $logfile $statistics
65}
66
67cleanup() {
68 echo "Aborting script execution"
69 clean_tasks
70 exit 0
71}
72
73echo "start ping test for pci-e ethernet card device $ethernet_interface..."
74
75while [ $datasize -le $maxdatasize ]; do
76 for i in `seq 1 $iteration`; do
77 ping -c 1 -s $datasize $ethernet_ping_ipaddr > $statistics
78 ping_err=`echo $?`
79 echo "" && cat $statistics | grep -r "PING"
80 cat $statistics | grep -r "received"
81 [ `echo $?` -eq 0 ] || packets_received=0 && \
82 packets_received=`cat $statistics | \
83 grep -r "received" | awk '{print$4}'`
84
85 # Evaluate possible errors on the ping operation
86 if [ $ping_err -ne 0 ] || [ $packets_received -eq 0 ]; then
87 error=1
88 echo -e `cat $statistics | grep -r PING` >> $logfile
89 echo -e "Size: $datasize Iteration: $i\n" >> $logfile
90 fi
91 done
92 let datasize=$datasize+$stepsize
93done
94
95# Report failures
96if [ $error -eq 1 ]; then
97 echo -e "=================== error report ===================\n"
98 cat $logfile
99 echo -e "====================================================\n"
100 clean_tasks
101 echo -e "FAIL: ping test for pci-e ethernet card device $ethernet_interface failed\n"
102 exit 1
103else
104 clean_tasks
105 echo -e "PASS: ping test for pci-e ethernet card device $ethernet_interface success\n"
106fi
107
108echo "PASS: pci express test passed"
109exit 0
diff --git a/recipes-test/ddt-runner/files/scripts/acp3448v2/usb b/recipes-test/ddt-runner/files/scripts/acp3448v2/usb
new file mode 100755
index 0000000..aad0226
--- /dev/null
+++ b/recipes-test/ddt-runner/files/scripts/acp3448v2/usb
@@ -0,0 +1,100 @@
1#!/bin/sh
2#
3# This script is used to test usb functionality for acp3448v2.
4#
5
6result=0
7devpath=""
8usbinfo=""
9
10usbutils_is_installed=`which lsusb`
11if [ -z $usbutils_is_installed ]; then
12 echo "FAIL: Cannot find lsusb"
13 exit 1
14fi
15
16usbdev_num=`lsusb | grep -v root\ hub | wc -l`
17if [ $usbdev_num -eq 0 ]; then
18 echo "FAIL: USB device is not connected"
19 exit 1
20else
21 echo "$usbdev_num USB device(s) connected"
22fi
23
24sd=`ls -l /dev/sd[^0-9] | awk '{print $5 $6 "," $10}'`
25if [ -z "$sd" ]; then
26 echo "FAIL: find sd device"
27 exit 1
28else
29 echo "PASS: find sd device"
30fi
31
32HDPARM=`which hdparm`
33if [ -z $HDPARM ]; then
34 result=$?
35 echo "FAIL: find hdparm"
36fi
37 echo "PASS: find hdparm"
38
39for s in $sd
40do
41 devpath=`echo "$s" | awk -F "," '{print "/sys/dev/block/" $1 ":" $2}'`
42 usbinfo=`ls -l $devpath | grep usb`
43
44 if [ -z "$usbinfo" ] ; then
45 continue
46 fi
47
48 s=`echo "$s" | awk -F "," '{print $3}'`
49
50 echo "Testing $s"
51 $HDPARM -I $s
52 if [ $? -ne 0 ]; then
53 result=$?
54 echo "FAIL: $HDPARM -I $s Detailed/current information directly from $s"
55 else
56 echo "PASS: $HDPARM -I $s Detailed/current information directly from $s"
57 fi
58
59 $HDPARM -tT $s
60 if [ $? -ne 0 ]; then
61 result=$?
62 echo "FAIL: $HDPARM -tT $s Perform device/cache read timings on $s"
63 else
64 echo "PASS: $HDPARM -tT $s Perform device/cache read timings on $s"
65 fi
66
67 mkdir -p /mnt/usb_tmp
68 for partition in `ls "$s"[1-9]`
69 do
70 echo "Testing $partition"
71
72 mount "$partition" /mnt/usb_tmp
73 if [ $? -ne 0 ]; then
74 result=$?
75 echo "FAIL: mount $s"
76 else
77 echo "PASS: mount $s"
78 dd if=/dev/urandom of=/mnt/usb_tmp/writefile bs=1M count=50
79 if [ $? -ne 0 ]; then
80 result=$?
81 echo "FAIL: write test on $s"
82 else
83 echo "PASS: write test on $s"
84 rm -f /mnt/usb_tmp/writefile
85 fi
86 dd if=$s of=/mnt/usb_tmp/readfile bs=1M count=10
87 if [ $? -ne 0 ]; then
88 result=$?
89 echo "FAIL: read test on $s"
90 else
91 echo "PASS: read test on $s"
92 rm -f /mnt/usb_tmp/readfile
93 fi
94 umount /mnt/usb_tmp
95 fi
96 done
97
98 rm -fr /mnt/usb_tmp
99done
100exit $result