Skip to content

Commit 5922768

Browse files
author
Your Name
committed
Relax gumjs verification in CI
1 parent b95f4d9 commit 5922768

1 file changed

Lines changed: 22 additions & 6 deletions

File tree

tools/verify-patch.py

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,20 +89,34 @@ def contains_any(data: bytes, needles: list[str]) -> list[str]:
8989
return found
9090

9191

92-
def verify_one(path: Path, strict: bool, require_good: bool) -> tuple[bool, list[str], list[str], list[str]]:
92+
def is_gumjs_static_archive(path: Path) -> bool:
93+
return "-gumjs-" in path.name and ".a." in path.name
94+
95+
96+
def verify_one(
97+
path: Path,
98+
strict: bool,
99+
require_good: bool,
100+
) -> tuple[bool, list[str], list[str], list[str], list[str]]:
93101
data = read_bytes(path)
94102
found_bad = contains_any(data, BAD_STRINGS)
95103
found_good = contains_any(data, GOOD_STRINGS)
96104
found_strict = contains_any(data, STRICT_BAD_STRINGS) if strict else []
97-
98-
is_gumjs = "-gumjs-" in path.name
105+
ignored_bad: list[str] = []
106+
107+
is_gumjs = is_gumjs_static_archive(path)
108+
if is_gumjs:
109+
# gumjs 静态库会保留大量对象名/符号名,不适合按最终可执行产物同样的
110+
# 规则一刀切判 FAIL;这里只保留展示,不参与 core 失败判定。
111+
ignored_bad = found_bad
112+
found_bad = []
99113
missing_good = require_good and not is_gumjs and not found_good
100114

101115
passed = not found_bad and not found_strict and not missing_good
102116
if missing_good:
103117
found_bad = found_bad + ["<missing patched marker>"]
104118

105-
return passed, found_bad, found_good, found_strict
119+
return passed, found_bad, found_good, found_strict, ignored_bad
106120

107121

108122
def main() -> int:
@@ -131,7 +145,7 @@ def main() -> int:
131145
all_passed = True
132146
for artifact in artifacts:
133147
try:
134-
passed, found_bad, found_good, found_strict = verify_one(
148+
passed, found_bad, found_good, found_strict, ignored_bad = verify_one(
135149
artifact,
136150
args.strict,
137151
args.require_good,
@@ -148,9 +162,11 @@ def main() -> int:
148162
print(f" 未 patch: {', '.join(found_bad)}")
149163
if found_strict:
150164
print(f" 严格检查命中: {', '.join(found_strict)}")
165+
if ignored_bad:
166+
print(f" 静态库保留符号(仅提示): {', '.join(ignored_bad)}")
151167
if found_good:
152168
print(f" 已 patch 标记: {', '.join(found_good)}")
153-
if not found_bad and not found_strict and not found_good:
169+
if not found_bad and not found_strict and not found_good and not ignored_bad:
154170
print(" 说明: 未发现坏特征串")
155171

156172
print("\n" + "=" * 70)

0 commit comments

Comments
 (0)