Skip to content
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

Portion of zephyr/tests/lib tests #8

Open
wants to merge 42 commits into
base: ztest
Choose a base branch
from

Conversation

tristan-google
Copy link

Up to lib/cmsis_dsp/fastmath

yperess and others added 30 commits November 11, 2021 13:15
1. Test suites in prior ztest serve no purpose other than logical
ordering of tests into a named-group. Move the construct of setup and
teardown into the test suite and away from individual tests.
Additionally, add the constructs of before/after to the test suites.
This model more closely resembels other testing frameworks such as gTest
and Junit.
2. Test can be added to a suite by using ZTEST() or ZTEST_F() where _F
stands for fixture. In the case where _F is used, the argument `this`
will be provided with the type `struct suite_name##_fixture*`. Again,
this models other modern testing frameworks and allows the test to
directly access the already set up data related to the test suite.
3. Add the concept of test rules (from Junit). Rules are similar to the
before/after functions of the test suites but are global and run on all
suites. An example of a test rule can be to check that nothing was
logged to ERROR. The rule can cause the test to fail if anything was
logged to ERROR during an integration test. Another example would be a
rule that verifies that tests ran within some defined timeout.

Signed-off-by: Yuval Peress <[email protected]>
Note, the test_main function is no longer needed since the default
already runs all tests.

Signed-off-by: Yuval Peress <[email protected]>
Note this change removes the test_main function since the default
already runs all the tests suites with no state.

Signed-off-by: Yuval Peress <[email protected]>
Note this change keeps the test_main function since some threading
configurations need to run. These could also be done in the setup
function for the suite.

Signed-off-by: Yuval Peress <[email protected]>
Split the test suite into 2:
1. Default with no changes
2. Adds before/after function to account for 1cpu tests

Signed-off-by: Yuval Peress <[email protected]>
Note the main test_main function was kept to allow thread config,
though this can also be done in the suite's setup.

Signed-off-by: Yuval Peress <[email protected]>
Note this keeps the test_main function for thread access setup,
though that could also be done in the suite's setup.

Signed-off-by: Yuval Peress <[email protected]>
Convert the tests to use various ZTEST unit test declarations based
on the Kconfig CONFIG_USERSPACE. Some tests run in both modes, others
only in one.

Signed-off-by: Yuval Peress <[email protected]>
Remove test_main in favor of new default one.

Signed-off-by: Yuval Peress <[email protected]>
Allow self registering functions which gets rid of the need to
include all the functions as externs and have alternate
implementations.

Signed-off-by: Yuval Peress <[email protected]>
Update to self registering test functions which gets rid of extern
inclusion and the need to have different implementations.

Signed-off-by: Yuval Peress <[email protected]>
Use the 1CPU test rule and migrate to new APIs for attaching the tests
to the suite.

Signed-off-by: Yuval Peress <[email protected]>
Create new test suites for 1cpu and normal tests and make use of
the setup function hook for the suite.

Signed-off-by: Yuval Peress <[email protected]>
Migrate tests to new api and fix mismatching function signature for
test_fifo_get_fail.

Signed-off-by: Yuval Peress <[email protected]>
Update arm_hardfault_validation to new ztest API.

Signed-off-by: Aaron Massey <[email protected]>
Change-Id: If6a7d7c0d6e0e65a8f1a1ba434521b33b6874517
Update arm_interrupt tests to new ztest API.

Signed-off-by: Aaron Massey <[email protected]>
Change-Id: I3570c902f67068505a0031b7890a2b03c36e14d4
Update tests to new ztest API

Signed-off-by: Aaron Massey <[email protected]>
Change-Id: If51829e0ddb5dfe41061c6ade7dcde875275a214
Update test suite to new ZTEST api.

Signed-off-by: Aaron Massey <[email protected]>
Change-Id: I15f67e4592e7d1594530adcc9b3528b3778bfab0
Update test to new ZTEST API.

Signed-off-by: Aaron Massey <[email protected]>
Change-Id: Icb5326bfc7c2e47a0c4e458f7d98273680a14156
Refactor tests to new ZTEST api.
Signed-off-by: Aaron Massey <[email protected]>
Change-Id: I18451cbcb1d08777b6a0658e9c79e0fcf5238561
Refactor tests to use new ZTEST apis.

Signed-off-by: Aaron Massey <[email protected]>
Change-Id: If388fddc2d75b24ef58eb85f0925648e40bd5667
Refactor to use new ZTEST apis.

Signed-off-by: Aaron Massey <[email protected]>
Change-Id: Ibc37d835ed7496da8e355052c0982aa1ff2c8480
Refactor tests to use new ZTEST apis.

Signed-off-by: Aaron Massey <[email protected]>
Change-Id: Iae09c675d7ed6de201d0e85fc6a061bbe4c129e1
Refactor tests to use the new ZTEST api, removing now unnecessary #else.

Signed-off-by: Aaron Massey <[email protected]>
Change-Id: I828874335556041b3f27e1c89be561c3c71def01
Refactor tests to use new ZTEST APIs.

Signed-off-by: Aaron Massey <[email protected]>
Change-Id: I2d9343e219cd37ba3a2f4bff3676f9b9a2100e86
Updates tests to use the new ZTEST APIs

Signed-off-by: Aaron Massey <[email protected]>
Change-Id: Ic85339dabbb508ce2e62e6eed60e24f2925271f6
Refactor tests to use new ZTEST APIs.

Signed-off-by: Aaron Massey <[email protected]>
Change-Id: I4b614ba1add3bc374f7a2f00f14be69717df70b5
Update tests to use new ZTEST APIs.

Signed-off-by: Aaron Massey <[email protected]>
Change-Id: Ib50f6e165986fe77a9d2cc4c6caed926c4936471
Update tests to use the new ZTEST APIs.

Signed-off-by: Aaron Massey <[email protected]>
Change-Id: I05f666e6a77d2b886773138666f01fc507a15038
Update tests to use the new ZTEST API.

Signed-off-by: Aaron Massey <[email protected]>
Change-Id: Idbfdf87c91628b9381eccf6e0ff689db9fc177e2
@yperess yperess force-pushed the ztest branch 9 times, most recently from afc1a81 to 2cd4645 Compare December 9, 2021 06:18
@yperess yperess force-pushed the ztest branch 3 times, most recently from 5a65977 to 450038e Compare December 23, 2021 06:03
@yperess yperess force-pushed the ztest branch 3 times, most recently from 9efd30e to ce893e5 Compare December 31, 2021 05:16
@yperess yperess force-pushed the ztest branch 4 times, most recently from f34f425 to 236fe51 Compare January 25, 2022 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants