Skip to content

Commit cd46ea5

Browse files
committed
tools check_headers.sh: Add check variant that excludes some hunks
With 6d74e1e ("tools/lib/list_sort: remove redundant code for cond_resched handling") we end up with a multi-line variation in the merge_final() implementation, one that the simple line based exceptions we had so far can't cope. Thus this check has been failing: Warning: Kernel ABI header differences: diff -u tools/lib/list_sort.c lib/list_sort.c So add a new check routine that uses grep -vf to exclude some hunks that we store in the tools/perf/check-header_ignore_hunks/ directory. This first patch is just the new check routine, the next one will use it to check lib/list_sort.c. Acked-by: Kuan-Wei Chiu <visitorckw@gmail.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Ian Rogers <irogers@google.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Kan Liang <kan.liang@linux.intel.com> Link: https://lore.kernel.org/lkml/20240930202136.16904-2-acme@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent d164868 commit cd46ea5

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

tools/perf/check-headers.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,30 @@ beauty_check () {
136136
check_2 "tools/perf/trace/beauty/$file" "$file" "$@"
137137
}
138138

139+
check_ignore_some_hunks () {
140+
orig_file="$1"
141+
tools_file="tools/$orig_file"
142+
hunks_to_ignore="tools/perf/check-header_ignore_hunks/$orig_file"
143+
144+
if [ ! -f "$hunks_to_ignore" ]; then
145+
echo "$hunks_to_ignore not found. Skipping $orig_file check."
146+
FAILURES+=(
147+
"$tools_file $orig_file"
148+
)
149+
return
150+
fi
151+
152+
cmd="diff -u \"$tools_file\" \"$orig_file\" | grep -vf \"$hunks_to_ignore\" | wc -l | grep -qw 0"
153+
154+
if [ -f "$orig_file" ] && ! eval "$cmd"
155+
then
156+
FAILURES+=(
157+
"$tools_file $orig_file"
158+
)
159+
fi
160+
}
161+
162+
139163
# Check if we have the kernel headers (tools/perf/../../include), else
140164
# we're probably on a detached tarball, so no point in trying to check
141165
# differences.

0 commit comments

Comments
 (0)