-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a basic shell to ZMK and use it for testing #2014
base: main
Are you sure you want to change the base?
Conversation
* Allow tap/press/release of a given key position within the Zephyr shell.
* By default, don't generate any events for the native posix board DTS, to allow native builds outside of the testing use case.
We should probably move this into .conf files, or wait for Zephyr 3.4 and its EXTRA_DTC_OVERLAY_FILE.
- require bash and use subroutines - write intermediate output to stderr instead of stdout - strip ANSI escape sequences from the logs - add option to run tests via ZMK shell commands
This works as-is but I'm not happy with the way configuration is handled currently. Initially I wanted to use Also, as a side-effect of the bug mentioned here, I don't believe it's possible to handle command sequences longer than Obviously low priority, but this should speed up writing and running tests quite a bit. |
# This convoluted invocation is needed to work around some quirks in | ||
# Zephyr's serial shell driver: | ||
# | ||
# - When stdin is closed while CONFIG_NATIVE_UART_0_ON_STDINOUT is enabled, | ||
# reading from the UART driver returns the same byte over and over | ||
# (instead of blocking). | ||
# - The shell driver reads from the UART driver greedily until it blocks | ||
# (instead of stopping on newlines or when the ring buffer is full). | ||
# | ||
# This means that piping directly to the Zephyr executable causes it to | ||
# enter an infinite loop. To work around this, we sleep inside a process | ||
# substitution to keep the pipe open until the Zephyr executable exits. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fixed in zephyrproject-rtos/zephyr#51244, so upgrading Zephyr means we can replace this with a pipe and remove the sleep
.
Includes #1318.
Running tests using the shell allows testing multiple input sequences for a single configuration without rebuilding the configuration each time. As an example, I've converted the
toggle-layer
test to use ZMK shell commands.