Skip to content

Feature/xtask/e2e wifi ap mode check - #144

Open
jubeormk1 wants to merge 4 commits into
brainstorm:mainfrom
jubeormk1:feature/xtask/e2e-wifi-ap-mode-check
Open

jubeormk1 wants to merge 4 commits into
brainstorm:mainfrom
jubeormk1:feature/xtask/e2e-wifi-ap-mode-check

Conversation

@jubeormk1

Copy link
Copy Markdown
Collaborator

Starting e2e

This is the first contribution, open for discussion, to migrate and expand e2e testing to xtask. I believe that it requires more work, but I would like to discuss it an what is better than a Pull Request coffee to discuss code.

E2E tests scripting

We need a way to store and organise steps for E2E tests that are easy to visualise and can do abstract things. For that I decided that having a dedicated xtask e2e that admits scenarios can be a good fit.

This sketch is barebones reduced to prove how this could work:

$ cargo xtask e2e board=<target board> prg-serial=</dev/ttyANN> interface=<nmcli interface id> scenario=<path to scenario> verbose

All arguments long, because this is better readable on a CI script.

A scenario could be as simple as wifi_ap_mode.yml which includes an order set of actions, defined by the enum Action and evolve a context state.

Missing bits and pieces

  • Documentation: There is no way to know which steps are available and what do they do or require.
  • Extra actions: The current set of actions is small as it is a proof of concept
  • Extra context: this comes paired with the reduce amount of actions and should grow with them
  • Extra e2e Args variants to cover things such as a serial adapter path to emulate the target device the ssh-stamp will be receiving/sending information from.

@jubeormk1
jubeormk1 requested review from brainstorm and a lite review from Copilot September 21, 2026 21:19
@jubeormk1 jubeormk1 self-assigned this Sep 21, 2026
@jubeormk1
jubeormk1 requested a review from mmalenic September 21, 2026 21:20
@jubeormk1
jubeormk1 marked this pull request as draft September 21, 2026 21:21
@jubeormk1
jubeormk1 removed the request for review from Copilot September 21, 2026 21:21

@brainstorm brainstorm left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jubeormk1!

I have no objections on the general idea of having a "scenarios run recipe" and creating this end to end harness as a whole. That's what we desperately need in HIL testing right now.

As you see in my comments, it's only the parsing bits (and in a lesser degree the YAML format) where I see areas for improvement before merging. OTOH, I see the value of getting this to work now-now since we need better HIL.

What do you think? Should we refactor later or try to get the boot output in machine-readable JSON so that both humans and machines can read those settings and so your code parses better?

Comment thread xtask/e2e/wifi_ap_mode.yml Outdated

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we switch to .toml instead of yaml? SSH Stamp already uses .toml for board definitions (and .json in some other contexts), but I think that we can define this "actions" yaml easily in .toml instead?

Comment thread xtask/src/cmd/e2e.rs Outdated
.context("espflash reset failed")
}

fn parse_ssh_stamp_network_from_serial(serial: &Serial, context: &mut ContextState) -> Result<()> {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reckon that all this adhoc parsing can be better addressed if and when #123 is reviewed (and eventually merge?), please take a peek at it, but in a nutshell implements JSON output for the boot messages so that it's relatively easy for it to be machine-readable.

Comment thread xtask/src/cmd/e2e.rs Outdated
let parsed = parse_network_lines(&lines).unwrap();
assert_eq!(parsed.ssid, "test-ssid");
assert_eq!(parsed.psk, "test-password");
assert_eq!(parsed.ip, "192.168.4.1".parse::<Ipv4Addr>().unwrap());

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to talk about our hardcoded 192.168.4.1 :_/

jubeormk1 and others added 4 commits October 21, 2026 19:24
The intention is to explore how to define multi-step flows that might
require keeping a serial connection alive, parsing information and stablishing
ssh connections.

This PR is aimed at doing an integration test for the first set of actions.
Removing redundant action and refactoring the action match into smaller handlers for clarity.
Scenarios are now plain Rust functions selected with `--scenario`
(defaulting to `wifi-ap`), instead of a YAML list of actions, which drops
the serde_yaml dependency.

The SSID, PSK and AP address come from the `boot` and `net_up` JSON
objects the firmware prints since brainstorm#123, rather than scraping log lines, so
the AP address is no longer assumed. Objects from before the reset are
ignored, and an unknown JSON schema version fails the run.

Also align with the other commands: `--port` instead of `--prg-serial`,
and no separate join step since `wait_for_reachable` already joins. The
unrelated host.rs change is dropped.
@brainstorm
brainstorm force-pushed the feature/xtask/e2e-wifi-ap-mode-check branch from 7dd18bf to dd33c10 Compare October 21, 2026 18:01
@brainstorm
brainstorm marked this pull request as ready for review October 21, 2026 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants