@matter/testing 0.17.9 → 0.18.0-alpha.0-20260812-4d7f2790e
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/dist/cjs/chai.js +4 -4
- package/dist/cjs/chai.js.map +2 -2
- package/dist/cjs/chip/cert/cert-context.d.ts +115 -0
- package/dist/cjs/chip/cert/cert-context.d.ts.map +1 -0
- package/dist/cjs/chip/cert/cert-context.js +22 -0
- package/dist/cjs/chip/cert/cert-context.js.map +6 -0
- package/dist/cjs/chip/cert/cert-dsl.d.ts +48 -0
- package/dist/cjs/chip/cert/cert-dsl.d.ts.map +1 -0
- package/dist/cjs/chip/cert/cert-dsl.js +308 -0
- package/dist/cjs/chip/cert/cert-dsl.js.map +6 -0
- package/dist/cjs/chip/cert/cert-test.d.ts +46 -0
- package/dist/cjs/chip/cert/cert-test.d.ts.map +1 -0
- package/dist/cjs/chip/cert/cert-test.js +250 -0
- package/dist/cjs/chip/cert/cert-test.js.map +6 -0
- package/dist/cjs/chip/cert/chip-app-subject.d.ts +80 -0
- package/dist/cjs/chip/cert/chip-app-subject.d.ts.map +1 -0
- package/dist/cjs/chip/cert/chip-app-subject.js +337 -0
- package/dist/cjs/chip/cert/chip-app-subject.js.map +6 -0
- package/dist/cjs/chip/cert/controller-adapter.d.ts +119 -0
- package/dist/cjs/chip/cert/controller-adapter.d.ts.map +1 -0
- package/dist/cjs/chip/cert/controller-adapter.js +45 -0
- package/dist/cjs/chip/cert/controller-adapter.js.map +6 -0
- package/dist/cjs/chip/cert/device-config.d.ts +15 -0
- package/dist/cjs/chip/cert/device-config.d.ts.map +1 -0
- package/dist/cjs/chip/cert/device-config.js +43 -0
- package/dist/cjs/chip/cert/device-config.js.map +6 -0
- package/dist/cjs/chip/cert/evidence.d.ts +70 -0
- package/dist/cjs/chip/cert/evidence.d.ts.map +1 -0
- package/dist/cjs/chip/cert/evidence.js +128 -0
- package/dist/cjs/chip/cert/evidence.js.map +6 -0
- package/dist/cjs/chip/cert/log-follower.d.ts +96 -0
- package/dist/cjs/chip/cert/log-follower.d.ts.map +1 -0
- package/dist/cjs/chip/cert/log-follower.js +209 -0
- package/dist/cjs/chip/cert/log-follower.js.map +6 -0
- package/dist/cjs/chip/cert/matterjs-subject-registry.d.ts +22 -0
- package/dist/cjs/chip/cert/matterjs-subject-registry.d.ts.map +1 -0
- package/dist/cjs/chip/cert/matterjs-subject-registry.js +40 -0
- package/dist/cjs/chip/cert/matterjs-subject-registry.js.map +6 -0
- package/dist/cjs/chip/cert/prompt-driven-python-test.d.ts +40 -0
- package/dist/cjs/chip/cert/prompt-driven-python-test.d.ts.map +1 -0
- package/dist/cjs/chip/cert/prompt-driven-python-test.js +77 -0
- package/dist/cjs/chip/cert/prompt-driven-python-test.js.map +6 -0
- package/dist/cjs/chip/chip-bins.d.ts +132 -0
- package/dist/cjs/chip/chip-bins.d.ts.map +1 -0
- package/dist/cjs/chip/chip-bins.js +232 -0
- package/dist/cjs/chip/chip-bins.js.map +6 -0
- package/dist/cjs/chip/chip-test-common.d.ts.map +1 -1
- package/dist/cjs/chip/chip-test-common.js +1 -1
- package/dist/cjs/chip/chip-test-common.js.map +1 -1
- package/dist/cjs/chip/chip.d.ts.map +1 -1
- package/dist/cjs/chip/chip.js +1 -1
- package/dist/cjs/chip/chip.js.map +1 -1
- package/dist/cjs/chip/config.d.ts +26 -0
- package/dist/cjs/chip/config.d.ts.map +1 -1
- package/dist/cjs/chip/config.js +11 -3
- package/dist/cjs/chip/config.js.map +1 -1
- package/dist/cjs/chip/index.d.ts +26 -0
- package/dist/cjs/chip/index.d.ts.map +1 -1
- package/dist/cjs/chip/index.js +49 -0
- package/dist/cjs/chip/index.js.map +2 -2
- package/dist/cjs/chip/pics/file.d.ts +8 -0
- package/dist/cjs/chip/pics/file.d.ts.map +1 -1
- package/dist/cjs/chip/pics/file.js +4 -1
- package/dist/cjs/chip/pics/file.js.map +1 -1
- package/dist/cjs/chip/pics/source.d.ts +8 -5
- package/dist/cjs/chip/pics/source.d.ts.map +1 -1
- package/dist/cjs/chip/pics/source.js +25 -17
- package/dist/cjs/chip/pics/source.js.map +1 -1
- package/dist/cjs/chip/python-test.d.ts +12 -0
- package/dist/cjs/chip/python-test.d.ts.map +1 -1
- package/dist/cjs/chip/python-test.js +6 -4
- package/dist/cjs/chip/python-test.js.map +1 -1
- package/dist/cjs/chip/state.d.ts.map +1 -1
- package/dist/cjs/chip/state.js +24 -7
- package/dist/cjs/chip/state.js.map +1 -1
- package/dist/cjs/chip/yaml-test.js +1 -1
- package/dist/cjs/chip/yaml-test.js.map +1 -1
- package/dist/cjs/cli.d.ts.map +1 -1
- package/dist/cjs/cli.js +33 -2
- package/dist/cjs/cli.js.map +1 -1
- package/dist/cjs/device/backchannel.d.ts.map +1 -1
- package/dist/cjs/device/subject.d.ts.map +1 -1
- package/dist/cjs/device/test.d.ts.map +1 -1
- package/dist/cjs/docker/container.d.ts.map +1 -1
- package/dist/cjs/docker/docker.d.ts.map +1 -1
- package/dist/cjs/docker/edit.d.ts.map +1 -1
- package/dist/cjs/docker/errors.d.ts.map +1 -1
- package/dist/cjs/docker/network.d.ts.map +1 -1
- package/dist/cjs/docker/terminal.d.ts.map +1 -1
- package/dist/cjs/failure-reporter.d.ts.map +1 -1
- package/dist/cjs/global-declarations.d.js +0 -1
- package/dist/cjs/global-declarations.d.js.map +1 -1
- package/dist/cjs/global-declarations.d.ts +2 -2
- package/dist/cjs/global-definitions.js +17 -4
- package/dist/cjs/global-definitions.js.map +2 -2
- package/dist/cjs/index.d.js +2 -0
- package/dist/cjs/index.d.js.map +1 -1
- package/dist/cjs/index.d.ts +3 -0
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/mocha.d.ts.map +1 -1
- package/dist/cjs/mocha.js +5 -0
- package/dist/cjs/mocha.js.map +1 -1
- package/dist/cjs/mocharc.cjs +4 -3
- package/dist/cjs/options.d.ts.map +1 -1
- package/dist/cjs/print-report.js +1 -1
- package/dist/cjs/print-report.js.map +1 -1
- package/dist/cjs/test-descriptor.d.ts +1 -1
- package/dist/cjs/test-descriptor.d.ts.map +1 -1
- package/dist/cjs/text-diff.d.ts.map +1 -1
- package/dist/cjs/util/async.d.ts +30 -0
- package/dist/cjs/util/async.d.ts.map +1 -0
- package/dist/cjs/util/async.js +85 -0
- package/dist/cjs/util/async.js.map +6 -0
- package/dist/cjs/util/trace-unhandled.d.ts.map +1 -1
- package/dist/cjs/util/wtf.d.ts.map +1 -1
- package/dist/cjs/util/wtf.js +1 -1
- package/dist/cjs/util/wtf.js.map +1 -1
- package/dist/cjs/web.d.ts.map +1 -1
- package/dist/cjs/web.js +5 -1
- package/dist/cjs/web.js.map +1 -1
- package/dist/esm/chai.js +1 -1
- package/dist/esm/chai.js.map +1 -1
- package/dist/esm/chip/cert/cert-context.d.ts +115 -0
- package/dist/esm/chip/cert/cert-context.d.ts.map +1 -0
- package/dist/esm/chip/cert/cert-context.js +6 -0
- package/dist/esm/chip/cert/cert-context.js.map +6 -0
- package/dist/esm/chip/cert/cert-dsl.d.ts +48 -0
- package/dist/esm/chip/cert/cert-dsl.d.ts.map +1 -0
- package/dist/esm/chip/cert/cert-dsl.js +288 -0
- package/dist/esm/chip/cert/cert-dsl.js.map +6 -0
- package/dist/esm/chip/cert/cert-test.d.ts +46 -0
- package/dist/esm/chip/cert/cert-test.d.ts.map +1 -0
- package/dist/esm/chip/cert/cert-test.js +230 -0
- package/dist/esm/chip/cert/cert-test.js.map +6 -0
- package/dist/esm/chip/cert/chip-app-subject.d.ts +80 -0
- package/dist/esm/chip/cert/chip-app-subject.d.ts.map +1 -0
- package/dist/esm/chip/cert/chip-app-subject.js +317 -0
- package/dist/esm/chip/cert/chip-app-subject.js.map +6 -0
- package/dist/esm/chip/cert/controller-adapter.d.ts +119 -0
- package/dist/esm/chip/cert/controller-adapter.d.ts.map +1 -0
- package/dist/esm/chip/cert/controller-adapter.js +25 -0
- package/dist/esm/chip/cert/controller-adapter.js.map +6 -0
- package/dist/esm/chip/cert/device-config.d.ts +15 -0
- package/dist/esm/chip/cert/device-config.d.ts.map +1 -0
- package/dist/esm/chip/cert/device-config.js +23 -0
- package/dist/esm/chip/cert/device-config.js.map +6 -0
- package/dist/esm/chip/cert/evidence.d.ts +70 -0
- package/dist/esm/chip/cert/evidence.d.ts.map +1 -0
- package/dist/esm/chip/cert/evidence.js +108 -0
- package/dist/esm/chip/cert/evidence.js.map +6 -0
- package/dist/esm/chip/cert/log-follower.d.ts +96 -0
- package/dist/esm/chip/cert/log-follower.d.ts.map +1 -0
- package/dist/esm/chip/cert/log-follower.js +189 -0
- package/dist/esm/chip/cert/log-follower.js.map +6 -0
- package/dist/esm/chip/cert/matterjs-subject-registry.d.ts +22 -0
- package/dist/esm/chip/cert/matterjs-subject-registry.d.ts.map +1 -0
- package/dist/esm/chip/cert/matterjs-subject-registry.js +20 -0
- package/dist/esm/chip/cert/matterjs-subject-registry.js.map +6 -0
- package/dist/esm/chip/cert/prompt-driven-python-test.d.ts +40 -0
- package/dist/esm/chip/cert/prompt-driven-python-test.d.ts.map +1 -0
- package/dist/esm/chip/cert/prompt-driven-python-test.js +57 -0
- package/dist/esm/chip/cert/prompt-driven-python-test.js.map +6 -0
- package/dist/esm/chip/chip-bins.d.ts +132 -0
- package/dist/esm/chip/chip-bins.d.ts.map +1 -0
- package/dist/esm/chip/chip-bins.js +212 -0
- package/dist/esm/chip/chip-bins.js.map +6 -0
- package/dist/esm/chip/chip-test-common.d.ts.map +1 -1
- package/dist/esm/chip/chip-test-common.js +1 -1
- package/dist/esm/chip/chip-test-common.js.map +1 -1
- package/dist/esm/chip/chip.d.ts.map +1 -1
- package/dist/esm/chip/chip.js +1 -1
- package/dist/esm/chip/chip.js.map +1 -1
- package/dist/esm/chip/config.d.ts +26 -0
- package/dist/esm/chip/config.d.ts.map +1 -1
- package/dist/esm/chip/config.js +11 -3
- package/dist/esm/chip/config.js.map +1 -1
- package/dist/esm/chip/index.d.ts +26 -0
- package/dist/esm/chip/index.d.ts.map +1 -1
- package/dist/esm/chip/index.js +60 -0
- package/dist/esm/chip/index.js.map +1 -1
- package/dist/esm/chip/pics/file.d.ts +8 -0
- package/dist/esm/chip/pics/file.d.ts.map +1 -1
- package/dist/esm/chip/pics/file.js +4 -1
- package/dist/esm/chip/pics/file.js.map +1 -1
- package/dist/esm/chip/pics/source.d.ts +8 -5
- package/dist/esm/chip/pics/source.d.ts.map +1 -1
- package/dist/esm/chip/pics/source.js +24 -16
- package/dist/esm/chip/pics/source.js.map +1 -1
- package/dist/esm/chip/python-test.d.ts +12 -0
- package/dist/esm/chip/python-test.d.ts.map +1 -1
- package/dist/esm/chip/python-test.js +6 -4
- package/dist/esm/chip/python-test.js.map +1 -1
- package/dist/esm/chip/state.d.ts.map +1 -1
- package/dist/esm/chip/state.js +25 -8
- package/dist/esm/chip/state.js.map +1 -1
- package/dist/esm/chip/yaml-test.js +1 -1
- package/dist/esm/chip/yaml-test.js.map +1 -1
- package/dist/esm/cli.d.ts.map +1 -1
- package/dist/esm/cli.js +33 -2
- package/dist/esm/cli.js.map +1 -1
- package/dist/esm/device/backchannel.d.ts.map +1 -1
- package/dist/esm/device/subject.d.ts.map +1 -1
- package/dist/esm/device/test.d.ts.map +1 -1
- package/dist/esm/docker/container.d.ts.map +1 -1
- package/dist/esm/docker/docker.d.ts.map +1 -1
- package/dist/esm/docker/edit.d.ts.map +1 -1
- package/dist/esm/docker/errors.d.ts.map +1 -1
- package/dist/esm/docker/network.d.ts.map +1 -1
- package/dist/esm/docker/terminal.d.ts.map +1 -1
- package/dist/esm/failure-reporter.d.ts.map +1 -1
- package/dist/esm/global-declarations.d.js +0 -1
- package/dist/esm/global-declarations.d.js.map +1 -1
- package/dist/esm/global-declarations.d.ts +2 -2
- package/dist/esm/global-definitions.js +16 -3
- package/dist/esm/global-definitions.js.map +1 -1
- package/dist/esm/index.d.js +2 -0
- package/dist/esm/index.d.js.map +1 -1
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/mocha.d.ts.map +1 -1
- package/dist/esm/mocha.js +5 -0
- package/dist/esm/mocha.js.map +1 -1
- package/dist/esm/mocharc.cjs +4 -3
- package/dist/esm/options.d.ts.map +1 -1
- package/dist/esm/print-report.js +1 -1
- package/dist/esm/print-report.js.map +1 -1
- package/dist/esm/test-descriptor.d.ts +1 -1
- package/dist/esm/test-descriptor.d.ts.map +1 -1
- package/dist/esm/text-diff.d.ts.map +1 -1
- package/dist/esm/util/async.d.ts +30 -0
- package/dist/esm/util/async.d.ts.map +1 -0
- package/dist/esm/util/async.js +65 -0
- package/dist/esm/util/async.js.map +6 -0
- package/dist/esm/util/trace-unhandled.d.ts.map +1 -1
- package/dist/esm/util/wtf.d.ts.map +1 -1
- package/dist/esm/util/wtf.js +1 -1
- package/dist/esm/util/wtf.js.map +1 -1
- package/dist/esm/web.d.ts.map +1 -1
- package/dist/esm/web.js +5 -1
- package/dist/esm/web.js.map +1 -1
- package/package.json +9 -9
- package/src/chai.ts +3 -3
- package/src/chip/cert/cert-context.ts +126 -0
- package/src/chip/cert/cert-dsl.ts +451 -0
- package/src/chip/cert/cert-test.ts +360 -0
- package/src/chip/cert/chip-app-subject.ts +457 -0
- package/src/chip/cert/controller-adapter.ts +142 -0
- package/src/chip/cert/device-config.ts +33 -0
- package/src/chip/cert/evidence.ts +170 -0
- package/src/chip/cert/log-follower.ts +266 -0
- package/src/chip/cert/matterjs-subject-registry.ts +33 -0
- package/src/chip/cert/prompt-driven-python-test.ts +104 -0
- package/src/chip/chip-bins.ts +401 -0
- package/src/chip/chip-test-common.ts +3 -1
- package/src/chip/chip.ts +1 -1
- package/src/chip/config.ts +28 -1
- package/src/chip/index.ts +67 -0
- package/src/chip/pics/file.ts +8 -0
- package/src/chip/pics/source.ts +39 -19
- package/src/chip/python-test.ts +5 -4
- package/src/chip/state.ts +39 -8
- package/src/chip/yaml-test.ts +1 -1
- package/src/cli.ts +40 -2
- package/src/global-declarations.d.ts +2 -2
- package/src/global-definitions.ts +27 -3
- package/src/index.d.ts +3 -0
- package/src/index.js +1 -0
- package/src/mocha.ts +13 -0
- package/src/mocharc.cjs +4 -3
- package/src/print-report.ts +1 -1
- package/src/test-descriptor.ts +1 -1
- package/src/util/async.ts +83 -0
- package/src/util/wtf.ts +3 -1
- package/src/web.ts +5 -1
- package/test/util/AsyncTest.ts +68 -0
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022-2026 Matter.js Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { mkdir, readFile, stat, writeFile } from "node:fs/promises";
|
|
8
|
+
import { tmpdir, userInfo } from "node:os";
|
|
9
|
+
import { join } from "node:path";
|
|
10
|
+
import { env } from "node:process";
|
|
11
|
+
import { Docker } from "../docker/docker.js";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Which build of CHIP example-app/chip-tool binaries a test run uses.
|
|
15
|
+
*
|
|
16
|
+
* `"matterjs"` is matter.js's own image/build (`ghcr.io/matter-js/chip*`, or a directory the user
|
|
17
|
+
* built themselves). `"cert-bins"` selects project-chip's official `connectedhomeip/chip-cert-bins`
|
|
18
|
+
* image — the same binaries the official Matter Test Harness certifies against.
|
|
19
|
+
*/
|
|
20
|
+
export type ChipBinsSource = "matterjs" | "cert-bins";
|
|
21
|
+
|
|
22
|
+
/** Docker Hub repository publishing the official CHIP certification binaries. */
|
|
23
|
+
export const CERT_BINS_IMAGE = "connectedhomeip/chip-cert-bins";
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Maintainer-vetted default tag: the connectedhomeip commit SHA `chip-cert-bins` publishes for
|
|
27
|
+
* Matter 1.6.1, verified pullable and `linux/arm64`-inventoried at the time this integration was
|
|
28
|
+
* built. Override with `MATTER_CHIP_BINS_TAG`.
|
|
29
|
+
*/
|
|
30
|
+
export const DEFAULT_CERT_BINS_TAG = "df8bd0308caa0680e2a78cda724a959e5b385205";
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* `chip-cert-bins` publishes `linux/arm64` only, at every tag on Docker Hub (no `amd64` manifest
|
|
34
|
+
* has ever existed) — the official Test Harness targets Raspberry Pi hardware. Extraction always
|
|
35
|
+
* requests this platform regardless of host architecture; on non-arm64 hosts Docker runs it under
|
|
36
|
+
* emulation (QEMU), which is fine here since extraction only ever runs `cp`, never the app binaries
|
|
37
|
+
* themselves.
|
|
38
|
+
*/
|
|
39
|
+
export const CERT_BINS_PLATFORM = "linux/arm64";
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Whether a container platform string (as used for `Container.Configuration.platform`, e.g.
|
|
43
|
+
* `"linux/amd64"`) can run `chip-cert-bins` binaries bind-mounted into it. Verified directly: a
|
|
44
|
+
* platform mismatch doesn't fail at pull/extract time, only later at `exec` — `chip/state.ts`'s
|
|
45
|
+
* `configureContainer()` calls this up front so a mismatch fails fast with a clear error instead.
|
|
46
|
+
*/
|
|
47
|
+
export function chipBinsPlatformSupported(platform: string): boolean {
|
|
48
|
+
return platform === CERT_BINS_PLATFORM;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* File written into an extraction target directory recording the tag last extracted there. Doubles
|
|
53
|
+
* as the marker `cert-dsl.ts`'s `chipLocalMarkerRevision()` already reads for `RunRecord.chipRef` —
|
|
54
|
+
* a cert-bins extraction populates that evidence field for free, with no separate wiring.
|
|
55
|
+
*/
|
|
56
|
+
const STAMP_FILE = "CHIP_REF";
|
|
57
|
+
|
|
58
|
+
function isChipBinsSource(value: string): value is ChipBinsSource {
|
|
59
|
+
return value === "matterjs" || value === "cert-bins";
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Resolve which binary source a test run uses, from `MATTER_CHIP_BINS_SOURCE`. Unset (or empty)
|
|
64
|
+
* means unchanged default behavior: matter.js's own build.
|
|
65
|
+
*/
|
|
66
|
+
export function resolveChipBinsSource(): ChipBinsSource {
|
|
67
|
+
const value = env.MATTER_CHIP_BINS_SOURCE;
|
|
68
|
+
|
|
69
|
+
if (value === undefined || value === "") {
|
|
70
|
+
return "matterjs";
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (isChipBinsSource(value)) {
|
|
74
|
+
return value;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
throw new Error(`Unknown MATTER_CHIP_BINS_SOURCE "${value}" (expected "matterjs" or "cert-bins")`);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** The tag requested via `MATTER_CHIP_BINS_TAG`, before resolving a possible `"latest"`. */
|
|
81
|
+
export function requestedChipBinsTag(): string {
|
|
82
|
+
return env.MATTER_CHIP_BINS_TAG || DEFAULT_CERT_BINS_TAG;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Component distinguishing this host user's default cache directory from another local user's —
|
|
87
|
+
* `os.userInfo().uid` is stable and unique per POSIX user; falls back to the username where uid
|
|
88
|
+
* isn't meaningful (Windows always reports -1, as can some POSIX edge cases).
|
|
89
|
+
*/
|
|
90
|
+
function defaultChipBinsDirUser(): string {
|
|
91
|
+
const { uid, username } = userInfo();
|
|
92
|
+
return uid !== -1 ? String(uid) : username;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** Base host directory under which `chip-cert-bins` binaries are extracted, one subdirectory per tag. */
|
|
96
|
+
export function chipBinsDir(): string {
|
|
97
|
+
return env.MATTER_CHIP_BINS_DIR || join(tmpdir(), `matter-js-chip-cert-bins-${defaultChipBinsDirUser()}`);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Everything Docker itself allows in an image tag (grammar, and its 128-character length cap) —
|
|
102
|
+
* also all that's safe to use verbatim as a directory name.
|
|
103
|
+
*/
|
|
104
|
+
const VALID_TAG = /^[A-Za-z0-9_][A-Za-z0-9_.-]{0,127}$/;
|
|
105
|
+
|
|
106
|
+
function assertValidTag(tag: string): void {
|
|
107
|
+
if (!VALID_TAG.test(tag)) {
|
|
108
|
+
throw new Error(`Invalid chip-cert-bins tag "${tag}" (expected Docker's tag grammar, e.g. a commit SHA)`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Directory a given tag's binaries extract into and are cached under, one level below
|
|
114
|
+
* {@link chipBinsDir}. Scoping by tag means two runs against different tags can never clobber each
|
|
115
|
+
* other's `rm -rf`/`cp -a`/stamp-write, even sharing one `MATTER_CHIP_BINS_DIR` — each tag gets its own
|
|
116
|
+
* subtree, created fresh on first use.
|
|
117
|
+
*
|
|
118
|
+
* This does not make same-tag concurrency safe: two runs racing to extract the *same* tag into the
|
|
119
|
+
* same base directory at once can still interleave their `rm -rf`/`cp -a`/stamp-write (no cross-process
|
|
120
|
+
* lock exists). Point concurrent runs at different `MATTER_CHIP_BINS_DIR` values if they might extract
|
|
121
|
+
* the same tag at the same time — see the README's "Choosing a CHIP binary source" section.
|
|
122
|
+
*/
|
|
123
|
+
export function chipBinsExtractionDir(tag: string, baseDir: string = chipBinsDir()): string {
|
|
124
|
+
assertValidTag(tag);
|
|
125
|
+
return join(baseDir, tag);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** Injectable so `"latest"` resolution is unit-testable without a network call. */
|
|
129
|
+
export type LatestTagResolver = () => Promise<string>;
|
|
130
|
+
|
|
131
|
+
interface DockerHubTag {
|
|
132
|
+
name: string;
|
|
133
|
+
tag_last_pushed: string;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const COMMIT_SHA_TAG = /^[0-9a-f]{40}$/;
|
|
137
|
+
|
|
138
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
139
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function isDockerHubTag(value: unknown): value is DockerHubTag {
|
|
143
|
+
return isRecord(value) && typeof value.name === "string" && typeof value.tag_last_pushed === "string";
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Narrows Docker Hub's tags-list response to the shape this integration depends on
|
|
148
|
+
* (`{ results?: [{ name, tag_last_pushed }, ...] }`), so a shape drift on their end throws a clear,
|
|
149
|
+
* named error here instead of a `TypeError` from deep inside the later `.sort()`/`.name` access.
|
|
150
|
+
*/
|
|
151
|
+
export function parseDockerHubTagsResponse(body: unknown): DockerHubTag[] {
|
|
152
|
+
if (!isRecord(body) || (body.results !== undefined && !Array.isArray(body.results))) {
|
|
153
|
+
throw new Error(
|
|
154
|
+
`Docker Hub tags response for ${CERT_BINS_IMAGE} did not match the expected shape ` +
|
|
155
|
+
`(expected { results?: Array<{ name: string, tag_last_pushed: string }> })`,
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const { results } = body;
|
|
160
|
+
if (results === undefined) {
|
|
161
|
+
return [];
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (!results.every(isDockerHubTag)) {
|
|
165
|
+
throw new Error(
|
|
166
|
+
`Docker Hub tags response for ${CERT_BINS_IMAGE} contained a tag entry that did not match the ` +
|
|
167
|
+
`expected shape ({ name: string, tag_last_pushed: string })`,
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return results;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* There is no `latest` tag on the registry — every `chip-cert-bins` tag is a connectedhomeip commit
|
|
176
|
+
* SHA. Resolving "latest" means finding the most-recently-pushed SHA tag via the Docker Hub API.
|
|
177
|
+
*/
|
|
178
|
+
async function fetchLatestChipBinsTag(): Promise<string> {
|
|
179
|
+
const response = await fetch(`https://hub.docker.com/v2/repositories/${CERT_BINS_IMAGE}/tags?page_size=100`);
|
|
180
|
+
if (!response.ok) {
|
|
181
|
+
throw new Error(`Docker Hub tag lookup for ${CERT_BINS_IMAGE} failed: HTTP ${response.status}`);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const shaTags = parseDockerHubTagsResponse(await response.json()).filter(tag => COMMIT_SHA_TAG.test(tag.name));
|
|
185
|
+
if (!shaTags.length) {
|
|
186
|
+
throw new Error(`Docker Hub returned no commit-SHA tags for ${CERT_BINS_IMAGE}`);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
shaTags.sort((a, b) => b.tag_last_pushed.localeCompare(a.tag_last_pushed));
|
|
190
|
+
return shaTags[0].name;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Resolve a requested tag to a concrete one. Anything other than the literal string `"latest"`
|
|
195
|
+
* passes through unchanged (a pinned SHA, or a maintainer-curated default) — reproducible, no
|
|
196
|
+
* network access. `"latest"` is a live lookup, gated behind this explicit opt-in rather than made
|
|
197
|
+
* the default so ordinary runs stay reproducible without depending on network access.
|
|
198
|
+
*/
|
|
199
|
+
export async function resolveChipBinsTag(
|
|
200
|
+
requested: string,
|
|
201
|
+
fetchLatest: LatestTagResolver = fetchLatestChipBinsTag,
|
|
202
|
+
): Promise<string> {
|
|
203
|
+
if (requested !== "latest") {
|
|
204
|
+
return requested;
|
|
205
|
+
}
|
|
206
|
+
return fetchLatest();
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/** The subset of {@link Docker} extraction needs, narrowed so tests can substitute a fake. */
|
|
210
|
+
export interface ChipBinsDockerHandle {
|
|
211
|
+
pull(imageRef: string, platform: string): Promise<void>;
|
|
212
|
+
extractApps(imageRef: string, platform: string, targetDir: string): Promise<void>;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function realChipBinsDockerHandle(): ChipBinsDockerHandle {
|
|
216
|
+
const docker = new Docker();
|
|
217
|
+
return {
|
|
218
|
+
pull(imageRef, platform) {
|
|
219
|
+
return docker.pull(imageRef, platform);
|
|
220
|
+
},
|
|
221
|
+
async extractApps(imageRef, platform, targetDir) {
|
|
222
|
+
// Mirrors the official Test Harness's own update-sample-apps.sh: `rm` the target before
|
|
223
|
+
// `cp -a`, not just `cp -a` alone — a tag switch can drop an app the previous tag had,
|
|
224
|
+
// and `cp -a` never removes a destination file absent from the source, so skipping the
|
|
225
|
+
// `rm` would leave a stale binary from the old tag sitting under the new tag's stamp.
|
|
226
|
+
//
|
|
227
|
+
// `cp -a src/.` also replicates /root/apps' root ownership onto the bind-mounted target.
|
|
228
|
+
// On rootful Docker (container root is host root), that leaves the target unwritable by
|
|
229
|
+
// a non-root invoker, so the chown below restores the invoking user's ownership. On
|
|
230
|
+
// rootless Docker/Podman, container root already maps to the invoking host user, and
|
|
231
|
+
// this same chown can instead land the files on an unrelated subuid — best-effort here;
|
|
232
|
+
// `ensureChipBins`'s stamp write is the authority on whether extraction actually left
|
|
233
|
+
// `targetDir` writable.
|
|
234
|
+
const uid = process.getuid?.();
|
|
235
|
+
const gid = process.getgid?.();
|
|
236
|
+
const chownStep =
|
|
237
|
+
uid !== undefined && gid !== undefined ? ` && { chown -R ${uid}:${gid} /out || true; }` : "";
|
|
238
|
+
const container = await docker.start({
|
|
239
|
+
image: imageRef,
|
|
240
|
+
platform,
|
|
241
|
+
command: ["bash", "-c", `rm -rf /out/* && cp -a /root/apps/. /out/${chownStep}`],
|
|
242
|
+
binds: { [targetDir]: "/out" },
|
|
243
|
+
autoRemove: true,
|
|
244
|
+
});
|
|
245
|
+
await container.wait();
|
|
246
|
+
},
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export interface EnsureChipBinsResult {
|
|
251
|
+
tag: string;
|
|
252
|
+
dir: string;
|
|
253
|
+
/** False when the target directory already held this exact tag's binaries; extraction was skipped. */
|
|
254
|
+
extracted: boolean;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
async function readStamp(stampPath: string): Promise<string | undefined> {
|
|
258
|
+
try {
|
|
259
|
+
return (await readFile(stampPath, "utf-8")).trim();
|
|
260
|
+
} catch {
|
|
261
|
+
return undefined;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
function isErrnoException(value: unknown): value is NodeJS.ErrnoException {
|
|
266
|
+
return value instanceof Error && "code" in value;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Thrown when `targetDir` is not writable by the host after a `chip-cert-bins` extraction
|
|
271
|
+
* otherwise succeeded — the extraction container's UID mapping left files the host user cannot
|
|
272
|
+
* write, most often on rootless Docker/Podman (see the message for what to do about it).
|
|
273
|
+
*/
|
|
274
|
+
export class ChipBinsPermissionError extends Error {}
|
|
275
|
+
|
|
276
|
+
async function writeStamp(stampPath: string, tag: string, targetDir: string): Promise<void> {
|
|
277
|
+
try {
|
|
278
|
+
await writeFile(stampPath, tag);
|
|
279
|
+
} catch (e) {
|
|
280
|
+
if (isErrnoException(e) && (e.code === "EACCES" || e.code === "EPERM")) {
|
|
281
|
+
throw new ChipBinsPermissionError(
|
|
282
|
+
`chip-cert-bins:${tag} extracted into ${targetDir}, but writing the extraction stamp there ` +
|
|
283
|
+
`failed (${e.code}). This typically means the extraction container's UID mapping left the ` +
|
|
284
|
+
`directory unwritable by this host user — common on rootless Docker/Podman, where container ` +
|
|
285
|
+
`root already maps to the invoking host user and remapping ownership can instead land on an ` +
|
|
286
|
+
`unrelated subuid. Point MATTER_CHIP_BINS_DIR at a directory this host user can write to ` +
|
|
287
|
+
`regardless of the extraction container's UID mapping, or adjust your Docker/Podman ` +
|
|
288
|
+
`UID-mapping configuration.`,
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
throw e;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Thrown when an existing chip-cert-bins extraction directory is owned by a different host user —
|
|
297
|
+
* on a multi-user host that user could have pre-created it and planted binaries this harness later
|
|
298
|
+
* spawns.
|
|
299
|
+
*/
|
|
300
|
+
export class ChipBinsOwnershipError extends Error {}
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Refuse to trust an existing extraction directory this host user does not own, before any stamp
|
|
304
|
+
* read or extraction relies on its contents. Skipped when `process.getuid` is unavailable
|
|
305
|
+
* (Windows has no POSIX ownership) or when `MATTER_CHIP_BINS_DIR` was set explicitly — that
|
|
306
|
+
* directory is the caller's own responsibility.
|
|
307
|
+
*/
|
|
308
|
+
export async function assertChipBinsDirOwnership(dir: string): Promise<void> {
|
|
309
|
+
const getuid = process.getuid;
|
|
310
|
+
if (getuid === undefined || env.MATTER_CHIP_BINS_DIR) {
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
let stats;
|
|
315
|
+
try {
|
|
316
|
+
stats = await stat(dir);
|
|
317
|
+
} catch (e) {
|
|
318
|
+
if (isErrnoException(e) && e.code === "ENOENT") {
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
throw e;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
const uid = getuid();
|
|
325
|
+
if (stats.uid !== uid) {
|
|
326
|
+
throw new ChipBinsOwnershipError(
|
|
327
|
+
`chip-cert-bins extraction directory ${dir} is owned by uid ${stats.uid}, not this process's uid ` +
|
|
328
|
+
`${uid} — on a multi-user host another local user could have pre-created it and planted ` +
|
|
329
|
+
`binaries this harness later spawns. Point MATTER_CHIP_BINS_DIR at a directory only this user ` +
|
|
330
|
+
`can write to.`,
|
|
331
|
+
);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Ensure `targetDir` holds `chip-<app>-app`/`chip-tool` binaries extracted from
|
|
337
|
+
* `connectedhomeip/chip-cert-bins:<tag>`. Lazy and cached: if `targetDir`'s stamp file already
|
|
338
|
+
* records `tag`, this is a no-op. A stamp mismatch (different tag, or no stamp at all — including a
|
|
339
|
+
* prior extraction that crashed before writing one) triggers a fresh pull + extract, so a partial
|
|
340
|
+
* failure self-heals on the next call rather than wedging the cache.
|
|
341
|
+
*/
|
|
342
|
+
export async function ensureChipBins(
|
|
343
|
+
tag: string,
|
|
344
|
+
targetDir: string,
|
|
345
|
+
docker: ChipBinsDockerHandle = realChipBinsDockerHandle(),
|
|
346
|
+
): Promise<EnsureChipBinsResult> {
|
|
347
|
+
await assertChipBinsDirOwnership(targetDir);
|
|
348
|
+
|
|
349
|
+
const stampPath = join(targetDir, STAMP_FILE);
|
|
350
|
+
|
|
351
|
+
const cachedTag = await readStamp(stampPath);
|
|
352
|
+
if (cachedTag === tag) {
|
|
353
|
+
return { tag, dir: targetDir, extracted: false };
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
await mkdir(targetDir, { recursive: true, mode: 0o700 });
|
|
357
|
+
|
|
358
|
+
const imageRef = `${CERT_BINS_IMAGE}:${tag}`;
|
|
359
|
+
await docker.pull(imageRef, CERT_BINS_PLATFORM);
|
|
360
|
+
await docker.extractApps(imageRef, CERT_BINS_PLATFORM, targetDir);
|
|
361
|
+
|
|
362
|
+
await writeStamp(stampPath, tag, targetDir);
|
|
363
|
+
|
|
364
|
+
return { tag, dir: targetDir, extracted: true };
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
let preparePromise: Promise<EnsureChipBinsResult> | undefined;
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* Resolve the configured tag and ensure it's extracted, memoized process-wide so the classic
|
|
371
|
+
* yaml/python harness (`chip/state.ts`) and cert-test `chip-local` subjects
|
|
372
|
+
* (`chip/cert/chip-app-subject.ts`) — both of which may call this once per process — share a single
|
|
373
|
+
* pull/extract rather than racing each other. `docker` is injectable for tests only; production
|
|
374
|
+
* callers always take the default.
|
|
375
|
+
*
|
|
376
|
+
* A failed attempt clears the memo so the next call retries instead of being stuck replaying the
|
|
377
|
+
* same rejection for the rest of the process — matching `ensureChipBins()`'s own self-healing
|
|
378
|
+
* behavior on a failed extraction.
|
|
379
|
+
*/
|
|
380
|
+
export function prepareChipBins(
|
|
381
|
+
docker: ChipBinsDockerHandle = realChipBinsDockerHandle(),
|
|
382
|
+
): Promise<EnsureChipBinsResult> {
|
|
383
|
+
if (preparePromise === undefined) {
|
|
384
|
+
const promise = (async () => {
|
|
385
|
+
const tag = await resolveChipBinsTag(requestedChipBinsTag());
|
|
386
|
+
return ensureChipBins(tag, chipBinsExtractionDir(tag), docker);
|
|
387
|
+
})();
|
|
388
|
+
preparePromise = promise;
|
|
389
|
+
promise.catch(() => {
|
|
390
|
+
if (preparePromise === promise) {
|
|
391
|
+
preparePromise = undefined;
|
|
392
|
+
}
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
return preparePromise;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
/** Test-only: clears the process-wide memoization so each test starts from a clean slate. */
|
|
399
|
+
export function resetChipBinsPrepareCacheForTesting(): void {
|
|
400
|
+
preparePromise = undefined;
|
|
401
|
+
}
|
|
@@ -12,7 +12,9 @@ import colors from "ansi-colors";
|
|
|
12
12
|
* Adds coloring to improve visibility and updates the runner's state.
|
|
13
13
|
*/
|
|
14
14
|
export function parseStep(line: string, step: (name: string) => void) {
|
|
15
|
-
|
|
15
|
+
// `\S+`, not `\d+`: MatterBaseTest.print_step (matter_testing.py) accepts any step identifier, and
|
|
16
|
+
// named-step TCs (e.g. TC-SC-3.5's "1a"/"1b"/"1c") print alphanumeric ones, not just plain numbers.
|
|
17
|
+
const stepMatch = line.match(/^(.*\s\*{5})\s+(Test Step \S+)\s+:(?:\s+(\S.*)|\S.*)$/);
|
|
16
18
|
if (stepMatch) {
|
|
17
19
|
const [, prefix, stepNum, stepName] = stepMatch;
|
|
18
20
|
step(stepName);
|
package/src/chip/chip.ts
CHANGED
|
@@ -152,7 +152,7 @@ function createBuilder(initial: {
|
|
|
152
152
|
|
|
153
153
|
const tests = TestDescriptor.filter(chip.tests.descriptor, {
|
|
154
154
|
includePaths: [...includePaths],
|
|
155
|
-
kinds: ["py", "yaml"],
|
|
155
|
+
kinds: ["py", "yaml", "cert"],
|
|
156
156
|
pics: subject?.pics ?? chip.defaultPics,
|
|
157
157
|
});
|
|
158
158
|
|
package/src/chip/config.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { env } from "node:process";
|
|
8
|
+
import { resolveChipBinsSource } from "./chip-bins.js";
|
|
8
9
|
import { FIFO_PATH } from "./container-command-pipe.js";
|
|
9
10
|
import { PicsSource } from "./pics/source.js";
|
|
10
11
|
|
|
@@ -22,11 +23,32 @@ export namespace ContainerPaths {
|
|
|
22
23
|
export const accessoryClient =
|
|
23
24
|
"/usr/local/lib/python3.12/dist-packages/matter/yamltests/pseudo_clusters/clusters/accessory_server_bridge.py";
|
|
24
25
|
export const dummyWsServer = "/bin/mjs-ws-dummy";
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Where the harness "chip" container's `configureContainer()` bind-mounts the host directory
|
|
29
|
+
* `chip-bins.ts`'s extraction fills, when `MATTER_CHIP_BINS_SOURCE=cert-bins` selects the
|
|
30
|
+
* official `connectedhomeip/chip-cert-bins` binaries for the classic yaml/python tests.
|
|
31
|
+
*/
|
|
32
|
+
export const officialChipBinsDir = "/official-chip-bins";
|
|
25
33
|
}
|
|
26
34
|
|
|
27
35
|
export type ContainerPathsType = typeof ContainerPaths;
|
|
28
36
|
export interface ContainerPaths extends ContainerPathsType {}
|
|
29
37
|
|
|
38
|
+
/** Name of the shared harness composition `chip/state.ts`'s `configureContainer()` starts. */
|
|
39
|
+
export const HARNESS_COMPOSITION_NAME = "matter.js";
|
|
40
|
+
|
|
41
|
+
/** Part name of the harness composition's dbus sidecar. */
|
|
42
|
+
export const HARNESS_DBUS_PART_NAME = "dbus";
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Container name of the harness composition's dbus sidecar (`Composition.add` names containers
|
|
46
|
+
* `<composition>-<part>`). Cert-test chip-docker subjects check for this container and reuse the
|
|
47
|
+
* harness's dbus/mdns pair instead of starting their own — see `chip/cert/chip-app-subject.ts`'s
|
|
48
|
+
* `ChipDockerDevice`.
|
|
49
|
+
*/
|
|
50
|
+
export const HARNESS_DBUS_CONTAINER = `${HARNESS_COMPOSITION_NAME}-${HARNESS_DBUS_PART_NAME}`;
|
|
51
|
+
|
|
30
52
|
/**
|
|
31
53
|
* Specify the base filename to use for a test. This specifies a "winner" in the case of conflicts.
|
|
32
54
|
*/
|
|
@@ -76,8 +98,13 @@ export namespace Constants {
|
|
|
76
98
|
/**
|
|
77
99
|
* The server will not find chip-tool unless we provide an explicit path. The failure mode is a little
|
|
78
100
|
* non-obvious as it doesn't try to start the server but attempts to establish a websocket connection regardless.
|
|
101
|
+
*
|
|
102
|
+
* When MATTER_CHIP_BINS_SOURCE=cert-bins, points at the official chip-tool binary bind-mounted
|
|
103
|
+
* into the container at {@link ContainerPaths.officialChipBinsDir} (see chip/state.ts's
|
|
104
|
+
* configureContainer) instead of the one baked into matter.js's own image.
|
|
79
105
|
*/
|
|
80
|
-
const chipToolPath =
|
|
106
|
+
export const chipToolPath =
|
|
107
|
+
resolveChipBinsSource() === "cert-bins" ? `${ContainerPaths.officialChipBinsDir}/chip-tool` : "/bin/chip-tool";
|
|
81
108
|
|
|
82
109
|
/**
|
|
83
110
|
* Default arguments provided to the YAML runner.
|
package/src/chip/index.ts
CHANGED
|
@@ -4,6 +4,73 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
// Cert-test seams are exported explicitly rather than via a wildcard `export *`, so the public
|
|
8
|
+
// surface stays deliberate. Most stay package-internal (tests within this package import them
|
|
9
|
+
// relatively); the ones below marked "test seam — not API" are re-exported anyway because
|
|
10
|
+
// support/chip-testing's own cert-framework tests (a separate package, `@matter/testing` consumer)
|
|
11
|
+
// need them and can only reach this module's `.` entrypoint.
|
|
12
|
+
export type {
|
|
13
|
+
CertDevice,
|
|
14
|
+
CertDeviceFactory,
|
|
15
|
+
CertStepContext,
|
|
16
|
+
CertStepDefinition,
|
|
17
|
+
CertTestDefinition,
|
|
18
|
+
CheckRecord,
|
|
19
|
+
DeviceExitInfo,
|
|
20
|
+
DeviceFlavor,
|
|
21
|
+
LogSource,
|
|
22
|
+
StepRecorder,
|
|
23
|
+
StepVerdict,
|
|
24
|
+
} from "./cert/cert-context.js";
|
|
25
|
+
export { certTest, MultiDeviceUnsupportedError } from "./cert/cert-dsl.js";
|
|
26
|
+
export type { CertStepOptions, CertTestBuilder, CertTestOptions } from "./cert/cert-dsl.js";
|
|
27
|
+
/** @internal Test seam — not API. Production cert tests go through the `certTest()` DSL, not this class directly. */
|
|
28
|
+
export { CertTest } from "./cert/cert-test.js";
|
|
29
|
+
export { ChipDockerSubject, ChipLocalSubject } from "./cert/chip-app-subject.js";
|
|
30
|
+
/** @internal Test seam — not API. `ChipDockerDevice`'s own constructor, and its Docker collaborator types. */
|
|
31
|
+
export { ChipDockerDevice, HARNESS_DBUS_CONTAINER } from "./cert/chip-app-subject.js";
|
|
32
|
+
/** @internal Test seam — not API. */
|
|
33
|
+
export type { CompositionHandle, DockerHandle } from "./cert/chip-app-subject.js";
|
|
34
|
+
export { registerControllerAdapterFactory } from "./cert/controller-adapter.js";
|
|
35
|
+
export type {
|
|
36
|
+
AttributePathSpec,
|
|
37
|
+
CertNodeApi,
|
|
38
|
+
CertNodeRef,
|
|
39
|
+
CommissioningTarget,
|
|
40
|
+
ControllerAdapter,
|
|
41
|
+
ControllerAdapterFactory,
|
|
42
|
+
ReadAttributeOptions,
|
|
43
|
+
SubscribeOptions,
|
|
44
|
+
} from "./cert/controller-adapter.js";
|
|
45
|
+
export { resolveDeviceFlavor } from "./cert/device-config.js";
|
|
46
|
+
export { EvidenceRecorder } from "./cert/evidence.js";
|
|
47
|
+
export type { RunRecord, StepRecord } from "./cert/evidence.js";
|
|
48
|
+
export { CertLogClosedError, CertLogTimeoutError, LogFollower } from "./cert/log-follower.js";
|
|
49
|
+
export type { LogExpectOptions, LogExpectPatterns, LogExpectResult, LogLine } from "./cert/log-follower.js";
|
|
50
|
+
export { registerMatterJsCertSubject } from "./cert/matterjs-subject-registry.js";
|
|
51
|
+
export { PromptDrivenPythonTest } from "./cert/prompt-driven-python-test.js";
|
|
52
|
+
export type { PromptHandler } from "./cert/prompt-driven-python-test.js";
|
|
53
|
+
export {
|
|
54
|
+
assertChipBinsDirOwnership,
|
|
55
|
+
CERT_BINS_IMAGE,
|
|
56
|
+
CERT_BINS_PLATFORM,
|
|
57
|
+
ChipBinsOwnershipError,
|
|
58
|
+
ChipBinsPermissionError,
|
|
59
|
+
chipBinsDir,
|
|
60
|
+
chipBinsExtractionDir,
|
|
61
|
+
chipBinsPlatformSupported,
|
|
62
|
+
DEFAULT_CERT_BINS_TAG,
|
|
63
|
+
ensureChipBins,
|
|
64
|
+
prepareChipBins,
|
|
65
|
+
requestedChipBinsTag,
|
|
66
|
+
resolveChipBinsSource,
|
|
67
|
+
resolveChipBinsTag,
|
|
68
|
+
} from "./chip-bins.js";
|
|
69
|
+
export type { ChipBinsSource, EnsureChipBinsResult } from "./chip-bins.js";
|
|
70
|
+
/** @internal Test seam — not API. */
|
|
71
|
+
export { parseDockerHubTagsResponse, resetChipBinsPrepareCacheForTesting } from "./chip-bins.js";
|
|
72
|
+
/** @internal Test seam — not API. */
|
|
73
|
+
export type { ChipBinsDockerHandle } from "./chip-bins.js";
|
|
7
74
|
export * from "./chip.js";
|
|
8
75
|
export * from "./command-pipe.js";
|
|
9
76
|
export * from "./pics/index.js";
|
package/src/chip/pics/file.ts
CHANGED
|
@@ -6,6 +6,14 @@
|
|
|
6
6
|
|
|
7
7
|
import { PicsValues } from "./values.js";
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Thrown by a `Subject.pics` accessor (or `chip.defaultPics`) when no PICS file is available for
|
|
11
|
+
* the subject — e.g. the harness hasn't initialized one, or the device kind has none at all.
|
|
12
|
+
* Distinct from other errors a PICS accessor may raise: "no PICS" means PICS gating is simply
|
|
13
|
+
* inactive, not that something is broken (see `cert-test.ts`'s `resolvePicsFile`).
|
|
14
|
+
*/
|
|
15
|
+
export class PicsUnavailableError extends Error {}
|
|
16
|
+
|
|
9
17
|
/**
|
|
10
18
|
* In-memory Matter PICS file.
|
|
11
19
|
*
|