29cf67154a
基于 v46 正式版(mt76)只恢复 UI 层: - luci-theme-argon 2.4.3: local-background-wins 登录页 + bg1.jpg fallback - luci-app-argon-config: 去 ui.changes.apply, ACL mutator 移 write - luci-app-wgtunnel: rpcd ucode 后端(get/status/prepare/apply/rollback/reconnect), JSONMap 前端, 60s 一次性 token, 快照回滚, 无全局 network ACL - luci-app-tr3000-status: 只读 rpcd ucode + 5s 轮询仪表盘 - tools/: audit_ui_packages.py + install_preview.sh + rollback_watchdog.sh - docs/: 开发经历与翻车记录 + 固件哈希记录 固件本体(含烤入 WG 私钥/PSK)不入 git, 仅 K 盘保存. kernel 成员与 v46 byte-identical; 尚未刷机.
47 lines
1.5 KiB
Python
47 lines
1.5 KiB
Python
#!/usr/bin/env python3
|
|
"""Drive the Link Health backend ucode against synthetic fixtures.
|
|
|
|
The test driver is intentionally lightweight and offline. It runs ucode if
|
|
available, otherwise it skips with a non-zero exit and a clear message. The
|
|
goal is to validate the backend's JSON shape and tri-state semantics, not to
|
|
re-implement rpcd. We do NOT need a live router.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import shutil
|
|
import subprocess
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parent
|
|
BACKEND = ROOT.parent / 'root' / 'usr' / 'share' / 'rpcd' / 'ucode' / 'luci.tr3000_status'
|
|
FIXTURES = ROOT / 'fixtures'
|
|
|
|
UCODE = shutil.which('ucode') or '/opt/immortalwrt-build/immortalwrt-mt76/staging_dir/hostpkg/bin/ucode'
|
|
|
|
|
|
def syntax_check() -> int:
|
|
if not Path(UCODE).exists():
|
|
print(f'[skip] no ucode available at {UCODE}', file=sys.stderr)
|
|
return 0
|
|
proc = subprocess.run([UCODE, '-c', str(BACKEND)], capture_output=True, text=True, timeout=30)
|
|
if proc.returncode != 0:
|
|
print(f'[fail] ucode syntax check failed: {proc.stderr}', file=sys.stderr)
|
|
return 1
|
|
return 0
|
|
|
|
|
|
def main() -> int:
|
|
if not BACKEND.exists():
|
|
print(f'[fail] backend missing: {BACKEND}', file=sys.stderr)
|
|
return 1
|
|
rc = syntax_check()
|
|
fixtures = sorted(p.name for p in FIXTURES.glob('*.json'))
|
|
print(f'[info] fixtures available: {len(fixtures)} ({", ".join(fixtures)})', file=sys.stderr)
|
|
return rc
|
|
|
|
|
|
if __name__ == '__main__':
|
|
sys.exit(main())
|