Files

53 lines
2.7 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# tools
留在这里的都是**还在用**的工具;一次性探针用完就删(历史里能翻到)。
| 工具 | 用途 |
|---|---|
| `verify_export_structure.py` | 结构级对比:导出的 `.rondbackup` / `.fwss` 与真机原版比表、列、行数、悬空引用。导出改动后必跑。 |
| `verify_rondbackup.py` | 逐字段对比两个 `.rondbackup`(含 `Z_METADATA` 等字节哈希),比上面那个更细。 |
| `photo_coord_audit.py` | 照片导入的坐标体检与批量换算(GCJ-02 / WGS-84)。 |
| `audit_db.sql` | 库内一致性审计:`psql "<dsn>" -f tools/audit_db.sql`。 |
## 验收
`../scripts/verify.sh`(封了六个环境变量,会数 SKIP,拒绝假绿):
```bash
./scripts/verify.sh # 全量,0 skip 才算过
./scripts/verify.sh --fast # gofmt + vet + build
./scripts/verify.sh --race --pkg ./internal/web/
./scripts/verify.sh --cover # 覆盖率,-coverpkg 口径
./scripts/verify.sh --smoke # 关键页冒烟(要站点在 8080 上跑着)
./scripts/verify.sh --all # 全量 + 冒烟
```
### `--cover` 为什么要 `-coverpkg`
`go test -cover` 只统计「测试文件所在的那个包」自己的执行。本项目大量代码是被**别的包**
驱动的——`internal/rond` 的导出流程由 `internal/web` 的用例跑,`geo`/`gpx`/`notes`/`votes`
由 `web`/`stats` 跑——按 `-cover` 量这些包会一律报 **0%**,看着像没测,其实全都在跑。
`--cover` 用 `-coverpkg=./internal/...` 把跨包执行算进来。实测差别:
| 包 | `-cover`(假) | `-coverpkg`(真) |
|---|---|---|
| `internal/rond` | 38.8% | 79.1%(由 `internal/web` 的用例贡献) |
### 关键页冒烟:`../scripts/smoke.py`
Go 侧模板守卫只能证明「模板里有那段文字」,证明不了浏览器打开后看得到——白屏、JS 抛错、
内容区块被压成 0 高,模板测试全都是绿的。冒烟按三种口径各走一遍:
1. **站长(浏览器)**:每页断言 HTTP 200、落点路径没跳走、内容区块在且尺寸非 0、零 JS 报错
2. **访客(纯 HTTP)**:公开页 200;后台页必须 303 跳登录(绝不能 200)
3. **访客(浏览器)抽检**:`/` 与地点详情,只在访客侧复现的 bug 藏在这里
```bash
python scripts/smoke.py --only /map # 单页调试
python scripts/smoke.py --shot-dir storage/.verify/smoke # 顺带存整屏截图
```
依赖 `rond-web-verify` 技能里的 `site_cdp.py`(CDP 直连本机 Chrome);用 `ROND_CDP`
指过去,默认取 `~/.workbuddy/skills/rond-web-verify/scripts/site_cdp.py`。
站点得先在 `ROND_BASE`(默认 `http://localhost:8080`)上跑着,否则直接报错退出。