Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,19 +113,19 @@ jobs:
find . -type f -name *.ko | \
xargs -I % cp --parents % dist/modules

- name: Assert compiled
if: ${{ env.AUTO_FROM_RANGE == 'true' }}
run: |
source ci/build.sh
assert_compiled

- name: Assert state
if: ${{ failure() }}
run: |
source ci/build.sh
set_step_fail "assert_state"
echo "fatal=true" >> "$GITHUB_ENV"

- name: Assert compiled
if: ${{ !cancelled() && env.fatal != 'true' && env.AUTO_FROM_RANGE == 'true' }}
run: |
source ci/build.sh
assert_compiled

- name: Sparse
if: ${{ !cancelled() && env.fatal != 'true' && env.CHECKS_SPARCE == 'true' }}
run: |
Expand Down
25 changes: 24 additions & 1 deletion ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,7 @@ compile_kernel_smatch() {

compile_gcc_fanalyzer () {
export step_name="gcc_fanalyzer"
local exceptions_file="ci/travis/deadcode_exceptions"
local files=$(git diff --diff-filter=ACM --no-renames --name-only $base_sha..$head_sha)
local regex='^[[:alnum:]/._-]+:[[:digit:]]+:[[:digit:]]+: .*$'
local mail=
Expand All @@ -730,6 +731,10 @@ compile_gcc_fanalyzer () {
return 1
fi

if [[ -f $exceptions_file ]]; then
files=$(comm -13 <(sort $exceptions_file) <(echo $files | tr ' ' '\n' | sort))
fi

while read file; do
case "$file" in
*.c)
Expand Down Expand Up @@ -891,8 +896,17 @@ compile_clang_analyzer () {

assert_compiled () {
export step_name="assert_compiled"
local exceptions_file="ci/travis/deadcode_exceptions"
local files=$(git diff --diff-filter=ACM --no-renames --name-only $base_sha..$head_sha)
local fail=0
local error="
At least one file was not compiled during kernel compilation
Either:
1. ensure the Kconfig is able to enable it/them
OR
2. remove deadcode
OR
3. add it/them in file '$exceptions_file'"

echo "$step_name were compiled on range $base_sha..$head_sha"

Expand All @@ -901,6 +915,11 @@ assert_compiled () {
return 1
fi

# Allows deadcode
if [[ -f $exceptions_file ]]; then
files=$(comm -13 <(sort $exceptions_file) <(echo $files | tr ' ' '\n' | sort))
fi

while read file; do
case "$file" in
*.c)
Expand All @@ -909,14 +928,18 @@ assert_compiled () {
compile_cmd=$(jq ".[] | select(.file == \"$abs_file\") |
.command" compile_commands.json)
if [[ -z "$compile_cmd" ]]; then
echo "::error file=$file,line=0::$step_name: Was not compiled during kernel compilation, ensure defconfig enables it"
echo "::error file=$file,line=0::$step_name: Was not compiled during kernel compilation."
fail=1
fi
;;
esac

done <<< "$files"

if [[ "$fail" == "true" ]]; then
_fmt "::error ::$step_name: $error"
fi

return $fail
}

Expand Down
4 changes: 2 additions & 2 deletions ci/symbols_depend.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def track_if_blocks(symbol, target_kconfig):

for kconfig in get_all_parent_kconfigs(path.dirname(target_kconfig)):
if debug:
print(f"{target_kconfig}: Tracking if blocks at '{kconfig}'",
print(f"{target_kconfig}: Tracking if blocks at '{kconfig}' for symbol '{symbol}'",
file=stderr)
with open(kconfig, 'r') as f:
lines = f.readlines()
Expand All @@ -74,7 +74,7 @@ def track_if_blocks(symbol, target_kconfig):
line_ = line.strip()
if line.startswith('if '):
stack.append(line[3:].strip())
elif line_ == 'endif':
elif line_.startswith('endif'):
if stack:
stack.pop()
elif line_.startswith('source') and line_.endswith('Kconfig"'):
Expand Down