Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

defmt-test: hide unit test output unless it panicked #167

Open
japaric opened this issue Mar 4, 2021 · 0 comments
Open

defmt-test: hide unit test output unless it panicked #167

japaric opened this issue Mar 4, 2021 · 0 comments
Labels
difficulty: medium Somewhat difficult to solve priority: low Low priority for the Knurling team type: enhancement Enhancement or feature request

Comments

@japaric
Copy link
Member

japaric commented Mar 4, 2021

it would be nice if probe-run could replicate this behavior of the standard test runner

Desired behavior

#[test]
fn passes() {
    trace!("this is OK!");
}

#[test]
fn fails() {
    trace!("this fails");
    panic!()
}
$ cargo t
0.000000 INFO  (1/2) running `passes`...
0.000002 INFO  (2/2) running `fails`...
0.000003 TRACE this fails
0.000004 ERROR explicit panic (..)

note that timestamp 1 is missing from the output. the device does execute the log statement but probe-run hides it


the hard part of implementing this is making probe-run aware (a) that is running a defmt-test binary and (b) of where test functions start and end. I think this could be implemented by adding a custom tag to the defmt-test log statement (that says "({}/{}) running .."); probe-run can use those custom tags to determine the boundaries of tests.

@Urhengulas Urhengulas added difficulty: medium Somewhat difficult to solve priority: low Low priority for the Knurling team type: enhancement Enhancement or feature request labels Mar 8, 2021
@Urhengulas Urhengulas added this to Incoming in Issue Triage via automation Mar 8, 2021
@Urhengulas Urhengulas moved this from Incoming to Triaged in Issue Triage Mar 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
difficulty: medium Somewhat difficult to solve priority: low Low priority for the Knurling team type: enhancement Enhancement or feature request
Projects
No open projects
Development

No branches or pull requests

2 participants