-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
ztest: support runs suites and cases from shell #58374
Conversation
🤯 This is super cool, I'll review later today |
@@ -18,6 +18,13 @@ static struct k_thread ztest_thread; | |||
#endif | |||
static bool failed_expectation; | |||
|
|||
#ifdef CONFIG_SHELL |
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.
Instead of automatically enabling this when the shell is enabled, should we introduce a separate config (e.g. CONFIG_ZTEST_SHELL
) to control this feature so that we do not unnecessarily increase the footprint of the existing shell tests?
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.
right, this will be needed anyways, otherwise any test enabling the shell as we have it now, will end up being stuck waiting for input.
90e33b5
to
c16cd5c
Compare
Can we move this from draft? seems really useful |
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.
When I try ztest run-all
/ztest run - all
(not sure which one is correct) I get nothing. Calling ztest run
crashes the app:
uart:~$ ztest run
E: Page fault at address (nil) (error code 0x0)
E: Linear address not present in page tables
E: Access violation: supervisor thread not allowed to read
E: PTE: not present
E: EAX: 0x00000000, EBX: 0x0011d0e0, ECX: 0x00000001, EDX: 0x00000000
E: ESI: 0x0012d65c, EDI: 0x00000001, EBP: 0x0012d5e0, ESP: 0x0012d5e0
E: EFLAGS: 0x00000246 CS: 0x0008 CR3: 0x0016c000
E: call trace:
E: EIP: 0x0010f012
E: 0x0010ffbb (0x0)
E: 0x00109ea3 (0x11d5c8)
E: 0x0010a0d3 (0x12a318)
E: 0x0010968a (0x11d5c8)
E: 0x0010ac6d (0xaaaaaaaa)
E: 0x00106168 (0x11d5c8)
E: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
E: Current thread: 0x129c00 (shell_uart)
E: Halting system
FAILED: zephyr/CMakeFiles/run_qemu /home/maciej/zephyrproject/zephyr/build/zephyr/CMakeFiles/run_qemu
cd /home/maciej/zephyrproject/zephyr/build && /home/maciej/zephyr-sdk-0.16.1/sysroots/x86_64-pokysdk-linux/usr/bin/qemu-system-i386 -m 4 -cpu qemu32,+nx,+pae -machine q35 -device isa-debug-exit,iobase=0xf4,iosize=0x04 -no-reboot -nographic -no-acpi -net none -pidfile qemu.pid -chardev stdio,id=con,mux=on -serial chardev:con -mon chardev=con,mode=readline -kernel /home/maciej/zephyrproject/zephyr/build/zephyr/zephyr.elf
ninja: build stopped: subcommand failed
I find the syntax a bit confusing:
I still see some errors, but cannot say if they are related to this feature or tests themselves.
and then the emulation hangs at
|
those arew issues with the tests, they are not able to run multiple times. |
yes, aware of that. needs some work still. |
This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time. |
This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time. |
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.
All my comments were addressed. Thank you! I played with the feature on qemu_x86 and also on a real target (nrf52840dk) with minicom and everything worked as described.
yeah, there will be a few changes needed to adress some corner cases, but most major issues should be addressed now. |
Make it green and I'll approve 😄 |
yep, coming. The issues are all stack related given that some ztest features are runtime in the current implementation. |
This c file is not being used anymore, so remove it. Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Reduce verbosity and debug messages on the screen. Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Every time I see docs failing in the build I have a minor panic attack thinking it was me 😅 |
- Support for listing both testcases and testsuites - Support for running single suites or single test cases - Support shuffling tests and repeating execution based on command line arguments. For example, build with west build -p -b qemu_cortex_m3 tests/kernel/sleep -t run -- \ -DCONFIG_ZTEST_SHUFFLE=y -DCONFIG_ZTEST_SHELL=y Following commands are available: uart:~$ ztest ztest - Ztest commands Subcommands: run-all :Run all tests shuffle :Shuffle tests list-testsuites :List all test suites list-testcases :List all test cases run-testsuite :Run test suite run-testcase :Run testcase shuffle accepts two arguments --suite_iter and --case_iter which allows repeated exercution of testcases or suites. Signed-off-by: Anas Nashif <anas.nashif@intel.com>
"It's not you, it is me". |
@cfriedt passes CI now :) |
So tempting to merge... |
Add shell support to ztest to allow listing suites and cases and running
them interactively from the shell.
Note: something I had in a branch from last year, still needs some work, but essentially it works :)
west build -b qemu_x86 tests/kernel/common/ -t run -- -DCONFIG_ZTEST_SHELL=y
output
Signed-off-by: Anas Nashif anas.nashif@intel.com