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).
45 lines
1.5 KiB
TableGen
45 lines
1.5 KiB
TableGen
// RUN: llvm-tblgen -dump-json %s | %python %S/JSON-check.py %s
|
|
|
|
def Simple {}
|
|
// CHECK: data['Simple']['!locs'] == ['JSON-locs.td:3']
|
|
|
|
multiclass Multiclass1 {
|
|
def Instance1 {}
|
|
def Instance2 {}
|
|
}
|
|
|
|
defm DefM1 : Multiclass1;
|
|
|
|
// CHECK: data['DefM1Instance1']['!locs'] == ['JSON-locs.td:7', 'JSON-locs.td:11']
|
|
// CHECK: data['DefM1Instance2']['!locs'] == ['JSON-locs.td:8', 'JSON-locs.td:11']
|
|
|
|
multiclass Multiclass2 {
|
|
def Instance3 {}
|
|
def Instance4 {}
|
|
}
|
|
|
|
defm DefM2 : Multiclass1, Multiclass2;
|
|
// CHECK: data['DefM2Instance1']['!locs'] == ['JSON-locs.td:7', 'JSON-locs.td:21']
|
|
// CHECK: data['DefM2Instance2']['!locs'] == ['JSON-locs.td:8', 'JSON-locs.td:21']
|
|
// CHECK: data['DefM2Instance3']['!locs'] == ['JSON-locs.td:17', 'JSON-locs.td:21']
|
|
// CHECK: data['DefM2Instance4']['!locs'] == ['JSON-locs.td:18', 'JSON-locs.td:21']
|
|
|
|
multiclass Multiclass3 {
|
|
defm InnerDefM : Multiclass1;
|
|
def Instance5 {}
|
|
}
|
|
|
|
defm DefM3: Multiclass3;
|
|
// CHECK: data['DefM3InnerDefMInstance1']['!locs'] == ['JSON-locs.td:7', 'JSON-locs.td:28', 'JSON-locs.td:32']
|
|
// CHECK: data['DefM3InnerDefMInstance2']['!locs'] == ['JSON-locs.td:8', 'JSON-locs.td:28', 'JSON-locs.td:32']
|
|
// CHECK: data['DefM3Instance5']['!locs'] == ['JSON-locs.td:29', 'JSON-locs.td:32']
|
|
|
|
class BaseClass {}
|
|
class DerivedClass : BaseClass {}
|
|
// Classes do not appear in the JSON, so do not get locations.
|
|
// CHECK: 'BaseClass' not in data
|
|
// CHECK: 'DerivedClass' not in data
|
|
|
|
def ClassInstance : DerivedClass {}
|
|
// CHECK: data['ClassInstance']['!locs'] == ['JSON-locs.td:43']
|