You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
1.1 KiB

"""回归汇总 + BOM 扫描(无敏感信息;在 repo 根目录执行)。
用法python .scratch/customer-module/tools/regress_check.py
依赖三模块已跑过 mvn testsurefire-reports 就位
"""
import re
import glob
# 1) BOM scan: all crm-* module java sources
bom_files = []
total = 0
for p in glob.glob('crm-*/src/**/*.java', recursive=True):
total += 1
with open(p, 'rb') as fh:
if fh.read(3) == b'\xef\xbb\xbf':
bom_files.append(p)
print(f'BOM-SCAN: scanned={total} bom_hits={len(bom_files)}')
for b in bom_files[:20]:
print(' BOM:', b)
# 2) surefire aggregate for the 3 regression modules
t = f = e = n = 0
for mod in ('crm-rule', 'crm-customer', 'crm-opportunity'):
files = glob.glob(f'{mod}/target/surefire-reports/*.txt')
for p in files:
s = open(p, encoding='utf-8', errors='ignore').read()
m = re.search(r'Tests run: (\d+), Failures: (\d+), Errors: (\d+)', s)
if m:
t += int(m.group(1)); f += int(m.group(2)); e += int(m.group(3)); n += 1
print(f'SUREFIRE modules=3 classes={n} Tests={t} Failures={f} Errors={e}')