-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproduct_test.sh
146 lines (111 loc) · 2.38 KB
/
product_test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#!/bin/bash
echo "************************************************"
echo "******************Product Test******************"
echo "************************************************"
starttime=$(date +%s)
rm *.log
chmod 777 *
cfg_name=cfg.ini
function readINI()
{
FILENAME=$1; SECTION=$2; KEY=$3
RESULT=`awk -F '=' '/\['$SECTION'\]/{a=1}a==1&&$1~/'$KEY'/{print $2;exit}' $FILENAME`
echo $RESULT
}
cfg_section=USB
str_testitem=$(readINI $cfg_name $cfg_section enable)
test_item=$(echo $str_testitem | sed 's/\r//')
usb_pid=0
if [[ "$test_item" = "y" ]]
then
sh usb_test.sh &
usb_pid=${!}
fi
cfg_section=SD
str_testitem=$(readINI $cfg_name $cfg_section enable)
test_item=$(echo $str_testitem | sed 's/\r//')
sd_pid=0
if [[ "$test_item" = "y" ]]
then
sh sd_test.sh &
sd_pid=${!}
fi
cfg_section=ETHERNET
str_testitem=$(readINI $cfg_name $cfg_section enable)
test_item=$(echo $str_testitem | sed 's/\r//')
ethernet_pid=0
if [[ "$test_item" = "y" ]]
then
sh ethernet_test.sh &
ethernet_pid=${!}
fi
cfg_section=BLUETOOTH
str_testitem=$(readINI $cfg_name $cfg_section enable)
test_item=$(echo $str_testitem | sed 's/\r//')
bluetooth_pid=0
if [[ "$test_item" = "y" ]]
then
sh bluetooth.sh &
bluetooth_pid=${!}
fi
cfg_section=WLAN
str_testitem=$(readINI $cfg_name $cfg_section enable)
test_item=$(echo $str_testitem | sed 's/\r//')
wifi_pid=0
if [[ "$test_item" = "y" ]]
then
sh wifi_test.sh &
wifi_pid=${!}
fi
if [[ $usb_pid != 0 ]]
then
wait ${usb_pid}
fi
if [[ $sd_pid != 0 ]]
then
wait ${sd_pid}
fi
if [[ $ethernet_pid != 0 ]]
then
wait ${ethernet_pid}
fi
if [[ $bluetooth_pid != 0 ]]
then
wait ${bluetooth_pid}
fi
if [[ $wifi_pid != 0 ]]
then
wait ${wifi_pid}
fi
cfg_section=HDMI_PWMADC
str_testitem=$(readINI $cfg_name $cfg_section enable)
test_item=$(echo $str_testitem | sed 's/\r//')
if [ "$test_item" = "y" ]
then
sh hdmi_pwmadc_test.sh
fi
endtime=$(date +%s)
runmin=$(($endtime-$starttime))
echo "running time: $runmin s"
echo "************************************************"
echo "*********************Result*********************"
echo "************************************************"
#cat test_result.log
IFS=''
while read line
do
result=$(echo $line | grep "PASS")
if [[ "$result" != "" ]]
then
echo $line
fi
done < test_result.log
while read line
do
result=$(echo $line | grep "FAIL")
if [[ "$result" != "" ]]
then
echo $line
fi
done < test_result.log
rm *.log