Skip to content

Commit c9c89ac

Browse files
committed
rename cli helper for convenience
1 parent a9d2f11 commit c9c89ac

File tree

5 files changed

+17
-4
lines changed

5 files changed

+17
-4
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ If a change affects behavior, outputs, or safety boundaries, it needs matching w
1818
Preferred coverage options (in roughly increasing integration cost):
1919

2020
- Rust unit tests for pure logic
21-
- Rust integration tests in `controller/tests/`
21+
- Rust integration tests in `controller/integration/`
2222
- Smoke scripts in `tests/suites/smoke/` against a built `PolicyWitness.app`
2323

2424
### Write Swift like you want it trivially reverse-engineered

controller/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ path = "src/main.rs"
1212
name = "sandbox-log-observer"
1313
path = "src/bin/sandbox-log-observer.rs"
1414

15+
[[test]]
16+
name = "cli_contract"
17+
path = "integration/cli_contract.rs"
18+
1519
[dependencies]
1620
serde = { version = "1", features = ["derive"] }
1721
serde_json = "1"
Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
//! CLI contract integration tests for the controller binary.
2+
//!
3+
//! These tests run the built PolicyWitness.app to validate the end-to-end
4+
//! envelope shape and instrumentation injection behavior. They are gated behind
5+
//! PW_INTEGRATION=1 so `cargo test --tests` can run without a built app.
6+
17
use std::env;
28
use std::path::{Path, PathBuf};
39
use std::process::{Command, Output};
@@ -15,6 +21,7 @@ fn repo_root() -> PathBuf {
1521

1622
fn pw_bin_path() -> PathBuf {
1723
if let Ok(val) = env::var("PW_BIN_PATH") {
24+
// Allow CI or local runs to point at a non-standard build location.
1825
return PathBuf::from(val);
1926
}
2027
repo_root()
@@ -27,6 +34,7 @@ fn pw_bin_path() -> PathBuf {
2734
fn require_pw_bin() -> PathBuf {
2835
let path = pw_bin_path();
2936
if !path.exists() {
37+
// The integration suite assumes a built app bundle is available.
3038
panic!(
3139
"PolicyWitness.app not found at {} (build the app or set PW_BIN_PATH)",
3240
path.display()
@@ -49,8 +57,8 @@ fn specimen_smoke_file_read_deny() {
4957
}
5058
let bin = require_pw_bin();
5159

52-
// Note: sandboxed automation harnesses can block XPC lookup or unified log access.
53-
// If this test fails with those symptoms, rerun from a normal Terminal to confirm.
60+
// Sandboxed harnesses can block XPC lookup or unified log access; rerun from
61+
// a normal Terminal if failures look environment-related.
5462

5563
let specimen = repo_root()
5664
.join("tests")

tests/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ see `tests/suites/<suite>/README.md`.
7070

7171
- `preflight`: codesign/entitlements inspection only (no execution)
7272
- `unit`: Rust unit tests (`cargo test --bins`)
73-
- `integration`: Rust integration tests (`cargo test --tests`), primarily `controller/tests/cli_integration.rs`
73+
- `integration`: Rust integration tests (`cargo test --tests`), primarily `controller/integration/cli_contract.rs`
7474
- `runner_debuggable`: smoke + blackbox coverage via the built-in debuggable runner
7575
- `runner_byoxpc`: smoke + blackbox coverage via a BYOXPC runner (opt-in)
7676
- `runner_machme`: smoke + blackbox coverage via a MachMe runner (opt-in)

tests/suites/integration/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Rust integration tests that exercise the CLI contract against a built app.
77
- Uses `PolicyWitness.app/Contents/MacOS/policy-witness` to run specimens.
88
- Validates the controller envelope and runner result shape.
99
- Exercises instrumentation injection and duplicate protection.
10+
- Test source lives at `controller/integration/cli_contract.rs`.
1011

1112
## Success criteria
1213

0 commit comments

Comments
 (0)