-
Notifications
You must be signed in to change notification settings - Fork 22
/
check_compile.sh
executable file
·175 lines (158 loc) · 4.32 KB
/
check_compile.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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#!/bin/bash
#------------IMPORTANT------------#
#--RUN THIS SCRIPT BEFOR COMMIT---#
#---------------------------------#
# Author: xiaobo.gu@amlogic.com
# Init version: 20160329
#usage:
#
#./check_compile.sh -check amlogic board configs
#./check_compile.sh cus -check customer board configs
#./check_compile.sh all -check both amlogic and customer boards
folder_board="board/amlogic"
customer_folder="customer/board"
echo "************** Amlogic Compile Check Tool **************"
# filters define:
# cus: all customer board
# all: all boards
# other:
# gxb: all gxbaby board
# gxtvbb: all gxtvbb board
# skt: all socket board
# p200: p200 board
# etc.....
declare filter="$1"
# ARRAY_CFG store config names
declare -a ARRAY_CFG
declare -a ARRAY_CFG_C
# TOTAL_CFG store config total num
declare -i TOTAL_CFG
declare -i TOTAL_CFG_C
# if filter!=cus, then include amlogic configs
# get all configs name from board folder
if [ "$1" != "cus" ]
then
filter=$1
for file in ${folder_board}/*; do
temp_file=`basename $file`
#echo "$temp_file"
if [ -d ${folder_board}/${temp_file} ] && [ "$temp_file" != "defconfigs" ] && [ "$temp_file" != "configs" ];then
#echo " \c"
#echo $temp_file
ARRAY_CFG[$TOTAL_CFG]=$temp_file
TOTAL_CFG=$TOTAL_CFG+1
fi
done
fi
# if filter==all || filter==cus, then include customer configs
# get all customer configs name from customer board folder
if [ "$1" == "cus" ] || [ "$1" == "all" ]
then
filter=""
if [ -e ${customer_folder} ];then
for file in ${customer_folder}/*; do
temp_file=`basename $file`
if [ -d ${customer_folder}/${temp_file} ] && [ "$temp_file" != "defconfigs" ] && [ "$temp_file" != "configs" ];then
#echo " \c"
#echo $temp_file
ARRAY_CFG_C[$TOTAL_CFG_C]=$temp_file
TOTAL_CFG_C=$TOTAL_CFG_C+1
fi
done
fi
fi
echo "************************ START *************************"
# compile check start
# RESULT store compile result
declare RESULT=""
declare -i LOOP_NUM=0
# counter variables
declare -i PASS_COUNTER=0
declare -i FAIL_COUNTER=0
# print bar and alignment
declare -i BAR_TOTAL=30
declare -i BAR_LOOP
RESULT=$RESULT"########### Compile Check Result ###########\n"
if [ "$1" != "cus" ]
then
RESULT=$RESULT"--------------------------------------------\n"
RESULT=$RESULT"############## Amlogic Boards ##############\n"
# loop all cfgs
for cfg in ${ARRAY_CFG[@]}
do
# find filter in config name
if [[ $(echo $cfg | grep "${filter}") == "" ]]
then
# skip !filter configs
continue
fi
LOOP_NUM=$LOOP_NUM+1
RESULT=$RESULT' '
# print '0' charactors for alignment
BAR_LOOP=3-`expr length $LOOP_NUM`
if [ "$BAR_LOOP" -gt "0" ]
then
for tmp in `seq $BAR_LOOP`;do RESULT=$RESULT'0';done
fi
RESULT=$RESULT$LOOP_NUM' '
RESULT=$RESULT$cfg' '
# print '-' charactors for alignment
BAR_LOOP=BAR_TOTAL-`expr length $cfg`
if [ "$BAR_LOOP" -gt "0" ]
then
for tmp in `seq $BAR_LOOP`;do RESULT=$RESULT'-';done
fi
# compile
make distclean
make $cfg'_defconfig'
make -j
# check last 'make -j' result
if [ $? != 0 ]
then
RESULT=$RESULT'- failed\n'
FAIL_COUNTER=$FAIL_COUNTER+1
else
RESULT=$RESULT'- pass\n'
PASS_COUNTER=$PASS_COUNTER+1
fi
# print result
echo -e $RESULT
#echo $cfg
done
fi
# check customer configs
if [ "$1" == "cus" ] || [ "$1" == "all" ]
then
RESULT=$RESULT"--------------------------------------------\n"
RESULT=$RESULT"############## Customer Boards #############\n"
for cfg in ${ARRAY_CFG_C[@]}
do
LOOP_NUM=$LOOP_NUM+1
RESULT=$RESULT' '
BAR_LOOP=3-`expr length $LOOP_NUM`
if [ "$BAR_LOOP" -gt "0" ]
then
for tmp in `seq $BAR_LOOP`;do RESULT=$RESULT'0';done
fi
RESULT=$RESULT$LOOP_NUM' '
RESULT=$RESULT$cfg' '
BAR_LOOP=BAR_TOTAL-`expr length $cfg`
if [ "$BAR_LOOP" -gt "0" ]
then
for tmp in `seq $BAR_LOOP`;do RESULT=$RESULT'-';done
fi
make distclean
make $cfg'_defconfig'
make -j
if [ $? != 0 ]
then
RESULT=$RESULT'- failed\n'
FAIL_COUNTER=$FAIL_COUNTER+1
else
RESULT=$RESULT'- pass\n'
PASS_COUNTER=$PASS_COUNTER+1
fi
echo -e $RESULT
done
fi
echo -e "#################### END ###################\n"