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).
65 lines
1.6 KiB
TableGen
65 lines
1.6 KiB
TableGen
// RUN: llvm-tblgen %s | FileCheck %s
|
|
// RUN: not llvm-tblgen -DERROR1 %s 2>&1 | FileCheck --check-prefix=ERROR1 %s
|
|
|
|
// This file contains tests for the !find bang operator.
|
|
|
|
defvar Sentence = "This is the end of the world.";
|
|
|
|
// CHECK: def Rec01
|
|
// CHECK-NEXT: int FirstThe = 8
|
|
// CHECK-NEXT: int SameThe = 8
|
|
// CHECK-NEXT: int SecondThe = 19
|
|
// CHECK-NEXT: int ThirdThe = -1
|
|
|
|
def Rec01 {
|
|
int FirstThe = !find(Sentence, "the");
|
|
int SameThe = !find(Sentence, "the", FirstThe);
|
|
int SecondThe = !find(Sentence, "the", !add(FirstThe, 1));
|
|
int ThirdThe = !find(Sentence, "the", !add(SecondThe, 1));
|
|
}
|
|
|
|
class C1<string name> {
|
|
string Name = name;
|
|
bit IsJr = !ne(!find(name, "Jr"), -1);
|
|
}
|
|
|
|
// CHECK: def Rec02
|
|
// CHECK-NEXT: string Name = "Sally Smith"
|
|
// CHECK-NEXT: bit IsJr = 0
|
|
// CHECK: def Rec03
|
|
// CHECK-NEXT: string Name = "Fred Jones, Jr."
|
|
// CHECK-NEXT: bit IsJr = 1
|
|
|
|
def Rec02 : C1<"Sally Smith">;
|
|
def Rec03 : C1<"Fred Jones, Jr.">;
|
|
|
|
// CHECK: def Rec04
|
|
// CHECK-NEXT: int ThisPos = 0
|
|
// CHECK-NEXT: int WorldPos = 23
|
|
// CHECK-NEXT: int TooLong = -1
|
|
|
|
def Rec04 {
|
|
int ThisPos = !find(Sentence, "This");
|
|
int WorldPos = !find(Sentence, "world.");
|
|
int TooLong = !find(Sentence, "world.country");
|
|
}
|
|
|
|
// CHECK: def Rec05
|
|
// CHECK-NEXT: string Name = "Pat Snork"
|
|
// CHECK-NEXT: bit IsJr = 0
|
|
// CHECK-NEXT: bit JrOrSnork = 1
|
|
|
|
def Rec05 : C1<"Pat Snork"> {
|
|
bit JrOrSnork = !or(IsJr, !ne(!find(Name, "Snork"), -1));
|
|
}
|
|
|
|
#ifdef ERROR1
|
|
|
|
// ERROR1: !find start position is out of range 0...29: 100
|
|
|
|
def Rec06 {
|
|
int Test1 = !find(Sentence, "the", 100);
|
|
}
|
|
#endif
|
|
|