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/sata | |
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/sata')
-rwxr-xr-x | recipes-test/ddt-runner/files/scripts/t1042rdb/sata | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/recipes-test/ddt-runner/files/scripts/t1042rdb/sata b/recipes-test/ddt-runner/files/scripts/t1042rdb/sata new file mode 100755 index 0000000..62766b0 --- /dev/null +++ b/recipes-test/ddt-runner/files/scripts/t1042rdb/sata | |||
@@ -0,0 +1,86 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # | ||
4 | #This script is to test sata devices on target | ||
5 | # | ||
6 | |||
7 | result=0 | ||
8 | devpath="" | ||
9 | satainfo="" | ||
10 | |||
11 | SD=`ls -l /dev/sd[^0-9] 2> /dev/null | awk '{print $5 $6 "," $10}'` | ||
12 | if [ -z "$SD" ]; then | ||
13 | echo "SKIP: no sata device found" | ||
14 | exit 1 | ||
15 | else | ||
16 | echo "PASS: find sata device" | ||
17 | fi | ||
18 | |||
19 | HDPARM=`which hdparm` | ||
20 | if [ -z $HDPARM ]; then | ||
21 | result=$? | ||
22 | echo "FAIL: find hdparm" | ||
23 | exit 1 | ||
24 | else | ||
25 | echo "PASS: find hdparm" | ||
26 | fi | ||
27 | |||
28 | for s in $SD | ||
29 | do | ||
30 | devpath=`echo "$s" | awk -F "," '{print "/sys/dev/block/" $1 ":" $2}'` | ||
31 | satainfo=`ls -l $devpath | grep sata` | ||
32 | |||
33 | if [ -z "$satainfo" ] ; then | ||
34 | continue | ||
35 | fi | ||
36 | s=`echo "$s" | awk -F "," '{print $3}'` | ||
37 | |||
38 | echo "testing $s" | ||
39 | $HDPARM -I $s | ||
40 | if [ $? -ne 0 ]; then | ||
41 | result=$? | ||
42 | echo "FAIL: $HDPARM -I $s Detailed/current information directly from $s" | ||
43 | else | ||
44 | echo "PASS: $HDPARM -I $s Detailed/current information directly from $s" | ||
45 | fi | ||
46 | $HDPARM -tT $s | ||
47 | if [ $? -ne 0 ]; then | ||
48 | result=$? | ||
49 | echo "FAIL: $HDPARM -tT $s Perform device/cache read timings on $s" | ||
50 | else | ||
51 | echo "PASS: $HDPARM -tT $s Perform device/cache read timings on $s" | ||
52 | fi | ||
53 | |||
54 | |||
55 | mkdir -p /mnt/sata_tmp | ||
56 | for partition in `ls "$s"[1-9]` | ||
57 | do | ||
58 | mount "$partition" /mnt/sata_tmp | ||
59 | if [ $? -ne 0 ]; then | ||
60 | result=$? | ||
61 | echo "FAIL: Mount $s" | ||
62 | else | ||
63 | echo "PASS: Mount $s" | ||
64 | dd if=/dev/urandom of=/mnt/sata_tmp/writefile bs=1M count=50 | ||
65 | if [ $? -ne 0 ]; then | ||
66 | result=$? | ||
67 | echo "FAIL: write test on $s" | ||
68 | else | ||
69 | echo "PASS: write test on $s" | ||
70 | rm -f /mnt/sata_tmp/writefile | ||
71 | fi | ||
72 | dd if=$s of=/mnt/sata_tmp/readfile bs=1M count=10 | ||
73 | if [ $? -ne 0 ]; then | ||
74 | result=$? | ||
75 | echo "FAIL: read test on $s" | ||
76 | else | ||
77 | echo "PASS: read test on $s" | ||
78 | rm -f /mnt/sata_tmp/readfile | ||
79 | fi | ||
80 | umount /mnt/sata_tmp | ||
81 | fi | ||
82 | done | ||
83 | |||
84 | rm -fr /mnt/sata_tmp | ||
85 | done | ||
86 | exit $result | ||