Skip to content

Commit

Permalink
cp: fix "unused variable" warning on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
cakebaker committed Jun 27, 2023
1 parent 461047c commit 732dbb3
Showing 1 changed file with 24 additions and 12 deletions.
36 changes: 24 additions & 12 deletions tests/by-util/test_cp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3127,27 +3127,39 @@ fn test_cp_debug_sparse_auto() {
let ts = TestScenario::new(util_name!());
let at = &ts.fixtures;
at.touch("a");
let result = ts
.ucmd()

#[cfg(not(any(target_os = "linux", target_os = "macos")))]
ts.ucmd()
.arg("--debug")
.arg("--sparse=auto")
.arg("a")
.arg("b")
.succeeds();

#[cfg(any(target_os = "linux", target_os = "macos"))]
let stdout_str = result.stdout_str();

#[cfg(target_os = "macos")]
if !stdout_str
.contains("copy offload: unknown, reflink: unsupported, sparse detection: unsupported")
{
panic!("Failure: stdout was \n{stdout_str}");
}
let result = ts
.ucmd()
.arg("--debug")
.arg("--sparse=auto")
.arg("a")
.arg("b")
.succeeds();

#[cfg(target_os = "linux")]
if !stdout_str.contains("copy offload: unknown, reflink: unsupported, sparse detection: no") {
panic!("Failure: stdout was \n{stdout_str}");
let stdout_str = result.stdout_str();

#[cfg(target_os = "macos")]
if !stdout_str
.contains("copy offload: unknown, reflink: unsupported, sparse detection: unsupported")
{
panic!("Failure: stdout was \n{stdout_str}");
}

#[cfg(target_os = "linux")]
if !stdout_str.contains("copy offload: unknown, reflink: unsupported, sparse detection: no")
{
panic!("Failure: stdout was \n{stdout_str}");
}
}
}

Expand Down

0 comments on commit 732dbb3

Please sign in to comment.