diff options
Diffstat (limited to 'recipes-test/ddt-runner/files/scripts/romley-ivb')
4 files changed, 311 insertions, 0 deletions
diff --git a/recipes-test/ddt-runner/files/scripts/romley-ivb/ethernet b/recipes-test/ddt-runner/files/scripts/romley-ivb/ethernet new file mode 100755 index 0000000..5355f10 --- /dev/null +++ b/recipes-test/ddt-runner/files/scripts/romley-ivb/ethernet | |||
@@ -0,0 +1,88 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | ethernet_interface="eth1" | ||
4 | ethernet_ping_ipaddr="172.21.3.22" | ||
5 | ethernet_ipaddr=$1 | ||
6 | |||
7 | IFCONFIG=`which ifconfig` | ||
8 | |||
9 | $IFCONFIG $ethernet_interface up | ||
10 | $IFCONFIG | grep $ethernet_interface | ||
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}' | ||
23 | if [ $? -ne 0 ]; then | ||
24 | echo "FAIL: ipaddr of $ethernet_interface setup failed" | ||
25 | exit 1 | ||
26 | else | ||
27 | echo "PASS: ipaddr of $ethernet_interface setup success" | ||
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 | echo "Executing clean up tasks" | ||
43 | rm -f $logfile $statistics | ||
44 | } | ||
45 | |||
46 | cleanup() { | ||
47 | echo "Aborting script execution" | ||
48 | clean_tasks | ||
49 | exit 0 | ||
50 | } | ||
51 | |||
52 | echo "start ping test for $ethernet_interface..." | ||
53 | |||
54 | while [ $datasize -le $maxdatasize ]; do | ||
55 | for i in `seq 1 $iteration`; do | ||
56 | ping -c 1 -s $datasize $ethernet_ping_ipaddr > $statistics | ||
57 | ping_err=`echo $?` | ||
58 | echo "" && cat $statistics | grep -r "PING" | ||
59 | cat $statistics | grep -r "received" | ||
60 | [ `echo $?` -eq 0 ] || packets_received=0 && \ | ||
61 | packets_received=`cat $statistics | \ | ||
62 | grep -r "received" | awk '{print$4}'` | ||
63 | |||
64 | # Evaluate possible errors on the ping operation | ||
65 | if [ $ping_err -ne 0 ] || [ $packets_received -eq 0 ]; then | ||
66 | error=1 | ||
67 | echo -e `cat $statistics | grep -r PING` >> $logfile | ||
68 | echo -e "Size: $datasize Iteration: $i\n" >> $logfile | ||
69 | fi | ||
70 | done | ||
71 | let datasize=$datasize+$stepsize | ||
72 | done | ||
73 | |||
74 | # Report failures | ||
75 | if [ $error -eq 1 ]; then | ||
76 | echo -e "=================== error report ===================\n" | ||
77 | cat $logfile | ||
78 | echo -e "====================================================\n" | ||
79 | clean_tasks | ||
80 | echo -e "FAIL: ping test for $ethernet_interface failed\n" | ||
81 | exit 1 | ||
82 | else | ||
83 | clean_tasks | ||
84 | echo -e "PASS: ping test for $ethernet_interface success\n" | ||
85 | fi | ||
86 | |||
87 | echo "PASS: $ethernet_interface test passed" | ||
88 | exit 0 | ||
diff --git a/recipes-test/ddt-runner/files/scripts/romley-ivb/rtc b/recipes-test/ddt-runner/files/scripts/romley-ivb/rtc new file mode 100755 index 0000000..0d38293 --- /dev/null +++ b/recipes-test/ddt-runner/files/scripts/romley-ivb/rtc | |||
@@ -0,0 +1,42 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | RTC_DEVICE="/dev/rtc" | ||
4 | |||
5 | if [ ! -e $RTC_DEVICE ]; then | ||
6 | echo "FAIL: rtc device does not exist" | ||
7 | exit 1 | ||
8 | else | ||
9 | echo "PASS: rtc device exists" | ||
10 | fi | ||
11 | |||
12 | /sbin/hwclock -f $RTC_DEVICE | ||
13 | if [ $? -ne 0 ]; then | ||
14 | echo "FAIL: rtc device open failed" | ||
15 | exit 1 | ||
16 | else | ||
17 | echo "PASS: rtc device open success" | ||
18 | fi | ||
19 | |||
20 | |||
21 | /sbin/hwclock --systohc | ||
22 | if [ $? -ne 0 ]; then | ||
23 | echo "FAIL: sync system clock and hardware clock failed" | ||
24 | exit 1 | ||
25 | else | ||
26 | echo "PASS: sync system clock and hardware clock success" | ||
27 | fi | ||
28 | |||
29 | RTC_TIME=$(/sbin/hwclock -r |awk '{print $4}') | ||
30 | echo $RTC_TIME | ||
31 | SYS_TIME=$(date +%m/%d/%Y-%X |awk '{print $1}' |awk -F- '{print $2}') | ||
32 | echo $SYS_TIME | ||
33 | |||
34 | if [ "$RTC_TIME" = "$SYS_TIME" ] ; then | ||
35 | echo "PASS: system time same with hardware time" | ||
36 | else | ||
37 | echo "FAIL: system time different with hardware time" | ||
38 | exit 1 | ||
39 | fi | ||
40 | |||
41 | echo "PASS: rtc test successful" | ||
42 | exit 0 | ||
diff --git a/recipes-test/ddt-runner/files/scripts/romley-ivb/sata b/recipes-test/ddt-runner/files/scripts/romley-ivb/sata new file mode 100755 index 0000000..25bf15a --- /dev/null +++ b/recipes-test/ddt-runner/files/scripts/romley-ivb/sata | |||
@@ -0,0 +1,81 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | #This script is to test sata devices on target | ||
4 | # | ||
5 | result=0 | ||
6 | devpath="" | ||
7 | satainfo="" | ||
8 | SD=`ls -l /dev/sd[^0-9] | awk '{print $5 $6 "," $10}'` | ||
9 | if [ -z "$SD" ]; then | ||
10 | echo "FAIL: find sata device" | ||
11 | exit 1 | ||
12 | else | ||
13 | echo "PASS: find sata device" | ||
14 | fi | ||
15 | HDPARM=`which hdparm` | ||
16 | if [ -z $HDPARM ]; then | ||
17 | result=$? | ||
18 | echo "FAIL: find hdparm" | ||
19 | fi | ||
20 | echo "PASS: find hdparm" | ||
21 | |||
22 | |||
23 | for s in $SD | ||
24 | do | ||
25 | devpath=`echo "$s" | awk -F "," '{print "/sys/dev/block/" $1 ":" $2}'` | ||
26 | satainfo=`ls -l $devpath | grep sata` | ||
27 | |||
28 | if [ -z "$satainfo" ] ; then | ||
29 | continue | ||
30 | fi | ||
31 | s=`echo "$s" | awk -F "," '{print $3}'` | ||
32 | |||
33 | echo "testing $s" | ||
34 | $HDPARM -I $s | ||
35 | if [ $? -ne 0 ]; then | ||
36 | result=$? | ||
37 | echo "FAIL: $HDPARM -I $s Detailed/current information directly from $s" | ||
38 | else | ||
39 | echo "PASS: $HDPARM -I $s Detailed/current information directly from $s" | ||
40 | fi | ||
41 | $HDPARM -tT $s | ||
42 | if [ $? -ne 0 ]; then | ||
43 | result=$? | ||
44 | echo "FAIL: $HDPARM -tT $s Perform device/cache read timings on $s" | ||
45 | else | ||
46 | echo "PASS: $HDPARM -tT $s Perform device/cache read timings on $s" | ||
47 | fi | ||
48 | |||
49 | |||
50 | mkdir -p /mnt/sata_tmp | ||
51 | for partition in `ls "$s"[1-9]` | ||
52 | do | ||
53 | mount "$partition" /mnt/sata_tmp | ||
54 | if [ $? -ne 0 ]; then | ||
55 | result=$? | ||
56 | echo "FAIL: Mount $s" | ||
57 | else | ||
58 | echo "PASS: Mount $s" | ||
59 | dd if=/dev/urandom of=/mnt/sata_tmp/writefile bs=1M count=50 | ||
60 | if [ $? -ne 0 ]; then | ||
61 | result=$? | ||
62 | echo "FAIL: write test on $s" | ||
63 | else | ||
64 | echo "PASS: write test on $s" | ||
65 | rm -f /mnt/sata_tmp/writefile | ||
66 | fi | ||
67 | dd if=$s of=/mnt/sata_tmp/readfile bs=1M count=10 | ||
68 | if [ $? -ne 0 ]; then | ||
69 | result=$? | ||
70 | echo "FAIL: read test on $s" | ||
71 | else | ||
72 | echo "PASS: read test on $s" | ||
73 | rm -f /mnt/sata_tmp/readfile | ||
74 | fi | ||
75 | umount /mnt/sata_tmp | ||
76 | fi | ||
77 | done | ||
78 | |||
79 | rm -fr /mnt/sata_tmp | ||
80 | done | ||
81 | exit $result | ||
diff --git a/recipes-test/ddt-runner/files/scripts/romley-ivb/usb b/recipes-test/ddt-runner/files/scripts/romley-ivb/usb new file mode 100755 index 0000000..15c417a --- /dev/null +++ b/recipes-test/ddt-runner/files/scripts/romley-ivb/usb | |||
@@ -0,0 +1,100 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # This script is used to test usb functionality for romley-ivb. | ||
4 | # | ||
5 | |||
6 | result=0 | ||
7 | devpath="" | ||
8 | usbinfo="" | ||
9 | |||
10 | usbutils_is_installed=`which lsusb` | ||
11 | if [ -z $usbutils_is_installed ]; then | ||
12 | echo "FAIL: Cannot find lsusb" | ||
13 | exit 1 | ||
14 | fi | ||
15 | |||
16 | usbdev_num=`lsusb | grep -v root\ hub | wc -l` | ||
17 | if [ $usbdev_num -eq 0 ]; then | ||
18 | echo "FAIL: USB device is not connected" | ||
19 | exit 1 | ||
20 | else | ||
21 | echo "$usbdev_num USB device(s) connected" | ||
22 | fi | ||
23 | |||
24 | sd=`ls -l /dev/sd[^0-9] | awk '{print $5 $6 "," $10}'` | ||
25 | if [ -z "$sd" ]; then | ||
26 | echo "FAIL: find sd device" | ||
27 | exit 1 | ||
28 | else | ||
29 | echo "PASS: find sd device" | ||
30 | fi | ||
31 | |||
32 | HDPARM=`which hdparm` | ||
33 | if [ -z $HDPARM ]; then | ||
34 | result=$? | ||
35 | echo "FAIL: find hdparm" | ||
36 | fi | ||
37 | echo "PASS: find hdparm" | ||
38 | |||
39 | for s in $sd | ||
40 | do | ||
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 | ||
99 | done | ||
100 | exit $result | ||