cb424d7448
verify-patch-sanity.py validates every active recipe .patch has internally- consistent hunk line counts — catching the 'malformed patch at line N' failure at commit/CI/preflight time instead of hours into a cook. This cycle hit that class three times (qtwaylandscanner, sddm, xwayland), each only discovered when cookbook tried to apply the patch. Running it across the repo found 29 latent malformed patches (validated against GNU patch: e.g. relibc/P3-sysv-ipc reproduces 'malformed patch at line 22'). They were harmless only because they sit in vendored recipes (baked, not re- applied) — but would fail on any version-bump re-derivation. --fix recounts the hunk headers (body untouched) and repaired all 29. Wired into build-preflight.sh (Phase 1.0D) and redbear-ci.yml, with a unit test (test-patch-sanity.sh). Skips archived/legacy trees and unvalidatable formats (empty placeholders, bare-@@ git hunks).
32 lines
1.4 KiB
Plaintext
32 lines
1.4 KiB
Plaintext
## Checking crashes against injected binary functions created by patch
|
|
## entries pass and debug info turned on. In these cases, we were
|
|
## trying to fetch input to output maps on injected functions and
|
|
## crashing.
|
|
|
|
REQUIRES: system-linux
|
|
|
|
RUN: %clang %cflags -no-pie -g %p/Inputs/patch-entries.c -fuse-ld=lld -o %t.exe \
|
|
RUN: -Wl,-q -I%p/../Inputs
|
|
RUN: llvm-bolt -relocs %t.exe -o %t.out --update-debug-sections --force-patch \
|
|
RUN: --enable-bat
|
|
|
|
## Check that patched functions can be disassembled (override FDE from the
|
|
## original function)
|
|
# PREAGG: B X:0 #foo.org.0# 1 0
|
|
RUN: link_fdata %s %t.out %t.preagg PREAGG
|
|
RUN: perf2bolt %t.out -p %t.preagg --pa -o %t.yaml --profile-format=yaml \
|
|
RUN: -print-disasm -print-only=foo.org.0/1 2>&1 | FileCheck %s
|
|
CHECK-NOT: BOLT-WARNING: sizes differ for function foo.org.0/1
|
|
CHECK: Binary Function "foo.org.0/1(*2)" after disassembly {
|
|
|
|
## Check the expected eh_frame contents
|
|
RUN: llvm-nm --print-size %t.out > %t.foo
|
|
RUN: llvm-objdump %t.out --dwarf=frames >> %t.foo
|
|
RUN: FileCheck %s --input-file %t.foo --check-prefix=CHECK-FOO
|
|
CHECK-FOO: 0000000000[[#%x,FOO:]] [[#%x,OPTSIZE:]] t foo
|
|
CHECK-FOO: 0000000000[[#%x,ORG:]] [[#%x,ORGSIZE:]] t foo.org.0
|
|
## patched FDE comes first
|
|
CHECK-FOO: FDE {{.*}} pc=00[[#%x,ORG]]...00[[#%x,ORG+ORGSIZE]]
|
|
## original FDE comes second
|
|
CHECK-FOO: FDE {{.*}} pc=00[[#%x,ORG]]...00[[#%x,ORG+OPTSIZE]]
|