diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2024-09-30 17:07:28 -0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2024-10-02 14:50:44 -0300 |
commit | cd46ea5ab48667e9522608533b9a24e3028fa368 (patch) | |
tree | 744c6736d15c1583d3550e8778f8d7cf87bdc930 /tools | |
parent | d1648688799dd14075c43e2d091be815c794f331 (diff) | |
download | lwn-cd46ea5ab48667e9522608533b9a24e3028fa368.tar.gz lwn-cd46ea5ab48667e9522608533b9a24e3028fa368.zip |
tools check_headers.sh: Add check variant that excludes some hunks
With 6d74e1e371d43a7b ("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>
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/perf/check-headers.sh | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tools/perf/check-headers.sh b/tools/perf/check-headers.sh index 714c78e5da07..55aba47e5aec 100755 --- a/tools/perf/check-headers.sh +++ b/tools/perf/check-headers.sh @@ -136,6 +136,30 @@ beauty_check () { check_2 "tools/perf/trace/beauty/$file" "$file" "$@" } +check_ignore_some_hunks () { + orig_file="$1" + tools_file="tools/$orig_file" + hunks_to_ignore="tools/perf/check-header_ignore_hunks/$orig_file" + + if [ ! -f "$hunks_to_ignore" ]; then + echo "$hunks_to_ignore not found. Skipping $orig_file check." + FAILURES+=( + "$tools_file $orig_file" + ) + return + fi + + cmd="diff -u \"$tools_file\" \"$orig_file\" | grep -vf \"$hunks_to_ignore\" | wc -l | grep -qw 0" + + if [ -f "$orig_file" ] && ! eval "$cmd" + then + FAILURES+=( + "$tools_file $orig_file" + ) + fi +} + + # Check if we have the kernel headers (tools/perf/../../include), else # we're probably on a detached tarball, so no point in trying to check # differences. |