From 29b5c12b387174c45cd5d10867bd274efd87e634 Mon Sep 17 00:00:00 2001 From: "Andres O. Vela" Date: Sat, 15 Jul 2023 15:33:34 +0200 Subject: [PATCH 01/17] Add support for log_format option for defmt_decoder --- src/cli.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/cli.rs b/src/cli.rs index 4ec4c16..4fb359e 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -59,6 +59,10 @@ pub struct Opts { #[arg(long)] list_probes: bool, + /// Applies the given format to the log output. + #[arg(long)] + pub log_format: Option, + /// Whether to measure the program's stack consumption. #[arg(long)] pub measure_stack: bool, @@ -106,8 +110,9 @@ const HELPER_CMDS: [&str; 3] = ["list_chips", "list_probes", "version"]; pub fn handle_arguments() -> anyhow::Result { let opts = Opts::parse(); let verbose = opts.verbose; + let log_format = opts.log_format.as_ref().map(|s| s.as_str()); - defmt_decoder::log::init_logger(verbose >= 1, opts.json, move |metadata| { + defmt_decoder::log::init_logger(log_format, opts.json, move |metadata| { if defmt_decoder::log::is_defmt_frame(metadata) { true // We want to display *all* defmt frames. } else { From 68c941ce10feb99146d1f92d9f190827410b8a74 Mon Sep 17 00:00:00 2001 From: "Andres O. Vela" Date: Sat, 15 Jul 2023 16:01:17 +0200 Subject: [PATCH 02/17] Fix CI (clippy, changelog) --- CHANGELOG.md | 2 ++ src/cli.rs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 85fae69..653c578 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,11 +6,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p ## [Unreleased] +- [#416] Add support for log_format option for defmt decoder - [#410] Simplify canary - [#405] Also enable merge queue for changelog enforcer - [#404] Switch from bors to merge queue - [#402] Do not panic if locations do not contain the frame +[#416]: https://github.com/knurling-rs/probe-run/pull/416 [#410]: https://github.com/knurling-rs/probe-run/pull/410 [#405]: https://github.com/knurling-rs/probe-run/pull/405 [#404]: https://github.com/knurling-rs/probe-run/pull/404 diff --git a/src/cli.rs b/src/cli.rs index 4fb359e..301ac6e 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -110,7 +110,7 @@ const HELPER_CMDS: [&str; 3] = ["list_chips", "list_probes", "version"]; pub fn handle_arguments() -> anyhow::Result { let opts = Opts::parse(); let verbose = opts.verbose; - let log_format = opts.log_format.as_ref().map(|s| s.as_str()); + let log_format = opts.log_format.as_deref(); defmt_decoder::log::init_logger(log_format, opts.json, move |metadata| { if defmt_decoder::log::is_defmt_frame(metadata) { From 4318e241cddcaf93c4d4fdd306c1d44cd63d9783 Mon Sep 17 00:00:00 2001 From: "Andres O. Vela" Date: Mon, 17 Jul 2023 20:54:38 +0200 Subject: [PATCH 03/17] Add support for host_log_format and add default formats --- src/cli.rs | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/cli.rs b/src/cli.rs index 301ac6e..5021db3 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -63,6 +63,10 @@ pub struct Opts { #[arg(long)] pub log_format: Option, + /// Applies the given format to the host log output. + #[arg(long)] + pub host_log_format: Option, + /// Whether to measure the program's stack consumption. #[arg(long)] pub measure_stack: bool, @@ -110,9 +114,26 @@ const HELPER_CMDS: [&str; 3] = ["list_chips", "list_probes", "version"]; pub fn handle_arguments() -> anyhow::Result { let opts = Opts::parse(); let verbose = opts.verbose; - let log_format = opts.log_format.as_deref(); + let mut log_format = opts.log_format.as_deref(); + let mut host_log_format = opts.host_log_format.as_deref(); + + const DEFAULT_LOG_FORMAT: &str = "{t} {L} {s}\n└─ {m} @ {F}:{l}"; + const DEFAULT_HOST_LOG_FORMAT: &str = "(HOST) {L} {s}"; + const DEFAULT_VERBOSE_HOST_LOG_FORMAT: &str = "(HOST) {L} {s}\n└─ {m} @ {F}:{l}"; + + if log_format.is_none() { + log_format = Some(DEFAULT_LOG_FORMAT); + } + + if host_log_format.is_none() { + if verbose == 0 { + host_log_format = Some(DEFAULT_HOST_LOG_FORMAT); + } else { + host_log_format = Some(DEFAULT_VERBOSE_HOST_LOG_FORMAT); + } + } - defmt_decoder::log::init_logger(log_format, opts.json, move |metadata| { + defmt_decoder::log::init_logger(log_format, host_log_format, opts.json, move |metadata| { if defmt_decoder::log::is_defmt_frame(metadata) { true // We want to display *all* defmt frames. } else { From 412336541b08f0c6aa783a6e8237cff720c02b2f Mon Sep 17 00:00:00 2001 From: "Andres O. Vela" Date: Wed, 26 Jul 2023 00:14:16 +0200 Subject: [PATCH 04/17] Add warning in case logger format includes timestamp but no timestamp implementation was found --- src/cli.rs | 34 +++++++++++++++++++--------------- src/main.rs | 17 +++++++++++++++-- 2 files changed, 34 insertions(+), 17 deletions(-) diff --git a/src/cli.rs b/src/cli.rs index 5021db3..9642217 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -133,21 +133,25 @@ pub fn handle_arguments() -> anyhow::Result { } } - defmt_decoder::log::init_logger(log_format, host_log_format, opts.json, move |metadata| { - if defmt_decoder::log::is_defmt_frame(metadata) { - true // We want to display *all* defmt frames. - } else { - // Log depending on how often the `--verbose` (`-v`) cli-param is supplied: - // * 0: log everything from probe-run, with level "info" or higher - // * 1: log everything from probe-run - // * 2 or more: log everything - match verbose { - 0 => metadata.target().starts_with("probe_run") && metadata.level() <= Level::Info, - 1 => metadata.target().starts_with("probe_run"), - _ => true, + let logger_info = + defmt_decoder::log::init_logger(log_format, host_log_format, opts.json, move |metadata| { + if defmt_decoder::log::is_defmt_frame(metadata) { + true // We want to display *all* defmt frames. + } else { + // Log depending on how often the `--verbose` (`-v`) cli-param is supplied: + // * 0: log everything from probe-run, with level "info" or higher + // * 1: log everything from probe-run + // * 2 or more: log everything + match verbose { + 0 => { + metadata.target().starts_with("probe_run") + && metadata.level() <= Level::Info + } + 1 => metadata.target().starts_with("probe_run"), + _ => true, + } } - } - }); + }); if opts.measure_stack { log::warn!("use of deprecated option `--measure-stack`: Has no effect and will vanish on next breaking release") @@ -163,7 +167,7 @@ pub fn handle_arguments() -> anyhow::Result { print_chips(); Ok(EXIT_SUCCESS) } else if let (Some(elf), Some(chip)) = (opts.elf.as_deref(), opts.chip.as_deref()) { - crate::run_target_program(elf, chip, &opts) + crate::run_target_program(elf, chip, &opts, logger_info) } else { unreachable!("due to `StructOpt` constraints") } diff --git a/src/main.rs b/src/main.rs index f7f81e6..3ab96bd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -23,7 +23,7 @@ use std::{ use anyhow::{anyhow, bail}; use colored::Colorize as _; -use defmt_decoder::{DecodeError, Frame, Locations, StreamDecoder}; +use defmt_decoder::{log::DefmtLoggerInfo, DecodeError, Frame, Locations, StreamDecoder}; use probe_rs::{ config::MemoryRegion, flashing::{self, Format}, @@ -50,7 +50,12 @@ fn main() -> anyhow::Result<()> { cli::handle_arguments().map(|code| process::exit(code)) } -fn run_target_program(elf_path: &Path, chip_name: &str, opts: &cli::Opts) -> anyhow::Result { +fn run_target_program( + elf_path: &Path, + chip_name: &str, + opts: &cli::Opts, + logger_info: DefmtLoggerInfo, +) -> anyhow::Result { // connect to probe and flash firmware let probe_target = lookup_probe_target(elf_path, chip_name, opts)?; let mut sess = attach_to_probe(probe_target.clone(), opts)?; @@ -70,6 +75,14 @@ fn run_target_program(elf_path: &Path, chip_name: &str, opts: &cli::Opts) -> any let elf = &Elf::parse(&elf_bytes, elf_path, reset_fn_address)?; let target_info = TargetInfo::new(elf, memory_map, probe_target, stack_start)?; + if let Some(table) = &elf.defmt_table { + if logger_info.has_timestamp() && !table.has_timestamp() { + log::warn!( + "logger format contains timestamp but no timestamp implementation was provided" + ); + } + } + // install stack canary let canary = Canary::install(core, elf, &target_info)?; if canary.is_none() { From 08918cb8b140f10a6221170abcc716fc1a2986a2 Mon Sep 17 00:00:00 2001 From: "Andres O. Vela" Date: Wed, 26 Jul 2023 11:52:03 +0200 Subject: [PATCH 05/17] Add suggestion for missing timestamp implementation --- src/main.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main.rs b/src/main.rs index 3ab96bd..fa2c98e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -80,6 +80,7 @@ fn run_target_program( log::warn!( "logger format contains timestamp but no timestamp implementation was provided" ); + log::warn!("consider removing the timestamp from the logger format `{{t}}` or provide a `defmt::timestamp!` implementation"); } } From e30b74cfab19809c5b4bdaf1545520aa45868f6b Mon Sep 17 00:00:00 2001 From: Urhengulas Date: Wed, 15 Mar 2023 12:30:11 +0100 Subject: [PATCH 06/17] Simplify snapshot test code --- tests/snapshot.rs | 61 ++++++++++++++++++----------------------------- 1 file changed, 23 insertions(+), 38 deletions(-) diff --git a/tests/snapshot.rs b/tests/snapshot.rs index 5891565..3b8fa06 100644 --- a/tests/snapshot.rs +++ b/tests/snapshot.rs @@ -1,6 +1,8 @@ use std::{ io::Read, - process::{Command, ExitStatus}, + process::{Child, Command, ExitStatus}, + thread, + time::Duration, }; use os_pipe::pipe; @@ -12,11 +14,16 @@ struct RunResult { output: String, } -/// run probe-run with `args` and truncate the "Finished .. in .." and "Running `...`" flashing output -/// NOTE: this currently only capures `stdin`, so any `log::` ed output, like flashing -fn run(args: &str) -> RunResult { +/// Run `probe-run` with `args` and truncate the output. +/// +/// If `terminate` is `true`, the command gets terminated after a short timeout. +fn run(args: &str, terminate: bool) -> RunResult { let (mut reader, mut handle) = run_command(args); + if terminate { + wait_and_terminate(&handle); + } + // retrieve output and clean up let mut probe_run_output = String::new(); reader.read_to_string(&mut probe_run_output).unwrap(); @@ -31,13 +38,9 @@ fn run(args: &str) -> RunResult { } } -#[cfg(target_family = "unix")] -// runs command with `args` and terminates after `timeout_s` seconds. -fn run_and_terminate(args: &str, timeout_s: u64) -> RunResult { - let (mut reader, mut handle) = run_command(args); - +fn wait_and_terminate(handle: &Child) { // sleep a bit so that child can process the input - std::thread::sleep(std::time::Duration::from_secs(timeout_s)); + thread::sleep(Duration::from_secs(5)); // send SIGINT to the child nix::sys::signal::kill( @@ -45,34 +48,18 @@ fn run_and_terminate(args: &str, timeout_s: u64) -> RunResult { nix::sys::signal::Signal::SIGINT, ) .expect("cannot send ctrl-c"); - - // retrieve output and clean up - let mut probe_run_output = String::new(); - reader.read_to_string(&mut probe_run_output).unwrap(); - let exit_status = handle.wait().unwrap(); - - let output = truncate_output(probe_run_output); - - RunResult { - exit_status, - output, - } } -fn run_command(args: &str) -> (os_pipe::PipeReader, std::process::Child) { - // add prefix to run this repository's version of `probe-run` and - // remove user-dependent registry and rustc information from backtrace paths +fn run_command(args: &str) -> (os_pipe::PipeReader, Child) { let cmd = format!("run -- --chip nRF52840_xxAA tests/test_elfs/{args} --shorten-paths"); + // capture stderr and stdout while preserving line order let (reader, writer) = pipe().unwrap(); - let writer_clone = writer.try_clone().unwrap(); let handle = Command::new("cargo") .args(cmd.split(' ')) - // capture stderr and stdout while preserving line order - .stdout(writer) - .stderr(writer_clone) - // run `probe-run` + .stdout(writer.try_clone().unwrap()) + .stderr(writer) .spawn() .unwrap(); (reader, handle) @@ -84,12 +71,10 @@ fn truncate_output(probe_run_output: String) -> String { .lines() .filter(|line| { !line.starts_with(" Finished") - && !line.starts_with(" Running `") - && !line.starts_with(" Blocking waiting for file lock ") - && !line.starts_with(" Compiling probe-run v") - // TODO don't drop the `└─ probe_run @ ...` locations after - // https://github.com/knurling-rs/probe-run/issues/217 is resolved - && !line.starts_with("└─ ") + && !line.starts_with(" Running `") + && !line.starts_with(" Blocking waiting for file lock ") + && !line.starts_with(" Compiling probe-run v") + && !line.starts_with("└─ ") // remove after https://github.com/knurling-rs/probe-run/issues/217 is resolved }) .map(|line| format!("{line}\n")) .collect() @@ -109,7 +94,7 @@ fn truncate_output(probe_run_output: String) -> String { #[serial] #[ignore = "requires the target hardware to be present"] fn snapshot_test(#[case] args: &str, #[case] success: bool) { - let run_result = run(args); + let run_result = run(args, false); assert_eq!(success, run_result.exit_status.success()); insta::assert_snapshot!(run_result.output); } @@ -119,7 +104,7 @@ fn snapshot_test(#[case] args: &str, #[case] success: bool) { #[ignore = "requires the target hardware to be present"] #[cfg(target_family = "unix")] fn ctrl_c_by_user_is_reported_as_such() { - let run_result = run_and_terminate("silent-loop-rzcobs", 5); + let run_result = run("silent-loop-rzcobs", true); assert!(!run_result.exit_status.success()); insta::assert_snapshot!(run_result.output); } From 69f7c5a2b562cd205a269c5ec165a4ee3e07bcf6 Mon Sep 17 00:00:00 2001 From: Johann Hemmann Date: Wed, 26 Jul 2023 14:58:57 +0200 Subject: [PATCH 07/17] `tests::snapshot`: Pass args as slice --- tests/snapshot.rs | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/tests/snapshot.rs b/tests/snapshot.rs index 3b8fa06..b2e837d 100644 --- a/tests/snapshot.rs +++ b/tests/snapshot.rs @@ -17,7 +17,7 @@ struct RunResult { /// Run `probe-run` with `args` and truncate the output. /// /// If `terminate` is `true`, the command gets terminated after a short timeout. -fn run(args: &str, terminate: bool) -> RunResult { +fn run(args: &[&str], terminate: bool) -> RunResult { let (mut reader, mut handle) = run_command(args); if terminate { @@ -50,14 +50,18 @@ fn wait_and_terminate(handle: &Child) { .expect("cannot send ctrl-c"); } -fn run_command(args: &str) -> (os_pipe::PipeReader, Child) { - let cmd = format!("run -- --chip nRF52840_xxAA tests/test_elfs/{args} --shorten-paths"); +fn run_command(args: &[&str]) -> (os_pipe::PipeReader, Child) { + let mut cmd = vec!["run", "--", "--chip", "nRF52840_xxAA", "--shorten-paths"]; + cmd.extend(&args[1..]); + + let path = format!("tests/test_elfs/{}", args[0]); + cmd.push(path.as_str()); // capture stderr and stdout while preserving line order let (reader, writer) = pipe().unwrap(); let handle = Command::new("cargo") - .args(cmd.split(' ')) + .args(cmd) .stdout(writer.try_clone().unwrap()) .stderr(writer) .spawn() @@ -94,7 +98,13 @@ fn truncate_output(probe_run_output: String) -> String { #[serial] #[ignore = "requires the target hardware to be present"] fn snapshot_test(#[case] args: &str, #[case] success: bool) { - let run_result = run(args, false); + // Arrange + let args = args.split(' ').collect::>(); + + // Act + let run_result = run(args.as_slice(), false); + + // Assert assert_eq!(success, run_result.exit_status.success()); insta::assert_snapshot!(run_result.output); } @@ -104,7 +114,13 @@ fn snapshot_test(#[case] args: &str, #[case] success: bool) { #[ignore = "requires the target hardware to be present"] #[cfg(target_family = "unix")] fn ctrl_c_by_user_is_reported_as_such() { - let run_result = run("silent-loop-rzcobs", true); + // Arrange + let args = &["silent-loop-rzcobs"]; + + // Act + let run_result = run(args, true); + + // Assert assert!(!run_result.exit_status.success()); insta::assert_snapshot!(run_result.output); } From f516c9ea725215f96e6b6cf71a3a19873411b25a Mon Sep 17 00:00:00 2001 From: Johann Hemmann Date: Wed, 26 Jul 2023 15:10:44 +0200 Subject: [PATCH 08/17] Fix timestamp warning --- src/main.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index fa2c98e..fbf0bf8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -78,9 +78,10 @@ fn run_target_program( if let Some(table) = &elf.defmt_table { if logger_info.has_timestamp() && !table.has_timestamp() { log::warn!( - "logger format contains timestamp but no timestamp implementation was provided" + "logger format contains timestamp but no timestamp implementation \ + was provided; consider removing the timestamp `{{t}}` from the \ + logger format or provide a `defmt::timestamp!` implementation" ); - log::warn!("consider removing the timestamp from the logger format `{{t}}` or provide a `defmt::timestamp!` implementation"); } } From 1814c15889a814848abe603fc11ff01b6d4913fa Mon Sep 17 00:00:00 2001 From: Johann Hemmann Date: Wed, 26 Jul 2023 15:33:35 +0200 Subject: [PATCH 09/17] Add snapshot tests --- tests/snapshot.rs | 18 ++++ ...ase_1_successful_run_has_no_backtrace.snap | 3 +- .../snapshot__case_1_without_time.snap | 19 ++++ .../snapshot__case_2_raw_encoding.snap | 3 +- .../snapshots/snapshot__case_2_with_time.snap | 19 ++++ ..._successful_run_can_enforce_backtrace.snap | 3 +- ...napshot__case_3_with_time_but_no_impl.snap | 20 ++++ ..._4_stack_overflow_is_reported_as_such.snap | 3 +- ...ot__case_4_without_time_but_with_impl.snap | 19 ++++ .../snapshot__case_5_host_without_time.snap | 20 ++++ ...hot__case_5_panic_is_reported_as_such.snap | 5 +- .../snapshot__case_6_host_with_timestamp.snap | 19 ++++ .../snapshot__case_6_panic_verbose.snap | 17 ++-- .../snapshot__case_6_panic_verbose.snap.new | 92 ++++++++++++++++++ ...successful_run_can_suppress_backtrace.snap | 5 +- ...stack_overflow_can_suppress_backtrace.snap | 3 +- tests/snapshots/snapshot__case_9_canary.snap | 3 +- ...t__ctrl_c_by_user_is_reported_as_such.snap | 3 +- tests/test_elfs/levels-rzcobs | Bin 0 -> 1307116 bytes tests/test_elfs/levels-with-timestamp | Bin 0 -> 1309704 bytes 20 files changed, 255 insertions(+), 19 deletions(-) create mode 100644 tests/snapshots/snapshot__case_1_without_time.snap create mode 100644 tests/snapshots/snapshot__case_2_with_time.snap create mode 100644 tests/snapshots/snapshot__case_3_with_time_but_no_impl.snap create mode 100644 tests/snapshots/snapshot__case_4_without_time_but_with_impl.snap create mode 100644 tests/snapshots/snapshot__case_5_host_without_time.snap create mode 100644 tests/snapshots/snapshot__case_6_host_with_timestamp.snap create mode 100644 tests/snapshots/snapshot__case_6_panic_verbose.snap.new create mode 100755 tests/test_elfs/levels-rzcobs create mode 100755 tests/test_elfs/levels-with-timestamp diff --git a/tests/snapshot.rs b/tests/snapshot.rs index b2e837d..1f579c8 100644 --- a/tests/snapshot.rs +++ b/tests/snapshot.rs @@ -124,3 +124,21 @@ fn ctrl_c_by_user_is_reported_as_such() { assert!(!run_result.exit_status.success()); insta::assert_snapshot!(run_result.output); } + +#[rstest] +#[case::without_time(&["levels-rzcobs", "--log-format", "[{L}] Location<{f}:{l}> {s}"])] +#[case::with_time(&["levels-with-timestamp", "--log-format", "{t} [{L}] Location<{f}:{l}> {s}"])] +#[case::with_time_but_no_impl(&["levels-rzcobs", "--log-format", "{t} [{L}] Location<{f}:{l}> {s}"])] +#[case::without_time_but_with_impl(&["levels-with-timestamp", "--log-format", "[{L}] Location<{f}:{l}> {s}"])] +#[case::host_without_time(&["levels-rzcobs", "--host-log-format", "[{L}] Location<{f}:{l}> {s}"])] +#[case::host_with_timestamp(&["levels-with-timestamp", "--host-log-format", "{t} [{L}] Location<{f}:{l}> {s}"])] +#[serial] +#[ignore = "requires the target hardware to be present"] +fn log_format(#[case] args: &[&str]) { + // Act + let run_result = run(args, false); + + // Assert + assert_eq!(true, run_result.exit_status.success()); + insta::assert_snapshot!(run_result.output); +} diff --git a/tests/snapshots/snapshot__case_1_successful_run_has_no_backtrace.snap b/tests/snapshots/snapshot__case_1_successful_run_has_no_backtrace.snap index f98a1e1..ceb7d26 100644 --- a/tests/snapshots/snapshot__case_1_successful_run_has_no_backtrace.snap +++ b/tests/snapshots/snapshot__case_1_successful_run_has_no_backtrace.snap @@ -1,11 +1,12 @@ --- source: tests/snapshot.rs -assertion_line: 114 +assertion_line: 109 expression: run_result.output --- (HOST) INFO flashing program (2 pages / 8.00 KiB) (HOST) INFO success! +(HOST) WARN logger format contains timestamp but no timestamp implementation was provided; consider removing the timestamp `{t}` from the logger format or provide a `defmt::timestamp!` implementation ──────────────────────────────────────────────────────────────────────────────── Hello, world! ──────────────────────────────────────────────────────────────────────────────── diff --git a/tests/snapshots/snapshot__case_1_without_time.snap b/tests/snapshots/snapshot__case_1_without_time.snap new file mode 100644 index 0000000..5275400 --- /dev/null +++ b/tests/snapshots/snapshot__case_1_without_time.snap @@ -0,0 +1,19 @@ +--- +source: tests/snapshot.rs +assertion_line: 143 +expression: run_result.output + +--- +(HOST) INFO flashing program (2 pages / 8.00 KiB) +(HOST) INFO success! +──────────────────────────────────────────────────────────────────────────────── +[INFO ] Location info +[TRACE] Location trace +[WARN ] Location warn +[DEBUG] Location debug +[ERROR] Location error +println +──────────────────────────────────────────────────────────────────────────────── +(HOST) INFO program has used at least 0.23/254.93 KiB (0.1%) of stack space +(HOST) INFO device halted without error + diff --git a/tests/snapshots/snapshot__case_2_raw_encoding.snap b/tests/snapshots/snapshot__case_2_raw_encoding.snap index d636519..a12330c 100644 --- a/tests/snapshots/snapshot__case_2_raw_encoding.snap +++ b/tests/snapshots/snapshot__case_2_raw_encoding.snap @@ -1,11 +1,12 @@ --- source: tests/snapshot.rs -assertion_line: 114 +assertion_line: 109 expression: run_result.output --- (HOST) INFO flashing program (2 pages / 8.00 KiB) (HOST) INFO success! +(HOST) WARN logger format contains timestamp but no timestamp implementation was provided; consider removing the timestamp `{t}` from the logger format or provide a `defmt::timestamp!` implementation ──────────────────────────────────────────────────────────────────────────────── Hello, world! ──────────────────────────────────────────────────────────────────────────────── diff --git a/tests/snapshots/snapshot__case_2_with_time.snap b/tests/snapshots/snapshot__case_2_with_time.snap new file mode 100644 index 0000000..2dc1f58 --- /dev/null +++ b/tests/snapshots/snapshot__case_2_with_time.snap @@ -0,0 +1,19 @@ +--- +source: tests/snapshot.rs +assertion_line: 139 +expression: run_result.output + +--- +(HOST) INFO flashing program (2 pages / 8.00 KiB) +(HOST) INFO success! +──────────────────────────────────────────────────────────────────────────────── +0 [INFO ] Location info +1 [TRACE] Location trace +2 [WARN ] Location warn +3 [DEBUG] Location debug +4 [ERROR] Location error +println +──────────────────────────────────────────────────────────────────────────────── +(HOST) INFO program has used at least 0.23/254.93 KiB (0.1%) of stack space +(HOST) INFO device halted without error + diff --git a/tests/snapshots/snapshot__case_3_successful_run_can_enforce_backtrace.snap b/tests/snapshots/snapshot__case_3_successful_run_can_enforce_backtrace.snap index e7a492e..dd05f13 100644 --- a/tests/snapshots/snapshot__case_3_successful_run_can_enforce_backtrace.snap +++ b/tests/snapshots/snapshot__case_3_successful_run_can_enforce_backtrace.snap @@ -1,11 +1,12 @@ --- source: tests/snapshot.rs -assertion_line: 114 +assertion_line: 109 expression: run_result.output --- (HOST) INFO flashing program (2 pages / 8.00 KiB) (HOST) INFO success! +(HOST) WARN logger format contains timestamp but no timestamp implementation was provided; consider removing the timestamp `{t}` from the logger format or provide a `defmt::timestamp!` implementation ──────────────────────────────────────────────────────────────────────────────── Hello, world! ──────────────────────────────────────────────────────────────────────────────── diff --git a/tests/snapshots/snapshot__case_3_with_time_but_no_impl.snap b/tests/snapshots/snapshot__case_3_with_time_but_no_impl.snap new file mode 100644 index 0000000..605cf99 --- /dev/null +++ b/tests/snapshots/snapshot__case_3_with_time_but_no_impl.snap @@ -0,0 +1,20 @@ +--- +source: tests/snapshot.rs +assertion_line: 143 +expression: run_result.output + +--- +(HOST) INFO flashing program (2 pages / 8.00 KiB) +(HOST) INFO success! +(HOST) WARN logger format contains timestamp but no timestamp implementation was provided; consider removing the timestamp `{t}` from the logger format or provide a `defmt::timestamp!` implementation +──────────────────────────────────────────────────────────────────────────────── +