diff options
Diffstat (limited to 'recipes-test/ddt-runner/files/scripts/p2041rdb/pci-express')
| -rwxr-xr-x | recipes-test/ddt-runner/files/scripts/p2041rdb/pci-express | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/recipes-test/ddt-runner/files/scripts/p2041rdb/pci-express b/recipes-test/ddt-runner/files/scripts/p2041rdb/pci-express new file mode 100755 index 0000000..91db286 --- /dev/null +++ b/recipes-test/ddt-runner/files/scripts/p2041rdb/pci-express | |||
| @@ -0,0 +1,109 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | ethernet_interface="eth0" | ||
| 4 | #sestord02 ip address | ||
| 5 | ethernet_ping_ipaddr="172.21.3.22" | ||
| 6 | ethernet_ipaddr=$1 | ||
| 7 | |||
| 8 | #Intel Corporation 82574L Gigabit Network Card (intel e1000e) | ||
| 9 | vendor_id="8086" | ||
| 10 | product_id="10d3" | ||
| 11 | |||
| 12 | #find vendor id & product id | ||
| 13 | lspci -nn |grep $vendor_id:$product_id | ||
| 14 | if [ $? -ne 0 ]; then | ||
| 15 | echo "FAIL: pci-e ethernet card device does not exist" | ||
| 16 | exit 1 | ||
| 17 | else | ||
| 18 | echo "PASS: got pci-e ethernet card device" | ||
| 19 | fi | ||
| 20 | |||
| 21 | setpci -v -d $vendor_id:$product_id latency_timer=b0 | ||
| 22 | if [ $? -ne 0 ]; then | ||
| 23 | echo "FAIL: parameter changes to pci config space failed" | ||
| 24 | exit 1 | ||
| 25 | else | ||
| 26 | echo "PASS: parameter changes to pci config space success" | ||
| 27 | fi | ||
| 28 | |||
| 29 | IFCONFIG=`which ifconfig` | ||
| 30 | |||
| 31 | $IFCONFIG $ethernet_interface up | ||
| 32 | $IFCONFIG | grep $ethernet_interface | ||
| 33 | if [ $? -ne 0 ]; then | ||
| 34 | echo "FAIL: pci-e ethernet card device $ethernet_interface is not up" | ||
| 35 | exit 1 | ||
| 36 | else | ||
| 37 | echo "PASS: pci-e ethernet card device $ethernet_interface is up" | ||
| 38 | fi | ||
| 39 | |||
| 40 | if [ "x$ethernet_ipaddr" != "x" ]; then | ||
| 41 | $IFCONFIG $ethernet_interface $ethernet_ipaddr | ||
| 42 | fi | ||
| 43 | |||
| 44 | $IFCONFIG $ethernet_interface |grep 'inet addr:' |sed -e 's@inet addr:@@' |sed q | awk '{print $1}' | ||
| 45 | if [ $? -ne 0 ]; then | ||
| 46 | echo "FAIL: ipaddr of pci-e ethernet card device $ethernet_interface setup failed" | ||
| 47 | exit 1 | ||
| 48 | else | ||
| 49 | echo "PASS: ipaddr of pci-e ethernet card device $ethernet_interface setup success" | ||
| 50 | fi | ||
| 51 | |||
| 52 | mindatasize=56 | ||
| 53 | maxdatasize=650 | ||
| 54 | stepsize=100 | ||
| 55 | iteration=1 | ||
| 56 | datasize=$mindatasize | ||
| 57 | logfile=`/bin/mktemp` | ||
| 58 | statistics=`/bin/mktemp` | ||
| 59 | error=0 | ||
| 60 | |||
| 61 | trap cleanup SIGHUP SIGINT SIGTERM | ||
| 62 | |||
| 63 | clean_tasks() { | ||
| 64 | echo "Executing clean up tasks" | ||
| 65 | rm -f $logfile $statistics | ||
| 66 | } | ||
| 67 | |||
| 68 | cleanup() { | ||
| 69 | echo "Aborting script execution" | ||
| 70 | clean_tasks | ||
| 71 | exit 0 | ||
| 72 | } | ||
| 73 | |||
| 74 | echo "start ping test for pci-e ethernet card device $ethernet_interface..." | ||
| 75 | |||
| 76 | while [ $datasize -le $maxdatasize ]; do | ||
| 77 | for i in `seq 1 $iteration`; do | ||
| 78 | ping -c 1 -s $datasize $ethernet_ping_ipaddr > $statistics | ||
| 79 | ping_err=`echo $?` | ||
| 80 | echo "" && cat $statistics | grep -r "PING" | ||
| 81 | cat $statistics | grep -r "received" | ||
| 82 | [ `echo $?` -eq 0 ] || packets_received=0 && \ | ||
| 83 | packets_received=`cat $statistics | \ | ||
| 84 | grep -r "received" | awk '{print$4}'` | ||
| 85 | |||
| 86 | # Evaluate possible errors on the ping operation | ||
| 87 | if [ $ping_err -ne 0 ] || [ $packets_received -eq 0 ]; then | ||
| 88 | error=1 | ||
| 89 | echo -e `cat $statistics | grep -r PING` >> $logfile | ||
| 90 | echo -e "Size: $datasize Iteration: $i\n" >> $logfile | ||
| 91 | fi | ||
| 92 | done | ||
| 93 | let datasize=$datasize+$stepsize | ||
| 94 | done | ||
| 95 | |||
| 96 | # Report failures | ||
| 97 | if [ $error -eq 1 ]; then | ||
| 98 | echo -e "=================== error report ===================\n" | ||
| 99 | cat $logfile | ||
| 100 | echo -e "====================================================\n" | ||
| 101 | clean_tasks | ||
| 102 | echo -e "FAIL: ping test for pci-e ethernet card device $ethernet_interface failed\n" | ||
| 103 | exit 1 | ||
| 104 | else | ||
| 105 | clean_tasks | ||
| 106 | echo -e "PASS: ping test for pci-e ethernet card device $ethernet_interface success\n" | ||
| 107 | fi | ||
| 108 | |||
| 109 | exit 0 | ||
