@@ -718,6 +718,7 @@ compile_kernel_smatch() {
718
718
719
719
compile_gcc_fanalyzer () {
720
720
export step_name=" gcc_fanalyzer"
721
+ local exceptions_file=" ci/travis/deadcode_exceptions"
721
722
local files=$( git diff --diff-filter=ACM --no-renames --name-only $base_sha ..$head_sha )
722
723
local regex=' ^[[:alnum:]/._-]+:[[:digit:]]+:[[:digit:]]+: .*$'
723
724
local mail=
@@ -730,6 +731,10 @@ compile_gcc_fanalyzer () {
730
731
return 1
731
732
fi
732
733
734
+ if [[ -f $exceptions_file ]]; then
735
+ files=$( comm -13 <( sort $exceptions_file ) <( echo $files | tr ' ' ' \n' | sort) )
736
+ fi
737
+
733
738
while read file; do
734
739
case " $file " in
735
740
* .c)
@@ -891,8 +896,17 @@ compile_clang_analyzer () {
891
896
892
897
assert_compiled () {
893
898
export step_name=" assert_compiled"
899
+ local exceptions_file=" ci/travis/deadcode_exceptions"
894
900
local files=$( git diff --diff-filter=ACM --no-renames --name-only $base_sha ..$head_sha )
895
901
local fail=0
902
+ local error="
903
+ At least one file was not compiled during kernel compilation
904
+ Either:
905
+ 1. ensure the Kconfig is able to enable it/them
906
+ OR
907
+ 2. remove deadcode
908
+ OR
909
+ 3. add it/them in file '$exceptions_file '"
896
910
897
911
echo " $step_name were compiled on range $base_sha ..$head_sha "
898
912
@@ -901,6 +915,11 @@ assert_compiled () {
901
915
return 1
902
916
fi
903
917
918
+ # Allows deadcode
919
+ if [[ -f $exceptions_file ]]; then
920
+ files=$( comm -13 <( sort $exceptions_file ) <( echo $files | tr ' ' ' \n' | sort) )
921
+ fi
922
+
904
923
while read file; do
905
924
case " $file " in
906
925
* .c)
@@ -909,14 +928,18 @@ assert_compiled () {
909
928
compile_cmd=$( jq " .[] | select(.file == \" $abs_file \" ) |
910
929
.command" compile_commands.json)
911
930
if [[ -z " $compile_cmd " ]]; then
912
- echo " ::error file=$file ,line=0::$step_name : Was not compiled during kernel compilation, ensure defconfig enables it "
931
+ echo " ::error file=$file ,line=0::$step_name : Was not compiled during kernel compilation. "
913
932
fail=1
914
933
fi
915
934
;;
916
935
esac
917
936
918
937
done <<< " $files"
919
938
939
+ if [[ " $fail " == " true" ]]; then
940
+ _fmt " ::error ::$step_name : $error "
941
+ fi
942
+
920
943
return $fail
921
944
}
922
945
0 commit comments