685a366890
原来 test/host 一层混了三类东西:51 个主机侧单测模块目录、25 个台架驱动 与探针、若干专用目录。台架脚本平铺在顶层,与单测目录并列,看不出哪个是 「连板跑一次的」,也看不出加新脚本该往哪放。 现在按被验对象分域归档,单测模块目录一律不动(22 根 pre-commit 钩子逐个 点名它们,50 个运行器按固定层数推仓库根): - bench/bench_defaults.py 台架连接默认值单一真源 - bench/ftp/ (10) FTP 功能、速率、鉴权、中止、完整性、背靠背复现 - bench/net/ (9) CH395F socket、keepalive 判死、挂机、复连压力、PASV、 UDP 队列、链路时延对端 - bench/iec104/ (2) 主站客户端与它的离线样帧自检 - bench/wave/ (1) 录波段文件 PC 侧解码 - bench/screenlink/ (2) 屏板链路顶替与拉帧压测 顶层条目 78 -> 53。逐脚本作用、运行前置与「加新脚本往哪放」写在新建的 test/host/bench/README.md;test/host/README.md 增目录地图表,把原平铺的 网络/FTP 两节压成指针。 配套修正(移动后不修就会坏): - 17 个脚本加上 bench/ 到 sys.path 的 bootstrap(sys.path[0] 是脚本自身 目录,不补就 import bench_defaults 失败) - cal/cal_write.py 本来就坏的(只插 cal/ 到自己 sys.path,import bench_defaults 直接 ModuleNotFoundError),补两段路径后可用 - e6_soak 与 wave_read 用 dirname 固定层数推仓库根,多两层后分别指向 test/test 与 test/ci-artifacts(后者静默写错目录、不报错),层数已改对 - scripts/board_ui_nav.py 与 MDK-ARM 两个探针的 bench_defaults 搜索路径 清理与标注:删掉 test/host/iec104/(旧自研协议层单测退役后只剩一个零引用 的 stub 桩头);文档里对 test/host/iec104 与 iec104_serv 的引用加上「已 删除/已不存在 2026-11-18」状态词。冻结历史证据(带日期戳的台架日志)与 编号别名登记表里的旧路径按原样保留。
67 lines
2.6 KiB
Python
67 lines
2.6 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
"""E6 24h soak driver (U15 mismatch frequency, self-heal design anchor E6).
|
|
|
|
Protocol (docs/网络/网络自愈架构设计.md §4.8, anchor §5.2 E6):
|
|
24h normal operation + periodic E1 stress injection:
|
|
- every hour : relisten_stress :7003 n=10 gap=100 (UI-like churn)
|
|
- every 4th hour : full E1 (:7003 n=50 gap=0 + :21 n=50 gap=100)
|
|
Device-side confirmed hits are counted by the NET_U15_PROBE firmware and
|
|
appear in the serial log as "U15 probe: sockN rx=... hits=N" (first hit
|
|
immediately, then <=1/hour). Read the verdict from serial.log afterwards.
|
|
|
|
Usage: python e6_soak.py [--hours 24]
|
|
Exit: 0 = soak completed; nonzero = driver error (device untouched).
|
|
"""
|
|
import argparse
|
|
import os
|
|
import subprocess
|
|
import sys
|
|
import time
|
|
|
|
# 本脚本归档在 test/host/bench/net/:向上 5 级才到仓库根(多出 bench/ 与域目录两层)。
|
|
ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(
|
|
os.path.abspath(__file__))))))
|
|
STRESS = os.path.join(ROOT, "test", "host", "bench", "net", "relisten_stress.py")
|
|
|
|
|
|
def log(msg):
|
|
print("[%s] %s" % (time.strftime("%m-%d %H:%M:%S"), msg), flush=True)
|
|
|
|
|
|
def burst(args_list, tag):
|
|
t0 = time.time()
|
|
try:
|
|
r = subprocess.run([sys.executable, STRESS] + args_list,
|
|
capture_output=True, text=True, timeout=900)
|
|
out = (r.stdout or "") + (r.stderr or "")
|
|
tail = [ln for ln in out.splitlines() if "ok=" in ln or "latency" in ln]
|
|
dt = time.time() - t0
|
|
log("%s rc=%d %.0fs %s" % (tag, r.returncode, dt, " | ".join(tail[-2:])))
|
|
except Exception as e: # driver hiccup must not abort the soak
|
|
log("%s ERROR %r" % (tag, e))
|
|
|
|
|
|
def main():
|
|
ap = argparse.ArgumentParser()
|
|
ap.add_argument("--hours", type=int, default=24)
|
|
a = ap.parse_args()
|
|
|
|
log("E6 soak start: %d h, hourly :7003x10, every-4h E1 full" % a.hours)
|
|
t_start = time.time()
|
|
for h in range(1, a.hours + 1):
|
|
# sleep first: hour boundary cadence
|
|
remain = t_start + h * 3600.0 - time.time()
|
|
if remain > 0:
|
|
time.sleep(remain)
|
|
burst(["--port", "7003", "--n", "10", "--gap-ms", "100"], "hour%02d :7003x10" % h)
|
|
if h % 4 == 0:
|
|
burst(["--port", "7003", "--n", "50", "--gap-ms", "0"], "hour%02d E1 :7003x50g0" % h)
|
|
burst(["--port", "21", "--n", "50", "--gap-ms", "100"], "hour%02d E1 :21x50g100" % h)
|
|
log("E6 soak done: %.1f h elapsed" % ((time.time() - t_start) / 3600.0))
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|