Skip to content

Commit bcbc012

Browse files
Merge #946
946: Ignore tests that touch the filesystem if sandboxed. r=Emilgardis,otavio a=Alexhuszagh Adds an environment variable `CROSS_SANDBOXED` that skips tests that touch the filesystem if set. Closes #943. Co-authored-by: Alex Huszagh <ahuszagh@gmail.com>
2 parents b0e3b54 + 777e7ac commit bcbc012

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/build.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ fn main() {
2323
.unwrap()
2424
.write_all(commit_info().as_bytes())
2525
.unwrap();
26+
27+
if env::var("CROSS_SANDBOXED").is_ok() {
28+
println!("cargo:rustc-cfg=cross_sandboxed");
29+
}
30+
println!("cargo:rerun-if-env-changed=CROSS_SANDBOXED");
2631
}
2732

2833
fn commit_info() -> String {

src/docker/shared.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,6 +1115,7 @@ mod tests {
11151115
}
11161116

11171117
#[test]
1118+
#[cfg_attr(cross_sandboxed, ignore)]
11181119
fn test_host() -> Result<()> {
11191120
let vars = unset_env();
11201121
let mount_finder = MountFinder::new(vec![]);

0 commit comments

Comments
 (0)