diff options
author | Bogdan Oprescu <bogdan.oprescu@enea.com> | 2023-11-15 11:09:08 +0200 |
---|---|---|
committer | Bogdan Oprescu <bogdan.oprescu@enea.com> | 2023-11-16 14:26:36 +0200 |
commit | 6da9d81e77b2f56a91a697ac474473e787a58ccf (patch) | |
tree | 170e6a5acc14673fc466a7405d7cc35673bed507 /recipes-test/ddt-runner/files/scripts/t1042rdb/ethernet | |
parent | 2283105d0abe9efa216b018e0d34100e4544ce78 (diff) | |
download | meta-enea-daisy-enea-231026.tar.gz |
T1042RDB: Adding ddt testsdaisy-enea-231026
Signed-off-by: Bogdan Oprescu <bogdan.oprescu@enea.com>
Diffstat (limited to 'recipes-test/ddt-runner/files/scripts/t1042rdb/ethernet')
-rwxr-xr-x | recipes-test/ddt-runner/files/scripts/t1042rdb/ethernet | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/recipes-test/ddt-runner/files/scripts/t1042rdb/ethernet b/recipes-test/ddt-runner/files/scripts/t1042rdb/ethernet new file mode 100755 index 0000000..107d102 --- /dev/null +++ b/recipes-test/ddt-runner/files/scripts/t1042rdb/ethernet | |||
@@ -0,0 +1,83 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | ethernet_interface="eth3" | ||
4 | ethernet_ping_ipaddr="172.21.3.22" | ||
5 | ethernet_ipaddr=$1 | ||
6 | |||
7 | IFCONFIG=`which ifconfig` | ||
8 | |||
9 | $IFCONFIG $ethernet_interface up > /dev/null 2>&1 | ||
10 | $IFCONFIG | grep $ethernet_interface > /dev/null 2>&1 | ||
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}' >/dev/null 2>&1 | ||
23 | if [ $? -ne 0 ]; then | ||
24 | echo "FAIL: setup $ethernet_interface ipaddr failed" | ||
25 | exit 1 | ||
26 | else | ||
27 | echo "PASS: setup $ethernet_interface ipaddr succeeded" | ||
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 | rm -f $logfile $statistics | ||
43 | } | ||
44 | |||
45 | cleanup() { | ||
46 | echo "Aborting script execution" | ||
47 | clean_tasks | ||
48 | exit 0 | ||
49 | } | ||
50 | |||
51 | while [ $datasize -le $maxdatasize ]; do | ||
52 | for i in `seq 1 $iteration`; do | ||
53 | ping -c 1 -s $datasize $ethernet_ping_ipaddr > $statistics | ||
54 | ping_err=$? | ||
55 | cat $statistics | grep "PING" > /dev/null 2>&1 | ||
56 | cat $statistics | grep "received" > /dev/null 2>&1 | ||
57 | [ `echo $?` -eq 0 ] || packets_received=0 && \ | ||
58 | packets_received=`cat $statistics | \ | ||
59 | grep "received" | awk '{print$4}'` | ||
60 | |||
61 | # Evaluate possible errors on the ping operation | ||
62 | if [ $ping_err -ne 0 ] || [ $packets_received -eq 0 ]; then | ||
63 | error=1 | ||
64 | echo -e `cat $statistics | grep PING` >> $logfile 2>/dev/null | ||
65 | fi | ||
66 | done | ||
67 | let datasize=$datasize+$stepsize | ||
68 | done | ||
69 | |||
70 | # Report failures | ||
71 | if [ $error -eq 1 ]; then | ||
72 | echo "=================== error report ===================" | ||
73 | cat $logfile | ||
74 | echo "====================================================" | ||
75 | clean_tasks | ||
76 | echo -e "FAIL: $ethernet_interface test failed\n" | ||
77 | exit 1 | ||
78 | else | ||
79 | clean_tasks | ||
80 | echo -e "PASS: $ethernet_interface test passed" | ||
81 | fi | ||
82 | |||
83 | exit 0 | ||