diff options
Diffstat (limited to 'recipes-test/ddt-runner/files/scripts/p2041rdb/sata')
| -rwxr-xr-x | recipes-test/ddt-runner/files/scripts/p2041rdb/sata | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/recipes-test/ddt-runner/files/scripts/p2041rdb/sata b/recipes-test/ddt-runner/files/scripts/p2041rdb/sata new file mode 100755 index 0000000..b7f1fab --- /dev/null +++ b/recipes-test/ddt-runner/files/scripts/p2041rdb/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 | ||
