-
-
Notifications
You must be signed in to change notification settings - Fork 681
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
Unit test extension for prodtest CLI #4656
Open
kopecdav
wants to merge
4
commits into
main
Choose a base branch
from
kopecdav/prodtest/unit_tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+292
−0
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
cff37a5
to
74a4f5a
Compare
cepetr
requested changes
Feb 24, 2025
cepetr
requested changes
Feb 26, 2025
… library [no changelog]
3722dc1
to
edfda81
Compare
cepetr
requested changes
Mar 6, 2025
@@ -23,6 +23,7 @@ | |||
#include <io/display.h> | |||
#include <io/usb.h> | |||
#include <rtl/cli.h> | |||
#include <rtl/unit_test.h> |
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 looks like this #include
in unnecessary now and can be deleted.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduce an extension to prodtest CLI which allows to register unit tests.
Idea is, that every driver or firmware component may have a several low level unit tests exercising fundamental features, This should be giving user (or maybe in future to automated tester) the quick overview of the FW and HW integrity.
Unit tests ~ compared to prodtest commands ~ are not callable commands from prodtest CLI, but the prodtest CLI introduce new command
unit-test-run
, which run all registered unit tests and return trace of results followed with "OK" if all tests passed.Example:
Unit test design
unit test of specific driver or FW component should be part of dedicated cmd/prodtest_x.c source file. Every unit test is a function with no arguments which returns ut_status_t (UT_PASSED or UT_FAILED).
Unit tests should be designed by the driver/component owner and it should pay attention to be:
unit tests could cover either FW integrity of specific driver/lib ~ such as init/deinit test, test if not allowed arguments are correctly recognized, etc. or HW integrity by testing communication peripherals of subordinate devices and other physical connections.
minimally, every driver should have an init/deinit test.
Example:
unit test registration
to register the unit test we use REGISTER_UNIT_TEST macro (similar to PRODTEST_CLI_CMD, but args are omitted). Same as the CLI commands, unit tests are placed in the dedicated part of memory defined in linker.