embedded-test icon indicating copy to clipboard operation
embedded-test copied to clipboard

Log output capture (-> make the logs less noisy)

Open MabezDev opened this issue 1 year ago • 4 comments

running 4 tests
test tests::test_symestric_transfer                      ... INFO  Test exited with () or Ok(..)
└─ embedded_test::export::check_outcome @ /home/mabez/.cargo/git/checkouts/embedded-test-f175ea47b6323482/b67dec3/src/fmt.rs:37  
ok
test tests::test_asymestric_transfer                     ... INFO  Running test: Test { name: "tests::test_asymestric_transfer", function: 0x420011cc, should_panic: false, ignored: false, timeout: None }
└─ embedded_test::export::run_tests @ /home/mabez/.cargo/git/checkouts/embedded-test-f175ea47b6323482/b67dec3/src/fmt.rs:37  
INFO  Test exited with () or Ok(..)
└─ embedded_test::export::check_outcome @ /home/mabez/.cargo/git/checkouts/embedded-test-f175ea47b6323482/b67dec3/src/fmt.rs:37  
ok
test tests::test_symestric_transfer_huge_buffer          ... INFO  Test exited with () or Ok(..)
└─ embedded_test::export::check_outcome @ /home/mabez/.cargo/git/checkouts/embedded-test-f175ea47b6323482/b67dec3/src/fmt.rs:37  
ok
test tests::test_symestric_transfer_huge_buffer_no_alloc ... INFO  Test exited with () or Ok(..)
└─ embedded_test::export::check_outcome @ /home/mabez/.cargo/git/checkouts/embedded-test-f175ea47b6323482/b67dec3/src/fmt.rs:37  
ok

MabezDev avatar Mar 30 '24 18:03 MabezDev

Try to remove the defmt (or log) feature from the embedded-test crate.

I'll document the features asap. For now, refer to the Cargo.toml of the crate.

t-moe avatar Mar 30 '24 18:03 t-moe

I think I'd rather if embedded-test collected logs into memory and printed them if a test failed. A log feature that interleaves itself into the "UI" output isn't ideal but keeping it enabled may still be useful.

bugadani avatar Apr 05 '24 20:04 bugadani

There are two things here:

  1. I think @MabezDev was talking about the log messages from embedded-test (Running Test... and Test Exited with...). They can be disabled by removing the log/defmt feature. The log/defmt output from the user will still be printed
  2. I think you @bugadani are talking about "output capturing". This is a different story. But Yes, we could implement that. (Libtest-mimic even has a no-op parameter for it)

t-moe avatar Apr 05 '24 21:04 t-moe

The issue opener is a bit vague on what Mabez wants, so yeah I guess I'm hijacking this a bit with output capture, but I feel like we can appropriate this issue for some brainstorming. I'm guessing capture would solve most of the clutter, which is at least party caused by the log strings getting printed into the same line as test ... ok.

Anyway disregarding that, there's still one more aspect: embedded-test probably shouldn't print defmt location info by default, especially not for embedded-test-specific log strings. I'M not sure about the rest, I'm still not convinced that defmt should print any location info by default, but people seem to like that so ¯\_(ツ)_/¯.

bugadani avatar Apr 06 '24 02:04 bugadani