blob: fd3a3cfa07c26cfc36ea8cf9708213fe205d891b (
plain)
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
|
#
# exynos_cehckpatch.sh - a tool to test build, defconfig and patch format
#
# Dept : S/W Solution Dev Team
# Author : Solution3 Power Part
# Update : 2014.12.08
#
#!/bin/bash
smdk7580_defconfig=smdk7580_defconfig
univ5433_defconfig=universal5433_defconfig
univ7580_defconfig=universal7580_defconfig
univ7420_defconfig=universal7420_defconfig
build_log_smdk7580=build_log_smdk7580
build_log_univ5433=build_log_univ5433
build_log_univ7420=build_log_univ7420
build_log_univ7580=build_log_univ7580
def_log_smdk7580=def_log_smdk7580
def_log_univ7580=def_log_univ7580
checkpatch_helper=scripts/exynos_checkpatch_helper.py
print_log()
{
echo -e "\033[31m""$1""\033[0m"
}
print_help_message()
{
echo 'usage: ./scripts/exynos_checkpatch.sh [-b]'
echo ' [-d]'
echo ' [-c] [# of patch]'
echo ' [-i] [testcase]'
echo ' [-h or --help]'
echo ' [# of patch]'
echo ''
echo 'Options are as follows:'
echo ' -b Run build test with univ5433, univ7420 and univ7580'
echo ' -d Run defconfig test with smdk7580 and univ7580'
echo ' -c Run checkpatch.pl test'
echo ' -i Run custom test with testcase file'
echo ' -h Print help message'
}
clean_kernel()
{
make clean
make distclean
}
build_kernel_and_dtb()
{
clean_kernel
make "$1"
make -j 24 > "$2"
make dtbs
}
build()
{
build_kernel_and_dtb "$1" "$2"
result=''
if [ -e vmlinux ]; then
result='1'
rm "$2"
else
result='0'
fi
python ${checkpatch_helper} -b "$1" "$2" ${result}
}
run_build_test()
{
if [ -e arch/arm64/configs/"$1" ]; then
build "$1" "$2"
else
dummy_build_log='0xefefefef'
python ${checkpatch_helper} -b "$1" ${dummy_build_log} '0'
fi
}
compare_config()
{
result=''
if [ "$3" = "$5" ]; then
result='1'
rm "$2"
else
result='0'
fi
python ${checkpatch_helper} -d "$1" "$2" ${result}
}
run_defconfig_test()
{
if [ -e arch/arm64/configs/"$1" ]; then
clean_kernel
make "$1"
make savedefconfig
diff -u defconfig arch/arm64/configs/"$1" > "$2"
num_word=`wc -c "$2"`
expected_num_word="0 "$2""
compare_config $1 $2 ${num_word} ${expected_num_word}
rm defconfig
else
dummy_def_log='0xfefefefe'
python ${checkpatch_helper} -d "$1" ${dummy_def_log} '0'
fi
}
run_checkpatch_test()
{
python ${checkpatch_helper} -c "$1"
}
run_custom_test()
{
exec < "$1"
while read line ; do
test_type=`echo ${line} | awk '{print $1}'`
if [ ${test_type} = 'b' ]; then
defconfig=`echo ${line} | awk '{print $2}'`
build_log=`echo build_log_${defconfig}`
run_build_test ${defconfig} ${build_log}
elif [ ${test_type} = 'd' ]; then
defconfig=`echo ${line} | awk '{print $2}'`
def_log=`echo def_log_${defconfig}`
run_defconfig_test ${defconfig} ${def_log}
elif [ ${test_type} = 'c' ]; then
num_patch=`echo ${line} | awk '{print $2}'`
run_checkpatch_test ${num_patch}
elif [ ${test_type} = '#' ]; then
continue
else
print_log 'Testcase file is corrupted <- FAIL'
fi
done
}
run_default_test()
{
run_build_test ${univ5433_defconfig} ${build_log_univ5433}
run_build_test ${univ7420_defconfig} ${build_log_univ7420}
run_build_test ${smdk7580_defconfig} ${build_log_smdk7580}
run_build_test ${univ7580_defconfig} ${build_log_univ7580}
run_defconfig_test ${smdk7580_defconfig} ${def_log_smdk7580}
run_defconfig_test ${univ7580_defconfig} ${def_log_univ7580}
run_checkpatch_test "$1"
}
main()
{
if [ "$1" = '-b' ]; then
run_build_test ${univ5433_defconfig} ${build_log_univ5433}
run_build_test ${univ7420_defconfig} ${build_log_univ7420}
run_build_test ${smdk7580_defconfig} ${build_log_smdk7580}
run_build_test ${univ7580_defconfig} ${build_log_univ7580}
elif [ "$1" = '-d' ]; then
run_defconfig_test ${smdk7580_defconfig} ${def_log_smdk7580}
run_defconfig_test ${univ7580_defconfig} ${def_log_univ7580}
elif [ "$1" = '-c' ]; then
run_checkpatch_test "$2"
elif [ "$1" = '-i' ]; then
run_custom_test "$2"
elif [ "$1" = '-h' ] || [ "$1" = '--help' ]; then
print_help_message
else
run_default_test "$1"
fi
}
main "$1" "$2"
|