Very experimental and for testing only#5201
Conversation
16ec989 to
4816b6f
Compare
2368b8e to
2cbecd3
Compare
|
/hil quick |
|
Triggered quick HIL run for #5201. Run: https://github.com/esp-rs/esp-hal/actions/runs/23534885428 Status update: ❌ HIL (quick) run failed (conclusion: failure). |
|
New commits in main has made this PR unmergable. Please resolve the conflicts. |
|
New commits in main has made this PR unmergable. Please resolve the conflicts. |
|
New commits in main has made this PR unmergable. Please resolve the conflicts. |
|
New commits in main has made this PR unmergable. Please resolve the conflicts. |
MabezDev
left a comment
There was a problem hiding this comment.
I don't think this is quite the direction I would go with.
I think its okay to have a radio-hil package. I think the testing mechanism will be sufficiently different that trying to shoe-horn it into our current hil suite will cause headaches.
As my other comment alludes to, we shouldn't be invoking binaries - let's use probe-rs directly.
|
/hil quick |
|
Triggered quick HIL run for #5201. Run: https://github.com/esp-rs/esp-hal/actions/runs/23892282626 Status update: ❌ HIL (quick) run failed (conclusion: failure). |
MabezDev
left a comment
There was a problem hiding this comment.
Not at the point of critiquing code, my review is still conceptual and architectural at this point.
| @@ -0,0 +1,222 @@ | |||
| #[embedded_test::tests(default_timeout = 45, executor = esp_rtos::embassy::Executor::new())] | |||
There was a problem hiding this comment.
The directory structure is a bit odd to me, I feel like mod esp_radio will have all the tests in it, so what's the point of the mod?
We should probably split these into catagories, wifi, ble etc.
| } | ||
|
|
||
| #[test] | ||
| async fn wifi_ap_test(p: Peripherals) { |
There was a problem hiding this comment.
Do we plan on adding more test configurations here? If we do, how will that work regarding test synchronization to the other board? I.e the other board might be running tests whilst this test finishes causing the other side to fail when there is no AP available?
If this will always be one test (which doesn't really test anything, note the lack of asserts here), then I think we should write these differently. The goal of testing is to isolate and test discrete variables, therefore we should only testing on one side at any given time. If we want to test the dhcp side with this AP, this AP should be a fixed function firmware.
General rule of thumb: If we're testing STA, AP should be a fixed. If we're testing AP, then the STA firmware should be fixed, or a set of fixed firmwares to try.
| } | ||
|
|
||
| /// Run a radio test on 2 devices (AP and STA) | ||
| pub fn run_radio_test( |
There was a problem hiding this comment.
Based on my other comments above, I think if we make changes so that we're only testing one variable at a time, we can use the current xtask tooling for running tests, with a few modifications.
When we run xtask test with a test name, in this case wifi_dhcp (imo should be wifi_sta), our test runner should be able to find the test, then we can add metadata at the top of the file to indicate what firmware needs to run on the other side.
//% HARNESS_FIRMWARE(wifi_ap)Something like this, so that the xtask knows how to setup the other device for this test series.
|
New commits in main has made this PR unmergable. Please resolve the conflicts. |
| pub fn load(path: &Path) -> Result<Vec<Metadata>> { | ||
| let mut examples = Vec::new(); | ||
|
|
||
| println!("Loading examples from {}", path.display()); |
There was a problem hiding this comment.
we probably should use log instead
| relevant_metadata.apply(|meta| meta.tag = Some(meta_line.value.to_string())); | ||
| } | ||
| // Optional support firmware binary that must run on another target. | ||
| "HARNESS_FIRMWARE" => { |
There was a problem hiding this comment.
maybe we don't want to mix usage of _ and -
|
|
||
| #[cfg(soc_has_wifi)] | ||
| #[path = "esp_radio/wifi_dhcp.rs"] | ||
| mod wifi_dhcp; |
There was a problem hiding this comment.
we can probably find a better name - also for the executable since esp_radio is very generic and we will need more (since different tests need a different support FW)
|
I wonder if we always want the support-fw and the test-fw to target the same chip - but I guess that assumption should be fine |
MabezDev
left a comment
There was a problem hiding this comment.
Overall, this is taking shape nicely, but needs some more thought on how we setup the tests and hand off the running, and then some more general polish.
| @@ -0,0 +1,557 @@ | |||
| #[embedded_test::tests(default_timeout = 45, executor = esp_rtos::embassy::Executor::new())] | |||
There was a problem hiding this comment.
I think the parent dir should be tests, not esp_radio.
| defmt::info!("[STA] TEST_DONE: PASS"); | ||
| } | ||
|
|
||
| // #[test] |
There was a problem hiding this comment.
Please don't leave wads of uncommented code in a PR. If it's something to add later, pull it out into a gist and re-add closer to merge.
| @@ -0,0 +1,198 @@ | |||
| //% CHIPS(has_wifi_ble): esp32c6 | |||
There was a problem hiding this comment.
This should go in a support dir, adjacent to the test dir.
| harness = false | ||
| required-features = ["esp-alloc"] | ||
|
|
||
| [dependencies] |
There was a problem hiding this comment.
I think many of these deps need to be bumped to match hil-test before we merge.
| pub timings: bool, | ||
|
|
||
| /// "hil-test" or "hil-test-radio" | ||
| pub package: Option<String>, |
There was a problem hiding this comment.
We should leverage claps default here, instead of the unwrap_or later.
| .apply(|meta| meta.harness_firmware = Some(meta_line.value.to_string())); | ||
| } | ||
| // Mark this artifact as support firmware (not a DUT test). | ||
| "SUPPORT_FIRMWARE" => { |
There was a problem hiding this comment.
Why two keys for the same thing?
|
|
||
| fn parse_bool(value: &str) -> Result<bool> { | ||
| match value.trim().to_ascii_lowercase().as_str() { | ||
| "true" | "1" | "yes" | "y" | "on" => Ok(true), |
There was a problem hiding this comment.
Let's just support true or false please.
| let no_batch = is_radio_package && matches!(action, CargoAction::Run); | ||
| let built_commands = commands.build(no_batch); | ||
|
|
||
| if is_radio_package && matches!(action, CargoAction::Run) { |
There was a problem hiding this comment.
This whole section here feels quite hacky tbh - I think we should rethink this part.
I would like it so that run_radio_test just takes the name of the test binary we want to run, then behind the scenes we compile and flash the support runner, then hand back to a normal test running flow.
These new test are not any different the other hil tests, the only difference is that we have a pre step to do, which is running fw on a support device first.
I want to use this PR as a playground for Radio HIL. It’s very rough and messy, but I mainly want to test the infrastructure here with the simplest possible POC.