Lines Matching +full:b +full:- +full:facing

2 # SPDX-License-Identifier: GPL-2.0-only
5 set -o errexit
6 set -o pipefail
11 $name - check for UAPI header stability across Git commits
15 check against additional commit ranges with the -b and -p options.
20 Usage: $name [-b BASE_REF] [-p PAST_REF] [-j N] [-l ERROR_LOG] [-i] [-q] [-v]
23 -b BASE_REF Base git reference to use for comparison. If unspecified or empty,
26 -p PAST_REF Compare BASE_REF to PAST_REF (e.g. -p v6.1). If unspecified or empty,
29 -j JOBS Number of checks to run in parallel (default: number of CPU cores).
30 -l ERROR_LOG Write error log to file (default: no error log is generated).
31 -i Ignore ambiguous changes that may or may not break UAPI compatibility.
32 -q Quiet operation.
33 -v Verbose operation (print more information about each header being checked).
68 local -a enum_regex=(
96 local -a padding_regex=(
99 ".*pad[0-9]?$"
100 ".*pad_[0-9]?$"
102 ".*padding[0-9]?$"
103 ".*padding_[0-9]?$"
106 ".*resv[0-9]?$"
107 ".*resv_[0-9]?$"
109 ".*reserved[0-9]?$"
110 ".*reserved_[0-9]?$"
111 ".*rsvd[0-9]?$"
141 ! git diff --quiet
146 local -r ref="$1"
147 local -r tree="$(get_header_tree "$ref")"
150 find "$tree" -type f -name '*.h' -printf '%P\n' | grep -v -f "$INCOMPAT_LIST"
155 local -r ref="$1"
159 if [ ! -f usr/include/Makefile ]; then
160 eprintf "error - no usr/include/Makefile present at %s\n" "$ref"
166 printf 'all: ; @echo $(no-header-test)\n'
168 } | SRCARCH="$ARCH" make --always-make -f - | tr " " "\n" \
169 | grep -v "asm-generic" >> "$INCOMPAT_LIST"
171 # The makefile also skips all asm-generic files, but prints "asm-generic/%"
173 printf "asm-generic/.*\.h\n" >> "$INCOMPAT_LIST"
178 local -r inc_dir="$1"
179 local -r header="$2"
180 local -r out="$3"
182 "$CC" -c \
183 -o "$out" \
184 -x c \
185 -O0 \
186 -std=c90 \
187 -fno-eliminate-unused-debug-types \
188 -g \
189 "-I${inc_dir}" \
190 -include "$header" \
191 -
196 local -r ref="$1"
197 local -r install_dir="$(get_header_tree "$ref")"
198 make -j "$MAX_THREADS" ARCH="$ARCH" INSTALL_HDR_PATH="$install_dir" \
204 local -r base_ref="$1"
205 local -r past_ref="$2"
208 printf "Installing user-facing UAPI headers from %s... " "${ref:-dirty tree}"
209 if [ -n "$ref" ]; then
210 git archive --format=tar --prefix="${ref}-archive/" "$ref" \
211 | (cd "$TMP_DIR" && tar xf -)
213 cd "${TMP_DIR}/${ref}-archive"
223 sort -u -o "$INCOMPAT_LIST" "$INCOMPAT_LIST"
224 sed -i -e '/^$/d' "$INCOMPAT_LIST"
229 local -r ref="$1"
235 local -r base_ref="$1"
236 local -r past_ref="$2"
237 local -r abi_error_log="$3"
241 local -a threads=()
242 set -o errexit
244 …printf "Checking changes to UAPI headers between %s and %s...\n" "$past_ref" "${base_ref:-dirty tr…
247 while read -r file; do
248 if [ "${#threads[@]}" -ge "$MAX_THREADS" ]; then
269 if [ -n "$abi_error_log" ]; then
271 "$0" "$*" "$(git rev-parse HEAD)" > "$abi_error_log"
274 while read -r error_file; do
278 } | tee -a "${abi_error_log:-/dev/null}" >&2
279 done < <(find "$TMP_DIR" -type f -name '*.error' | sort)
282 if [ "$failed" -gt 0 ]; then
283 …eprintf "error - %d/%d UAPI headers compatible with %s appear _not_ to be backwards compatible\n" \
285 if [ -n "$abi_error_log" ]; then
298 local -r base_ref="$1"
299 local -r past_ref="$2"
300 local -r file="$3"
302 local -r base_header="$(get_header_tree "$base_ref")/${file}"
303 local -r past_header="$(get_header_tree "$past_ref")/${file}"
305 if [ ! -f "$base_header" ]; then
306 mkdir -p "$(dirname "$base_header")"
316 # Perform the A/B compilation and compare output ABI
318 local -r file="$1"
319 local -r base_header="$2"
320 local -r past_header="$3"
321 local -r base_ref="$4"
322 local -r past_ref="$5"
323 local -r log="${TMP_DIR}/log/${file}.log"
324 local -r error_log="${TMP_DIR}/log/${file}.error"
326 mkdir -p "$(dirname "$log")"
334 printf -- "=%.0s" $(seq 0 ${#warn_str})
345 printf -- "=%.0s" $(seq 0 ${#warn_str})
351 "$ABIDIFF" --non-reachable-types \
352 --suppressions "$SUPPRESSIONS" \
354 if [ "$ret" -eq 0 ]; then
356 printf "No ABI differences detected in %s from %s -> %s\n" \
361 if [ $((ret & 0x2)) -gt 0 ]; then
362 eprintf "error - abidiff did not run properly\n"
366 if [ "$IGNORE_AMBIGUOUS_CHANGES" = "true" ] && [ "$ret" -eq 4 ]; then
372 if grep "Unreachable types summary" "$log" | grep -q "0 removed" &&
373 grep "Unreachable types summary" "$log" | grep -q "0 changed"; then
378 warn_str=$(printf "==== ABI differences detected in %s from %s -> %s ====" \
381 sed -e '/summary:/d' -e '/changed type/d' -e '/^$/d' -e 's/^/ /g' "$log"
382 printf -- "=%.0s" $(seq 0 ${#warn_str})
384 … printf "\n%s did not change between %s and %s...\n" "$file" "$past_ref" "${base_ref:-dirty tree}"
397 local -r min_version="$1"
398 local -r version_installed="$2"
401 | sort -Vc > /dev/null 2>&1
406 ABIDIFF="${ABIDIFF:-abidiff}"
407 CC="${CC:-gcc}"
408 ARCH="${ARCH:-$(uname -m)}"
413 local -r abidiff_min_version="2.4"
414 local -r libdw_min_version_if_clang="0.171"
416 if ! command -v "$ABIDIFF" > /dev/null 2>&1; then
417 eprintf "error - abidiff not found!\n"
418 eprintf "Please install abigail-tools version %s or greater\n" "$abidiff_min_version"
419 eprintf "See: https://sourceware.org/libabigail/manual/libabigail-overview.html\n"
423 local -r abidiff_version="$("$ABIDIFF" --version | cut -d ' ' -f 2)"
425 eprintf "error - abidiff version too old: %s\n" "$abidiff_version"
426 eprintf "Please install abigail-tools version %s or greater\n" "$abidiff_min_version"
427 eprintf "See: https://sourceware.org/libabigail/manual/libabigail-overview.html\n"
431 if ! command -v "$CC" > /dev/null 2>&1; then
432 eprintf 'error - %s not found\n' "$CC"
436 if "$CC" --version | grep -q clang; then
437 …local -r libdw_version="$(ldconfig -v 2>/dev/null | grep -v SKIPPED | grep -m 1 -o 'libdw-[0-9]\+.…
439 eprintf "error - libdw version too old for use with clang: %s\n" "$libdw_version"
446 if [ ! -d "arch/${ARCH}" ]; then
447 eprintf 'error - ARCH "%s" is not a subdirectory under arch/\n' "$ARCH"
448 …eprintf "Please set ARCH to one of:\n%s\n" "$(find arch -maxdepth 1 -mindepth 1 -type d -printf '%…
452 if ! git rev-parse --is-inside-work-tree > /dev/null 2>&1; then
453 eprintf "error - this script requires the kernel tree to be initialized with Git\n"
457 if ! git rev-parse --verify "$past_ref" > /dev/null 2>&1; then
458 printf 'error - invalid git reference "%s"\n' "$past_ref"
462 if [ -n "$base_ref" ]; then
463 if ! git merge-base --is-ancestor "$past_ref" "$base_ref" > /dev/null 2>&1; then
464 printf 'error - "%s" is not an ancestor of base ref "%s"\n' "$past_ref" "$base_ref"
467 if [ "$(git rev-parse "$base_ref")" = "$(git rev-parse "$past_ref")" ]; then
468 printf 'error - "%s" and "%s" are the same reference\n' "$past_ref" "$base_ref"
480 if [ -z "$KERNEL_SRC" ]; then
486 if [ -z "$base_ref" ] && ! tree_is_dirty; then
490 if [ -z "$past_ref" ]; then
491 if [ -n "$base_ref" ]; then
502 TMP_DIR=$(mktemp -d)
504 trap 'rm -rf "$TMP_DIR"' EXIT
516 …if diff -r -q "$(get_header_tree "$base_ref")" "$(get_header_tree "$past_ref")" > /dev/null 2>&1; …
517 …printf "No changes to UAPI headers were applied between %s and %s\n" "$past_ref" "${base_ref:-dirt…
538 b)