- 工程形态:@d-robotics/physical-byte-agent npm 库包
- 单一 barrel src/extensions/index.ts 装配 21 域扩展(package.json pi.extensions 清单 + .pi/extensions/index.ts 重导出,pi 自动加载)
- src/agent.ts PhysicalByteAgent(launch() 程序化调 createAgentSession + verifyAssembly() 离线自检)
- bin/pba.ts CLI、models.json(glm-5.2 条目)、README.md、AGENTS.md
- 命名:全部域命名(glm-provider/safety-gate/flash/jtag-debugger/loop-orchestrator…),去掉 F 编号
- 架构:内联逻辑 + 顶层仅 import type(esbuild 擦除)+ 工厂内动态 import defineTool/Type
- 逻辑离线可单测(不解析 pi),工厂在真 pi 内装配;fail-closed 语义保留
- 两命门:glm-provider.ts buildGlmModelConfig()(thinkingFormat:qwen + maxTokens:8192 + thinkingLevelMap 全 null)+ detectEmptyOutput();normalizeHexArg() + makeHexNormalizingPrepareArguments()
- 验证:tsc --noEmit 0 错(对 src/types/pi.d.ts 类型镜像)+ vitest 732 用例/21 文件全绿 + tsx 离线装配冒烟 21 扩展全就位
- 密钥铁律:grep sk-nAm 在 src/tests/bin/.pi = 0,key 全程 ${DROBOTICS_LLM_KEY} 占位
Co-Authored-By: Claude <noreply@anthropic.com>
496 lines
16 KiB
TypeScript
496 lines
16 KiB
TypeScript
import { describe, it, expect } from "vitest";
|
||
import {
|
||
probeEnv,
|
||
buildEnvPrompt,
|
||
injectEnvPrompt,
|
||
stripEnvBlocks,
|
||
safeProbe,
|
||
firstLine,
|
||
filterDevEntries,
|
||
renderList,
|
||
makeExecFn,
|
||
summarizeProbe,
|
||
ProbeCacheStore,
|
||
PROBE_NOT_INSTALLED,
|
||
PROBE_UNKNOWN,
|
||
PROBE_UNAVAILABLE,
|
||
PROBE_NOT_A_GIT_REPO,
|
||
PROBE_NO_LSUSB,
|
||
DEFAULT_TTL_MS,
|
||
DEFAULT_PROBE_TIMEOUT_MS,
|
||
DEFAULT_DMESG_LINES,
|
||
type EnvProbe,
|
||
} from "../src/extensions/env-probe.js";
|
||
import type { ExecFn, ExecOpts, ExecResult } from "../src/shared/types.js";
|
||
|
||
// ============================================================================
|
||
// mock ExecFn 工厂:按 command 派发 canned 输出
|
||
// ============================================================================
|
||
|
||
function makeMockExec(
|
||
overrides: Record<string, (args: string[]) => ExecResult> = {},
|
||
): ExecFn {
|
||
const ok = (stdout: string): ExecResult => ({ stdout, stderr: "", exitCode: 0 });
|
||
const fail: ExecResult = { stdout: "", stderr: "not found", exitCode: 127 };
|
||
|
||
return async (command: string, args: string[]) => {
|
||
// 优先匹配 overrides
|
||
const override = overrides[command];
|
||
if (override) return override(args);
|
||
switch (command) {
|
||
case "uname":
|
||
if (args[0] === "-r") return ok("5.4.0-rdk-x5\n");
|
||
if (args[0] === "-m") return ok("aarch64\n");
|
||
return ok("");
|
||
case "cat":
|
||
if (args[0] === "/proc/device-tree/model") return ok("RDK X5\0");
|
||
return fail;
|
||
case "aarch64-linux-gnu-gcc":
|
||
return ok(
|
||
"aarch64-linux-gnu-gcc (Ubuntu 10.3.0-1ubuntu1) 10.3.0\nCopyright (C) 2020 Free Software Foundation, Inc.\n",
|
||
);
|
||
case "arm-none-eabi-gcc":
|
||
return ok(
|
||
"arm-none-eabi-gcc (15:10.3-2021.07-1) 10.3.1 20210621\nCopyright (C) 2020 Free Software Foundation, Inc.\n",
|
||
);
|
||
case "gcc":
|
||
return ok("gcc (Ubuntu 11.4.0-1ubuntu1) 11.4.0\n");
|
||
case "dtc":
|
||
return ok("Version: DTC 1.6.0-g48a4eff9\n");
|
||
case "git":
|
||
if (args[0] === "rev-parse" && args[1] === "--short" && args[2] === "HEAD")
|
||
return ok("6a32ec9f\n");
|
||
return fail;
|
||
case "lsusb":
|
||
return ok(
|
||
"Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub\nBus 002 Device 042: ID 046d:c534 Logitech Receiver\n",
|
||
);
|
||
case "dmesg":
|
||
return ok(
|
||
"[ 0.000000] Booting Linux on physical CPU\n[ 1.234] i2c designware-pci 0000:00: i2c-0 adapter\n[ 2.567] gpio-mockup registered gpiochip0\n",
|
||
);
|
||
case "ls": {
|
||
if (args[0] === "-1" && args[1] === "/dev/") {
|
||
return ok(
|
||
["gpiochip0", "gpiochip1", "i2c-0", "i2c-1", "null", "zero", "mmcblk0"].join("\n") +
|
||
"\n",
|
||
);
|
||
}
|
||
return fail;
|
||
}
|
||
default:
|
||
return fail;
|
||
}
|
||
};
|
||
}
|
||
|
||
// ============================================================================
|
||
// probeEnv — 正常收集
|
||
// ============================================================================
|
||
|
||
describe("env-probe probeEnv — 正常收集", () => {
|
||
it("kernel / arch 来自 uname", async () => {
|
||
const probe = await probeEnv(makeMockExec());
|
||
expect(probe.kernel).toBe("5.4.0-rdk-x5");
|
||
expect(probe.arch).toBe("aarch64");
|
||
});
|
||
|
||
it("board 来自 /proc/device-tree/model(去 \\0)", async () => {
|
||
const probe = await probeEnv(makeMockExec());
|
||
expect(probe.board).toBe("RDK X5");
|
||
});
|
||
|
||
it("crossCompiler 取 aarch64-linux-gnu-gcc 首行版本", async () => {
|
||
const probe = await probeEnv(makeMockExec());
|
||
expect(probe.crossCompiler).toContain("aarch64-linux-gnu-gcc");
|
||
expect(probe.crossCompiler).toContain("10.3.0");
|
||
// 只取首行,不含 Copyright
|
||
expect(probe.crossCompiler).not.toContain("Copyright");
|
||
});
|
||
|
||
it("bareMetalCompiler 取 arm-none-eabi-gcc 首行", async () => {
|
||
const probe = await probeEnv(makeMockExec());
|
||
expect(probe.bareMetalCompiler).toContain("arm-none-eabi-gcc");
|
||
});
|
||
|
||
it("gpioChips 从 /dev/ 过滤 gpiochip 前缀", async () => {
|
||
const probe = await probeEnv(makeMockExec());
|
||
expect(probe.gpioChips).toEqual(["gpiochip0", "gpiochip1"]);
|
||
});
|
||
|
||
it("i2cBuses 从 /dev/ 过滤 i2c- 前缀", async () => {
|
||
const probe = await probeEnv(makeMockExec());
|
||
expect(probe.i2cBuses).toEqual(["i2c-0", "i2c-1"]);
|
||
});
|
||
|
||
it("dmesgTail 含尾部内容(不空)", async () => {
|
||
const probe = await probeEnv(makeMockExec());
|
||
expect(probe.dmesgTail).toContain("i2c-0 adapter");
|
||
expect(probe.dmesgTail).not.toBe(PROBE_UNAVAILABLE);
|
||
});
|
||
|
||
it("gitHead 短 hash", async () => {
|
||
const probe = await probeEnv(makeMockExec());
|
||
expect(probe.gitHead).toBe("6a32ec9f");
|
||
});
|
||
|
||
it("默认超时/dmesg 行数常量符合预期", () => {
|
||
expect(DEFAULT_PROBE_TIMEOUT_MS).toBe(3_000);
|
||
expect(DEFAULT_DMESG_LINES).toBe(20);
|
||
expect(DEFAULT_TTL_MS).toBe(300_000);
|
||
});
|
||
});
|
||
|
||
// ============================================================================
|
||
// probeEnv — fail-closed 容错
|
||
// ============================================================================
|
||
|
||
describe("env-probe probeEnv — fail-closed 容错", () => {
|
||
it("交叉编译器不存在 → not installed(不抛)", async () => {
|
||
const exec = makeMockExec({
|
||
"aarch64-linux-gnu-gcc": () => ({ stdout: "", stderr: "not found", exitCode: 127 }),
|
||
"arm-none-eabi-gcc": () => ({ stdout: "", stderr: "not found", exitCode: 127 }),
|
||
});
|
||
const probe = await probeEnv(exec);
|
||
expect(probe.crossCompiler).toBe(PROBE_NOT_INSTALLED);
|
||
expect(probe.bareMetalCompiler).toBe(PROBE_NOT_INSTALLED);
|
||
});
|
||
|
||
it("exec 抛异常 → 各字段 fallback,probeEnv 不抛", async () => {
|
||
const execThrow: ExecFn = async () => {
|
||
throw new Error("spawn ENOENT");
|
||
};
|
||
const probe = await probeEnv(execThrow);
|
||
expect(probe.kernel).toBe(PROBE_UNKNOWN);
|
||
expect(probe.board).toBe(PROBE_UNKNOWN);
|
||
expect(probe.crossCompiler).toBe(PROBE_NOT_INSTALLED);
|
||
expect(probe.gitHead).toBe(PROBE_NOT_A_GIT_REPO);
|
||
expect(probe.usbDevices).toBe(PROBE_NO_LSUSB);
|
||
expect(probe.dmesgTail).toBe(PROBE_UNAVAILABLE);
|
||
expect(probe.gpioChips).toEqual([]);
|
||
expect(probe.i2cBuses).toEqual([]);
|
||
});
|
||
|
||
it("lsusb 缺失 → lsusb not available", async () => {
|
||
const exec = makeMockExec({
|
||
lsusb: () => ({ stdout: "", stderr: "not found", exitCode: 127 }),
|
||
});
|
||
const probe = await probeEnv(exec);
|
||
expect(probe.usbDevices).toBe(PROBE_NO_LSUSB);
|
||
});
|
||
|
||
it("/proc/device-tree/model 不存在(非 ARM 板)→ unknown", async () => {
|
||
const exec = makeMockExec({
|
||
cat: () => ({ stdout: "", stderr: "No such file", exitCode: 1 }),
|
||
});
|
||
const probe = await probeEnv(exec);
|
||
expect(probe.board).toBe(PROBE_UNKNOWN);
|
||
});
|
||
|
||
it("dmesg 非零退出(权限不足)→ [unavailable]", async () => {
|
||
const exec = makeMockExec({
|
||
dmesg: () => ({ stdout: "", stderr: "Operation not permitted", exitCode: 1 }),
|
||
});
|
||
const probe = await probeEnv(exec);
|
||
expect(probe.dmesgTail).toBe(PROBE_UNAVAILABLE);
|
||
});
|
||
|
||
it("/dev/ 列空 → gpioChips/i2cBuses 空数组(不抛)", async () => {
|
||
const exec = makeMockExec({
|
||
ls: () => ({ stdout: "null\nzero\n", stderr: "", exitCode: 0 }),
|
||
});
|
||
const probe = await probeEnv(exec);
|
||
expect(probe.gpioChips).toEqual([]);
|
||
expect(probe.i2cBuses).toEqual([]);
|
||
});
|
||
|
||
it("dmesg 尾部行数受 config.dmesgLines 控制", async () => {
|
||
const probe = await probeEnv(makeMockExec(), { dmesgLines: 1 });
|
||
// 只取最后 1 行
|
||
expect(probe.dmesgTail).toBe("[ 2.567] gpio-mockup registered gpiochip0");
|
||
});
|
||
});
|
||
|
||
// ============================================================================
|
||
// 内部工具单测
|
||
// ============================================================================
|
||
|
||
describe("env-probe 内部工具", () => {
|
||
it("firstLine 取首行并 trim", () => {
|
||
expect(firstLine("a\nb\nc")).toBe("a");
|
||
expect(firstLine(" trim me \nsecond")).toBe("trim me");
|
||
expect(firstLine("")).toBe("");
|
||
});
|
||
|
||
it("filterDevEntries 按前缀过滤", () => {
|
||
const out = "gpiochip0\ni2c-0\nnull\ngpiochip1\n";
|
||
expect(filterDevEntries(out, "gpiochip")).toEqual(["gpiochip0", "gpiochip1"]);
|
||
expect(filterDevEntries(out, "i2c-")).toEqual(["i2c-0"]);
|
||
expect(filterDevEntries(out, "tty")).toEqual([]);
|
||
});
|
||
|
||
it("renderList 空数组 → none", () => {
|
||
expect(renderList([])).toBe("none");
|
||
expect(renderList(["a", "b"])).toBe("a, b");
|
||
});
|
||
|
||
it("safeProbe 非零退出返回 fallback", async () => {
|
||
const exec: ExecFn = async () => ({ stdout: "", stderr: "x", exitCode: 1 });
|
||
const out = await safeProbe(exec, "x", [], undefined, "FB");
|
||
expect(out).toBe("FB");
|
||
});
|
||
|
||
it("safeProbe stdout 空返回 fallback", async () => {
|
||
const exec: ExecFn = async () => ({ stdout: " ", stderr: "", exitCode: 0 });
|
||
const out = await safeProbe(exec, "x", [], undefined, "FB");
|
||
expect(out).toBe("FB");
|
||
});
|
||
|
||
it("safeProbe exec 抛异常返回 fallback", async () => {
|
||
const exec: ExecFn = async () => {
|
||
throw new Error("ENOENT");
|
||
};
|
||
const out = await safeProbe(exec, "x", [], undefined, "FB", (s) => s);
|
||
expect(out).toBe("FB");
|
||
});
|
||
|
||
it("makeExecFn 透传并补默认 timeout", async () => {
|
||
let seen: ExecOpts | undefined;
|
||
const exec: ExecFn = async (_c, _a, opts) => {
|
||
seen = opts;
|
||
return { stdout: "ok", stderr: "", exitCode: 0 };
|
||
};
|
||
const wrapped = makeExecFn(exec, 3000);
|
||
await wrapped("uname", ["-r"]);
|
||
expect(seen?.timeout).toBe(3000);
|
||
// 调用方 opts 覆盖默认
|
||
await wrapped("uname", ["-r"], { timeout: 500 });
|
||
expect(seen?.timeout).toBe(500);
|
||
});
|
||
});
|
||
|
||
// ============================================================================
|
||
// buildEnvPrompt
|
||
// ============================================================================
|
||
|
||
describe("env-probe buildEnvPrompt — 注入内容", () => {
|
||
const sampleProbe: EnvProbe = {
|
||
kernel: "5.4.0-rdk-x5",
|
||
arch: "aarch64",
|
||
board: "RDK X5",
|
||
crossCompiler: "aarch64-linux-gnu-gcc (Ubuntu 10.3.0) 10.3.0",
|
||
bareMetalCompiler: "not installed",
|
||
hostCompiler: "gcc (Ubuntu 11.4.0) 11.4.0",
|
||
dtc: "Version: DTC 1.6.0",
|
||
gitHead: "6a32ec9f",
|
||
usbDevices: "Bus 001 Device 001: ID 1d6b:0002",
|
||
dmesgTail: "[ 1.234] i2c-0 adapter",
|
||
gpioChips: ["gpiochip0", "gpiochip1"],
|
||
i2cBuses: ["i2c-0", "i2c-1"],
|
||
};
|
||
|
||
it("含 <embedded_environment> 开闭合标签", () => {
|
||
const p = buildEnvPrompt(sampleProbe);
|
||
expect(p.startsWith("<embedded_environment>")).toBe(true);
|
||
expect(p.trim().endsWith("</embedded_environment>")).toBe(true);
|
||
});
|
||
|
||
it("含交叉编译器行", () => {
|
||
const p = buildEnvPrompt(sampleProbe);
|
||
expect(p).toContain("Cross-compiler (aarch64-linux): aarch64-linux-gnu-gcc");
|
||
});
|
||
|
||
it("含 i2c 总线列表", () => {
|
||
const p = buildEnvPrompt(sampleProbe);
|
||
expect(p).toContain("I2C buses: i2c-0, i2c-1");
|
||
});
|
||
|
||
it("含 gpio chips 列表", () => {
|
||
const p = buildEnvPrompt(sampleProbe);
|
||
expect(p).toContain("GPIO chips: gpiochip0, gpiochip1");
|
||
});
|
||
|
||
it("含 kernel + arch", () => {
|
||
const p = buildEnvPrompt(sampleProbe);
|
||
expect(p).toContain("Kernel: 5.4.0-rdk-x5 / aarch64");
|
||
});
|
||
|
||
it("含 board model", () => {
|
||
const p = buildEnvPrompt(sampleProbe);
|
||
expect(p).toContain("Board model: RDK X5");
|
||
});
|
||
|
||
it("含 dmesg 尾部(缩进)", () => {
|
||
const p = buildEnvPrompt(sampleProbe);
|
||
expect(p).toContain("dmesg tail:");
|
||
expect(p).toContain(" [ 1.234] i2c-0 adapter");
|
||
});
|
||
|
||
it("含 git HEAD", () => {
|
||
const p = buildEnvPrompt(sampleProbe);
|
||
expect(p).toContain("Git HEAD: 6a32ec9f");
|
||
});
|
||
|
||
it("空 gpio/i2c → none", () => {
|
||
const p = buildEnvPrompt({ ...sampleProbe, gpioChips: [], i2cBuses: [] });
|
||
expect(p).toContain("GPIO chips: none");
|
||
expect(p).toContain("I2C buses: none");
|
||
});
|
||
|
||
it("裸机编译器 not installed 时原样渲染", () => {
|
||
const p = buildEnvPrompt(sampleProbe);
|
||
expect(p).toContain("Cross-compiler (bare-metal): not installed");
|
||
});
|
||
|
||
it("dmesgTail 为 unavailable 时不缩进占位符", () => {
|
||
const p = buildEnvPrompt({ ...sampleProbe, dmesgTail: PROBE_UNAVAILABLE });
|
||
expect(p).toContain(`- dmesg tail:\n${PROBE_UNAVAILABLE}`);
|
||
});
|
||
});
|
||
|
||
// ============================================================================
|
||
// injectEnvPrompt / stripEnvBlocks — 链式叠加去重
|
||
// ============================================================================
|
||
|
||
describe("env-probe injectEnvPrompt / stripEnvBlocks", () => {
|
||
it("把探针块追加到既有 systemPrompt 尾部", () => {
|
||
const p = injectEnvPrompt("You are a coding agent.", {
|
||
kernel: "5.4.0",
|
||
arch: "aarch64",
|
||
board: "RDK X5",
|
||
crossCompiler: "aarch64-linux-gnu-gcc 10.3.0",
|
||
bareMetalCompiler: "not installed",
|
||
hostCompiler: "gcc 11.4.0",
|
||
dtc: "DTC 1.6.0",
|
||
gitHead: "6a32ec9f",
|
||
usbDevices: "lsusb not available",
|
||
dmesgTail: "[unavailable]",
|
||
gpioChips: ["gpiochip0"],
|
||
i2cBuses: ["i2c-0"],
|
||
});
|
||
expect(p).toContain("You are a coding agent.");
|
||
expect(p).toContain("<embedded_environment>");
|
||
expect(p).toContain("</embedded_environment>");
|
||
// 原文在前,探针块在后
|
||
expect(p.indexOf("You are a coding agent.")).toBeLessThan(p.indexOf("<embedded_environment>"));
|
||
});
|
||
|
||
it("重复注入不堆积:先剥离旧块再追加新块", () => {
|
||
const probe: EnvProbe = {
|
||
kernel: "5.4.0",
|
||
arch: "aarch64",
|
||
board: "RDK X5",
|
||
crossCompiler: "aarch64-linux-gnu-gcc 10.3.0",
|
||
bareMetalCompiler: "not installed",
|
||
hostCompiler: "gcc 11.4.0",
|
||
dtc: "DTC 1.6.0",
|
||
gitHead: "abc1234",
|
||
usbDevices: "lsusb not available",
|
||
dmesgTail: "[unavailable]",
|
||
gpioChips: [],
|
||
i2cBuses: ["i2c-0"],
|
||
};
|
||
const first = injectEnvPrompt("base prompt", probe);
|
||
// 二次注入(链式重入,新 gitHead)
|
||
const second = injectEnvPrompt(first, { ...probe, gitHead: "deadbee" });
|
||
const blockCount = (second.match(/<embedded_environment>/g) ?? []).length;
|
||
expect(blockCount).toBe(1);
|
||
expect(second).toContain("deadbee");
|
||
expect(second).not.toContain("abc1234");
|
||
});
|
||
|
||
it("stripEnvBlocks 剥离全部嵌入块", () => {
|
||
const withBlock =
|
||
"hello\n\n<embedded_environment>\nfoo\n</embedded_environment>\n\nworld";
|
||
expect(stripEnvBlocks(withBlock)).toBe("hello\n\nworld");
|
||
});
|
||
|
||
it("stripEnvBlocks 无块时原样(trimEnd)", () => {
|
||
expect(stripEnvBlocks("plain prompt")).toBe("plain prompt");
|
||
});
|
||
});
|
||
|
||
// ============================================================================
|
||
// ProbeCacheStore — TTL + cwd 失效
|
||
// ============================================================================
|
||
|
||
describe("env-probe ProbeCacheStore — 缓存失效", () => {
|
||
const probe: EnvProbe = {
|
||
kernel: "5.4.0",
|
||
arch: "aarch64",
|
||
board: "RDK X5",
|
||
crossCompiler: "gcc",
|
||
bareMetalCompiler: "not installed",
|
||
hostCompiler: "gcc",
|
||
dtc: "DTC",
|
||
gitHead: "abc1234",
|
||
usbDevices: "none",
|
||
dmesgTail: "[unavailable]",
|
||
gpioChips: [],
|
||
i2cBuses: [],
|
||
};
|
||
|
||
it("首次 get 返回 null,set 后命中", () => {
|
||
const store = new ProbeCacheStore();
|
||
expect(store.get(DEFAULT_TTL_MS, "/cwd")).toBeNull();
|
||
store.set(probe, "/cwd");
|
||
expect(store.get(DEFAULT_TTL_MS, "/cwd")).toBe(probe);
|
||
expect(store.has()).toBe(true);
|
||
});
|
||
|
||
it("cwd 变化即失效", () => {
|
||
const store = new ProbeCacheStore();
|
||
store.set(probe, "/cwd-a");
|
||
expect(store.get(DEFAULT_TTL_MS, "/cwd-a")).toBe(probe);
|
||
expect(store.get(DEFAULT_TTL_MS, "/cwd-b")).toBeNull();
|
||
});
|
||
|
||
it("TTL 过期即失效", async () => {
|
||
const store = new ProbeCacheStore();
|
||
store.set(probe, "/cwd");
|
||
// ttl=1ms,等一下即过期
|
||
await new Promise((r) => setTimeout(r, 20));
|
||
expect(store.get(1, "/cwd")).toBeNull();
|
||
});
|
||
|
||
it("clear 后清空", () => {
|
||
const store = new ProbeCacheStore();
|
||
store.set(probe, "/cwd");
|
||
store.clear();
|
||
expect(store.has()).toBe(false);
|
||
expect(store.get(DEFAULT_TTL_MS, "/cwd")).toBeNull();
|
||
});
|
||
});
|
||
|
||
// ============================================================================
|
||
// summarizeProbe — env_status 工具快照
|
||
// ============================================================================
|
||
|
||
describe("env-probe summarizeProbe — 工具快照", () => {
|
||
it("产出精简字段 + cached 标记", () => {
|
||
const probe: EnvProbe = {
|
||
kernel: "5.4.0-rdk-x5",
|
||
arch: "aarch64",
|
||
board: "RDK X5",
|
||
crossCompiler: "aarch64-linux-gnu-gcc 10.3.0",
|
||
bareMetalCompiler: "not installed",
|
||
hostCompiler: "gcc 11.4.0",
|
||
dtc: "DTC 1.6.0",
|
||
gitHead: "6a32ec9f",
|
||
usbDevices: "Bus 001",
|
||
dmesgTail: "[unavailable]",
|
||
gpioChips: ["gpiochip0"],
|
||
i2cBuses: ["i2c-0", "i2c-1"],
|
||
};
|
||
const s = summarizeProbe(probe, true);
|
||
expect(s.kernel).toBe("5.4.0-rdk-x5");
|
||
expect(s.board).toBe("RDK X5");
|
||
expect(s.crossCompiler).toContain("10.3.0");
|
||
expect(s.i2cBuses).toEqual(["i2c-0", "i2c-1"]);
|
||
expect(s.gpioChips).toEqual(["gpiochip0"]);
|
||
expect(s.cached).toBe(true);
|
||
// 精简:不含 hostCompiler/dtc 等冗余字段
|
||
expect("hostCompiler" in s).toBe(false);
|
||
});
|
||
});
|