forked from codesnake/uboot-amlogic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck_compile.sh
executable file
·150 lines (139 loc) · 3.38 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
#!/bin/bash
#------------IMPORTANT------------#
#--RUN THIS SCRIPT BEFOR COMMIT---#
#---------------------------------#
#usage:
#
#./check_compile.sh -check amlogic board configs (ref: board/amlogic/boards.cfg)
#./check_compile.sh cus -check customer board configs (ref: customer/board/boards.cfg)
#./check_compile.sh all -check both amlogic and customer boards
declare -a cfg_file=[]
declare filter="$1"
if [ "$1" == "all" ]
then
filter=""
if [ -f "customer/board/boards.cfg" ]
then
cfg_file[0]="board/amlogic/boards.cfg"
cfg_file[1]="customer/board/boards.cfg"
else
#if customer folder doesn't exit
cfg_file[0]="board/amlogic/boards.cfg"
fi
else
if [ "$1" == "cus" ]
then
filter=""
cfg_file[0]="customer/board/boards.cfg"
else
cfg_file[0]="board/amlogic/boards.cfg"
fi
fi
declare RESULT
declare -i LOOP_NUM
declare -i CFG_START=0
# Use a dummy file as the Secure OS binary to check compilation
# for TEE enabled build.
export SECURE_OS_BIN="README"
for cfg in ${cfg_file[@]}
do
RESULT=$RESULT'\n#'
for x in $(seq 20)
do RESULT=$RESULT'~'
done
if [ "$cfg" == "board/amlogic/boards.cfg" ]
then
RESULT=$RESULT'AMLOGIC BOARDS'
else
RESULT=$RESULT'CUSTOMER BOARD'
fi
for x in $(seq 20)
do RESULT=$RESULT'~'
done
RESULT=$RESULT'#\n'
declare -a ARRAY
declare -i TOTAL
while read line
do
if [[ $CFG_START = 1 ]]
#if get start position of configs
then
if [ -n "$line" ] && [ "#" != `expr substr "$line" 1 1` ]
then
#echo -n "one line: "
#store each configs
ind=`expr index "$line" ' '`
sub=`expr substr "$line" 1 "$ind"`
#echo $sub $filter
#echo `expr match "$sub" ".*$filter" - length "$filter"`
if [ `expr match "$sub" ".*$filter" - length "$filter"` -ge 0 ]
then
#filter string process
ARRAY[$TOTAL]=$sub
TOTAL=$TOTAL+1
fi
else
#blank line process
if [ -z "$line" ]
then
continue
else
#re-meet # lines, means end of configs
if [ "#" = `expr substr "$line" 1 1` ]
then
break
fi
fi
fi
else
#try to get start position
str_length=${#line}
#echo $str_length
if [ "$str_length" -gt "10" ]
then
cfg_str=`expr substr "$line" 1 10`
#start position synbol: a line of #
if [ "$cfg_str" == "##########" ]
then
CFG_START=1
fi
fi
fi
done < $cfg
#run make and print result
declare -i BAR_TOTAL=25
declare -i BAR_LOOP
for cfg in ${ARRAY[@]}
do
LOOP_NUM=$LOOP_NUM+1
RESULT=$RESULT'#--------'
if [ "$LOOP_NUM" -lt "10" ]
then RESULT=$RESULT'00'$LOOP_NUM
else
if [ "$LOOP_NUM" -lt "100" ]
then RESULT=$RESULT'0'$LOOP_NUM
else RESULT=$RESULT$LOOP_NUM
fi
fi
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'_config' > $cfg'_config'.log 2>&1
#make -j >> $cfg'_config'.log 2>&1
make $cfg'_config'
make -j
if [ $? != 0 ]
then RESULT=$RESULT'-failed---'
else RESULT=$RESULT'-pass-----'
fi
RESULT=$RESULT'#\n'
done
CFG_START=0
unset ARRAY
TOTAL=0
done
echo -e $RESULT