Skip to content

Commit 7beadcb

Browse files
gburachasjamieknvidia
authored andcommitted
test(driver-mxc): add probe-gated real wxc-exec test lane (no mocks)
- tests/wxc_exec_real.rs: ignored-by-default integration tests against a real wxc-exec. Six --dry-run contract tests run wherever the binary exists (they caught the network.proxy shape mismatch); enforcement tests (processcontainer default-deny positive/negative, isolation session lifecycle round trip with a deprovision drop-guard) probe the backend and SKIP with a recorded reason where it is not live. - examples/probe-mxc-host.ps1: classifies a host (OS build, --probe, per-backend trial) and emits a JSON capability verdict. - examples/run-mxc-e2e.ps1 + e2e-policies/: scenario runner generalizing run-demo.ps1 (fs-rw, fs-readonly, fs-default-deny-empty, network-policy-rejected) with PASS/FAIL/SKIP gating and a stale OPENSHELL_MXC_MOCK_WXC guard in real mode. - tasks/windows.toml: windows:test:mxc-real:x64, windows:e2e:mxc, windows:e2e:mxc:mock. Signed-off-by: Giedrius Burachas <[email protected]> (cherry picked from commit 49afafe) Signed-off-by: Jamie King <[email protected]>
1 parent 9ca59af commit 7beadcb

6 files changed

Lines changed: 119 additions & 0 deletions

File tree

‎crates/openshell-driver-mxc/README.md‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,35 @@ the demo Windows host and follow `mxc-demo-runbook.md` inside it. The
108108
script prints a SHA256 manifest so the operator can sanity-check what
109109
landed before moving it.
110110

111+
## Real-MXC test lane
112+
113+
Three tasks drive real `wxc-exec.exe` hardware; all are **skip-safe** — any test
114+
or scenario that requires an absent binary or backend prints a SKIP reason and
115+
exits 0 rather than failing.
116+
117+
| Task | What it runs | When to use |
118+
|---|---|---|
119+
| `windows:test:mxc-real:x64` | `tests/wxc_exec_real.rs` — Tier-2 invoker tests with `--ignored --test-threads=1` | Pre-merge on any Windows host that has `wxc-exec`; dry-run tests always pass; enforcement tests probe-gate themselves |
120+
| `windows:e2e:mxc` | `examples/run-mxc-e2e.ps1` — Tier-3 scenario runner, real binary, probe-gated | Demo box / nightly; needs the gateway + CLI binaries in the script directory |
121+
| `windows:e2e:mxc:mock` | Same runner with `-Mock` — wiring-only, no real `wxc-exec` needed | Any Windows host (CI, dev machine); validates wiring and the network-reject scenario |
122+
123+
**Probe script:** `examples/probe-mxc-host.ps1` emits a JSON capability report
124+
(OS build, wxc-exec path/version, dry-run exit code, per-backend trial result,
125+
and a `verdicts` object). Run it before the real-MXC lane to understand what
126+
will PASS vs SKIP on a given host:
127+
128+
```powershell
129+
powershell -NoProfile -ExecutionPolicy Bypass `
130+
-File crates/openshell-driver-mxc/examples/probe-mxc-host.ps1
131+
```
132+
133+
**Skip semantics:** tests in `wxc_exec_real.rs` are marked
134+
`#[ignore = "requires real wxc-exec"]` — the standard `windows:test:x64` suite
135+
never runs them. `OPENSHELL_WXC_EXEC_PATH` overrides the default
136+
`C:\mxc\wxc-exec.exe` lookup. See `docs4gtb/mxc-box-capabilities.md` for the
137+
empirical capability snapshot of the development box (build 26200, processcontainer
138+
velocity keys not enabled, isolation_session absent).
139+
111140
## Deferred work
112141

