Skip to content

Commit 858afc6

Browse files
committed
fix(test): fail loudly on root with cfg escape hatch for fs_errors
Instead of silently skipping, panic with an actionable error message when running as root. The test can be excluded entirely via `RUSTFLAGS='--cfg pdu_test_skip_fs_errors'` for environments like Claude Code Web where root is unavoidable. https://claude.ai/code/session_01Ki7wbrgQXWs2GXf8h2hybQ
1 parent 94aaf33 commit 858afc6

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

tests/cli_errors.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,15 @@ fn max_depth_0() {
106106
}
107107

108108
#[cfg(unix)]
109+
#[cfg(not(pdu_test_skip_fs_errors))]
109110
#[test]
110111
fn fs_errors() {
111112
if unsafe { libc::geteuid() } == 0 {
112-
eprintln!("SKIPPED: fs_errors test cannot work as root (permission checks are bypassed)");
113-
return;
113+
panic!(
114+
"{}\n{}",
115+
"error: Attempt to run this test on root environment was detected. Such an environment would affect the accuracy of this test.",
116+
"hint: Either run this test on non-root environment or set `RUSTFLAGS='--cfg pdu_test_skip_fs_errors'` to skip this error.",
117+
);
114118
}
115119

116120
let workspace = SampleWorkspace::default();

0 commit comments

Comments
 (0)