[tests] Do not assume no stderr with thin_dump

This commit is contained in:
Ming-Hung Tsai 2021-08-30 16:19:54 +08:00
parent 9aa36f017a
commit 47d39d1efa
2 changed files with 13 additions and 4 deletions

View File

@ -114,6 +114,7 @@ fn dump_restore_cycle() -> Result<()> {
// test no stderr with a normal dump
#[test]
#[cfg(not(feature = "rust_tests"))]
fn no_stderr() -> Result<()> {
let mut td = TestDir::new()?;
@ -133,7 +134,9 @@ fn override_something(flag: &str, value: &str, pattern: &str) -> Result<()> {
let md = mk_valid_md(&mut td)?;
let output = run_ok_raw(THIN_DUMP, args![&md, flag, value])?;
assert_eq!(output.stderr.len(), 0);
if !cfg!(feature = "rust_tests") {
assert_eq!(output.stderr.len(), 0);
}
assert!(from_utf8(&output.stdout[0..])?.contains(pattern));
Ok(())
}
@ -179,7 +182,9 @@ fn repair_superblock() -> Result<()> {
&md
],
)?;
assert_eq!(after.stderr.len(), 0);
if !cfg!(feature = "rust_tests") {
assert_eq!(after.stderr.len(), 0);
}
assert_eq!(before.stdout, after.stdout);
Ok(())

View File

@ -148,7 +148,9 @@ fn superblock_succeeds() -> Result<()> {
&md1
],
)?;
assert_eq!(original.stderr.len(), 0);
if !cfg!(feature = "rust_tests") {
assert_eq!(original.stderr.len(), 0);
}
damage_superblock(&md1)?;
let md2 = mk_zeroed_md(&mut td)?;
run_ok(
@ -164,7 +166,9 @@ fn superblock_succeeds() -> Result<()> {
],
)?;
let repaired = run_ok_raw(THIN_DUMP, args![&md2])?;
assert_eq!(repaired.stderr.len(), 0);
if !cfg!(feature = "rust_tests") {
assert_eq!(repaired.stderr.len(), 0);
}
assert_eq!(original.stdout, repaired.stdout);
Ok(())
}