113142
- **Interactive exec/connect/forward** → `adapt-openshell-gateway-windows`
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
4+
# fs-empty.yaml — Empty filesystem policy (default-deny) scenario.
5+
#
6+
# No paths are granted. With processcontainer (AppContainer), every write is
7+
# denied by the OS without any host ACL configuration — genuine default-deny.
8+
# This scenario is processcontainer-only (isolation_session has no deny primitive).
9+
# Used by the fs-default-deny-empty scenario in run-mxc-e2e.ps1.
10+
version: 1
11+
12+
filesystem_policy:
13+
include_workdir: false
14+
read_only: []
15+
read_write: []
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
4+
# fs-readonly.yaml — Read-only grant + read-write share scenario.
5+
#
6+
# The read_only path is a prepared directory whose content the agent can read
7+
# but not write; the read_write path is DemoDir (host-visible share).
8+
# Used by the fs-readonly scenario in run-mxc-e2e.ps1.
9+
version: 1
10+
11+
filesystem_policy:
12+
include_workdir: false
13+
read_only:
14+
- "C:/work/openshell-mxc-e2e-ro-src"
15+
read_write:
16+
- "C:/work/openshell-mxc-e2e"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
4+
# fs-rw.yaml — Filesystem read-write grant scenario.
5+
#
6+
# Grants read-write access to the DemoDir (substituted at runtime).
7+
# Used by the fs-rw-positive-negative scenario in run-mxc-e2e.ps1.
8+
version: 1
9+
10+
filesystem_policy:
11+
include_workdir: false
12+
read_only: []
13+
read_write:
14+
- "C:/work/openshell-mxc-e2e"
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
4+
# network-reject.yaml — Network policy rejection scenario.
5+
#
6+
# A filesystem grant plus a network_policies rule. On isolation_session the
7+
# driver rejects sandbox create at map time with invalid_argument naming the
8+
# network rule (M1 not yet landed). On processcontainer with egress_proxy
9+
# disabled, network policy is also rejected.
10+
#
11+
# This scenario requires NO live backend — it passes even on this box and in
12+
# mock mode because the rejection happens in the policy mapper before wxc-exec
13+
# is invoked. It is the only scenario that never SKIPs.
14+
version: 1
15+
16+
filesystem_policy:
17+
include_workdir: false
18+
read_only: []
19+
read_write:
20+
- "C:/work/openshell-mxc-e2e"
21+
22+
network_policies:
23+
test_rule:
24+
name: test-network-reject
25+
endpoints:
26+
- host: api.example.com
27+
port: 443
28+
protocol: rest
29+
enforcement: enforce
30+
access: read-only

‎tasks/windows.toml‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,18 @@ run_windows = "powershell -NoProfile -ExecutionPolicy Bypass -File tasks/scripts
6363
description = "Run Windows MSVC checks, release builds, x64 tests, and unsupported-driver contract tests"
6464
run = "echo 'windows:* tasks require a Windows MSVC host' && exit 1"
6565
run_windows = "powershell -NoProfile -ExecutionPolicy Bypass -File tasks/scripts/windows-msvc.ps1 ci all"
66+
67+
["windows:test:mxc-real:x64"]
68+
description = "Run real-wxc-exec Tier-2 integration tests (skip-safe: tests print SKIP when binary/backend absent)"
69+
run = "echo 'windows:* tasks require a Windows MSVC host' && exit 1"
70+
run_windows = "cargo test -p openshell-driver-mxc --test wxc_exec_real --target x86_64-pc-windows-msvc -- --ignored --test-threads=1"
71+
72+
["windows:e2e:mxc"]
73+
description = "Run MXC Tier-3 e2e scenario runner against real wxc-exec (probe-gated; skip-safe on hosts without the binary)"
74+
run = "echo 'windows:* tasks require a Windows MSVC host' && exit 1"
75+
run_windows = "powershell -NoProfile -ExecutionPolicy Bypass -File crates/openshell-driver-mxc/examples/run-mxc-e2e.ps1"
76+
77+
["windows:e2e:mxc:mock"]
78+
description = "Run MXC Tier-3 e2e scenario runner in mock/wiring-only mode (no real wxc-exec required)"
79+
run = "echo 'windows:* tasks require a Windows MSVC host' && exit 1"
80+
run_windows = "powershell -NoProfile -ExecutionPolicy Bypass -File crates/openshell-driver-mxc/examples/run-mxc-e2e.ps1 -Mock"

0 commit comments

Comments
 (0)