dsh-adb 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -7
- package/lib/adb.js +1 -1
- package/lib/tools/perf.js +5 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -64,16 +64,51 @@ npm pack --dry-run # 校验发布包内容(lib/ + cordis.patch.yml)
|
|
|
64
64
|
|
|
65
65
|
注意:本机若设了 `NODE_ENV=production`,npm 会跳过 devDependencies,安装时用 `npm install --include=dev`。
|
|
66
66
|
|
|
67
|
-
## 真机/台架冒烟(2026-08-14,SA_DIREWOLF_IVI
|
|
67
|
+
## 真机/台架冒烟(2026-08-14,SA_DIREWOLF_IVI 台架,Android 13)
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
headless profile 端到端验证(`dsh --profile bench "任务"`),**7 个工具全部实测通过**:
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
| 工具 | 实测结果 |
|
|
72
|
+
| --- | --- |
|
|
73
|
+
| `adb_devices` | ✅ 返回 `f20c9b04 device msmnile_gvmq_for_arm64` |
|
|
74
|
+
| `adb_connect` / `adb_disconnect` | ✅ 不可达端点正确返回 CONNECT_FAILED;disconnect 正常 |
|
|
75
|
+
| `adb_logcat`(前向) | ✅ level=E tail=5 返回真实错误日志 |
|
|
76
|
+
| `adb_logcat`(后台采集) | ✅ job_output 读回 43065 行/7MB 流,job_kill 正常 |
|
|
77
|
+
| `adb_install` | ✅ pull 真机 apk → `install -r` → "Performing Streamed Install / Success" |
|
|
78
|
+
| `adb_file` | ✅ ls / push / pull 往返字节一致 |
|
|
79
|
+
| `adb_perf_snapshot` | ✅ meminfo(SystemUI PSS 131MB)+ gfxinfo(232 帧/60.78% 卡顿)解析正确;battery 空(台架无电池服务) |
|
|
80
|
+
|
|
81
|
+
配置覆盖(`adbPath`/`defaultSerial`)✅ · 错误码(`ADB_NOT_FOUND`/`CONNECT_FAILED`)✅
|
|
82
|
+
|
|
83
|
+
> 冒烟发现并修复三个已发布 bug:
|
|
84
|
+
> - **v0.1.0 → v0.1.1**:`ctx.tools.register` 未声明 `inject: ['tools']` 导致加载失败(Cordis Guard 拒绝未声明依赖)
|
|
85
|
+
> - **v0.1.1 → v0.1.2**:后台 logcat 的 `readOutput` 返回 `{added,text}` 对象,违反 jobs 契约(须返回字符串)导致 `job_output` 报 `value.text must be a string`
|
|
86
|
+
> - **v0.1.2 → v0.1.3**:`DEVICE_NOT_FOUND` 分类只匹配带 `error:` 前缀的 adb 输出,真实输出 `adb.exe: device 'X' not found` 落入通用 `ADB_EXIT_1`
|
|
75
87
|
|
|
76
|
-
|
|
88
|
+
## 测试覆盖率矩阵(v0.1.3)
|
|
89
|
+
|
|
90
|
+
| 功能 | 单元测试 | 端到端实测(台架) |
|
|
91
|
+
| --- | --- | --- |
|
|
92
|
+
| `adb_devices` | ✅ 解析器 | ✅ |
|
|
93
|
+
| `adb_connect`(失败路径) | ✅ 分类器 | ✅ CONNECT_FAILED |
|
|
94
|
+
| `adb_connect`(成功路径) | - | ⚠️ 环境受限(台架无线不可达),需车内/可路由网络 |
|
|
95
|
+
| `adb_disconnect` | - | ✅ |
|
|
96
|
+
| `adb_logcat` 前向(level/tail) | ✅ 解析器+过滤 | ✅ |
|
|
97
|
+
| `adb_logcat` tag/keyword 过滤 | ✅ 过滤助手 | ✅(tag+keyword 均正向命中) |
|
|
98
|
+
| `adb_logcat` since/until | ⚠️ 仅逻辑(时间串字典序) | 未单独 E2E(同过滤链) |
|
|
99
|
+
| `adb_logcat` 后台采集 | - | ✅ job_output 读回 43065 行/7MB,job_kill 正常 |
|
|
100
|
+
| `adb_install` 成功 | - | ✅ install -r Success |
|
|
101
|
+
| `adb_install` 失败(LOCAL_FILE_NOT_FOUND/INSTALL_FAILED) | ✅ 分类器 | ✅ 伪 apk → INSTALL_PARSE_FAILED_NOT_APK |
|
|
102
|
+
| `adb_file` ls / ls -lR | - | ✅ |
|
|
103
|
+
| `adb_file` push/pull 往返 | - | ✅ 字节一致 |
|
|
104
|
+
| `adb_file` rm | - | ✅ 删除生效 |
|
|
105
|
+
| `adb_perf_snapshot` meminfo | ✅ 解析器 | ✅ SystemUI PSS/RSS/Heap |
|
|
106
|
+
| `adb_perf_snapshot` gfxinfo | ✅ 解析器 | ✅ 帧率/卡顿/百分位 |
|
|
107
|
+
| `adb_perf_snapshot` battery | ✅ 解析器 | ⚠️ 台架无电池服务返回空(行为正确) |
|
|
108
|
+
| 配置 adbPath/defaultSerial | - | ✅ 覆盖生效 |
|
|
109
|
+
| 错误码 ADB_NOT_FOUND/DEVICE_NOT_FOUND/NO_DEVICES/CONNECT_FAILED/INSTALL_FAILED | ✅ 分类器 | ✅ 实测/确定性验证 |
|
|
110
|
+
|
|
111
|
+
**原则:提交即测。** 未能在本台架覆盖的路径(正向无线连接、battery 实数据)已明确标注,不视为「已测通过」。
|
|
77
112
|
|
|
78
113
|
## License
|
|
79
114
|
|
package/lib/adb.js
CHANGED
|
@@ -117,7 +117,7 @@ export async function runAdb(ctx, cfg, argv, options = {}) {
|
|
|
117
117
|
export function classifyFailure(result) {
|
|
118
118
|
const stderr = result.stderr;
|
|
119
119
|
const stdout = result.stdout;
|
|
120
|
-
if (/error
|
|
120
|
+
if (/(?:error:\s*)?device ['"]?[^'\r\n]*['"]? not found/i.test(stderr)) {
|
|
121
121
|
return new AdbError('DEVICE_NOT_FOUND', excerpt(stderr));
|
|
122
122
|
}
|
|
123
123
|
if (/no devices\/emulators found/i.test(stderr)) {
|
package/lib/tools/perf.js
CHANGED
|
@@ -24,7 +24,11 @@ export function registerPerfTool(ctx, cfg) {
|
|
|
24
24
|
const metrics = args.metrics ?? ['meminfo', 'gfxinfo', 'battery'];
|
|
25
25
|
const result = { package: args.package, metrics: [...metrics] };
|
|
26
26
|
for (const metric of metrics) {
|
|
27
|
-
|
|
27
|
+
// dumpsys battery is device-global and takes no package argument.
|
|
28
|
+
const argv = metric === 'battery'
|
|
29
|
+
? ['shell', 'dumpsys', 'battery']
|
|
30
|
+
: ['shell', 'dumpsys', metric, args.package];
|
|
31
|
+
const output = await runAdb(ctx, cfg, argv, {
|
|
28
32
|
signal: exec.signal,
|
|
29
33
|
serial: args.serial,
|
|
30
34
|
maxBytes: 4 * 1024 * 1024,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-adb",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "ADB device & bench operations for DeepSeek Harness: device discovery, structured logcat, apk install, file pull/push, performance snapshots",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|