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).
51 lines
3.3 KiB
C
51 lines
3.3 KiB
C
// RUN: %clang %s -target arm64-apple-darwin -emit-llvm -S -fsanitize-coverage=trace-pc-guard -mllvm -sanitizer-coverage-gated-trace-callbacks=1 -o - | FileCheck %s --check-prefixes=CHECK,GATED
|
|
// RUN: %clang %s -target arm64-apple-darwin -emit-llvm -S -fsanitize-coverage=trace-pc-guard -mllvm -sanitizer-coverage-gated-trace-callbacks=0 -o - | FileCheck %s --check-prefixes=CHECK,PLAIN
|
|
// RUN: %clang %s -target arm64-apple-darwin -emit-llvm -S -fsanitize-coverage=trace-pc-guard,trace-cmp -mllvm -sanitizer-coverage-gated-trace-callbacks=1 -o - | FileCheck %s --check-prefixes=CHECK,GATED,GATEDCMP
|
|
// RUN: %clang %s -target arm64-apple-darwin -emit-llvm -S -fsanitize-coverage=trace-pc-guard,trace-cmp -mllvm -sanitizer-coverage-gated-trace-callbacks=0 -o - | FileCheck %s --check-prefixes=CHECK,PLAIN,PLAINCMP
|
|
// RUN: not %clang %s -target arm64-apple-darwin -emit-llvm -S -fsanitize-coverage=trace-pc -mllvm -sanitizer-coverage-gated-trace-callbacks=1 -o /dev/null 2>&1 | FileCheck %s --check-prefixes=INCOMPATIBLE
|
|
// RUN: not %clang %s -target arm64-apple-darwin -emit-llvm -S -fsanitize-coverage=inline-8bit-counters -mllvm -sanitizer-coverage-gated-trace-callbacks=1 -o /dev/null 2>&1 | FileCheck %s --check-prefixes=INCOMPATIBLE
|
|
// RUN: not %clang %s -target arm64-apple-darwin -emit-llvm -S -fsanitize-coverage=inline-bool-flag -mllvm -sanitizer-coverage-gated-trace-callbacks=1 -o /dev/null 2>&1 | FileCheck %s --check-prefixes=INCOMPATIBLE
|
|
|
|
// Verify that we do not emit the __sancov_gate section for "plain" trace-pc-guard
|
|
// GATED: section "__DATA,__sancov_gate"
|
|
// PLAIN-NOT: section "__DATA,__sancov_gate"
|
|
|
|
// Produce an error for all incompatible sanitizer coverage modes.
|
|
// INCOMPATIBLE: error: 'sanitizer-coverage-gated-trace-callbacks' is only supported with trace-pc-guard or trace-cmp
|
|
|
|
int x[10];
|
|
|
|
// CHECK: define{{.*}} void @foo
|
|
void foo(int n, int m) {
|
|
// COM: Verify that we're emitting the call to __sanitizer_cov_trace_pc_guard upon
|
|
// COM: checking the value of __sancov_should_track.
|
|
// GATED: [[VAL:%.*]] = load i64, {{.*}}@__sancov_should_track
|
|
// GATED-NOT: [[VAL:%.*]] = load i64, i64* @__sancov_should_track
|
|
// GATED-NEXT: [[CMP:%.*]] = icmp ne i64 [[VAL]], 0
|
|
// GATED-NEXT: br i1 [[CMP]], label %[[L_TRUE:.*]], label %[[L_FALSE:.*]], !prof [[WEIGHTS:!.+]]
|
|
// GATED: [[L_TRUE]]:
|
|
// GATED-NEXT: call void @__sanitizer_cov_trace_pc_guard
|
|
// COM: Check the trace-cmp instrumentation of the if (n) branch
|
|
// GATEDCMP: [[OPERAND:%.*]] = load i32, {{.*}}
|
|
// GATEDCMP-NEXT: br i1 [[CMP]], label %[[L_TRUE_1:.*]], label %[[L_FALSE_1:.*]]
|
|
// GATEDCMP: [[L_TRUE_1]]:
|
|
// GATEDCMP-NEXT: call void @__sanitizer_cov_trace_const_cmp4(i32 0, i32 [[OPERAND]])
|
|
// GATED: br i1 [[CMP]], label %[[L_TRUE_2:.*]], label %[[L_FALSE_2:.*]]
|
|
// GATED: [[L_TRUE_2]]:
|
|
// GATED-NEXT: call void @__sanitizer_cov_trace_pc_guard
|
|
// GATED: [[WEIGHTS]] = !{!"branch_weights", i32 1, i32 100000}
|
|
|
|
// COM: With the non-gated instrumentation, we should not emit the
|
|
// COM: __sancov_should_track global.
|
|
// PLAIN-NOT: __sancov_should_track
|
|
// But we should still be emitting the calls to the callback.
|
|
// PLAIN: call void @__sanitizer_cov_trace_pc_guard
|
|
// PLAINCMP: [[OPERAND:%.*]] = load i32, {{.*}}
|
|
// PLAINCMP-NEXT: call void @__sanitizer_cov_trace_const_cmp4(i32 0, i32 [[OPERAND]])
|
|
if (n) {
|
|
x[n] = 42;
|
|
if (m) {
|
|
x[m] = 41;
|
|
}
|
|
}
|
|
} |