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/acp3448v2/ethernet | |
download | meta-enea-2a7348129a42f21095fcd62e47a035f78d254130.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/acp3448v2/ethernet')
-rwxr-xr-x | recipes-test/ddt-runner/files/scripts/acp3448v2/ethernet | 97 |
1 files changed, 97 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 | |||
6 | ethernet_interface="eth0" | ||
7 | ethernet_ping_ipaddr="172.21.3.22" | ||
8 | ethernet_ipaddr=$1 | ||
9 | |||
10 | IFCONFIG=`which ifconfig` | ||
11 | |||
12 | for((num=0; num<16; num++)); | ||
13 | do | ||
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 | ||
21 | done | ||
22 | |||
23 | if [ $num -eq 16 ]; then | ||
24 | echo "FAIL: $ethernet_interface is not up" | ||
25 | exit 1 | ||
26 | fi | ||
27 | |||
28 | if [ "x$ethernet_ipaddr" != "x" ]; then | ||
29 | $IFCONFIG $ethernet_interface $ethernet_ipaddr | ||
30 | fi | ||
31 | |||
32 | $IFCONFIG $ethernet_interface |grep 'inet addr:' |sed -e 's@inet addr:@@' |sed q | awk '{print $1}' | ||
33 | if [ $? -ne 0 ]; then | ||
34 | echo "FAIL: ipaddr of $ethernet_interface setup failed" | ||
35 | exit 1 | ||
36 | else | ||
37 | echo "PASS: ipaddr of $ethernet_interface setup success" | ||
38 | fi | ||
39 | |||
40 | mindatasize=56 | ||
41 | maxdatasize=650 | ||
42 | stepsize=100 | ||
43 | iteration=1 | ||
44 | datasize=$mindatasize | ||
45 | logfile=`/bin/mktemp` | ||
46 | statistics=`/bin/mktemp` | ||
47 | error=0 | ||
48 | |||
49 | trap cleanup SIGHUP SIGINT SIGTERM | ||
50 | |||
51 | clean_tasks() { | ||
52 | echo "Executing clean up tasks" | ||
53 | rm -f $logfile $statistics | ||
54 | } | ||
55 | |||
56 | cleanup() { | ||
57 | echo "Aborting script execution" | ||
58 | clean_tasks | ||
59 | exit 0 | ||
60 | } | ||
61 | |||
62 | echo "start ping test for $ethernet_interface..." | ||
63 | |||
64 | while [ $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 | ||
82 | done | ||
83 | |||
84 | # Report failures | ||
85 | if [ $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 | ||
92 | else | ||
93 | clean_tasks | ||
94 | echo -e "PASS: ping test for $ethernet_interface success\n" | ||
95 | fi | ||
96 | |||
97 | echo "PASS: $ethernet_interface test passed" exit 0 | ||