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

Bluetooth tests #6

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

Conversation

tristan-google
Copy link

Update all tests under tests/bluetooth using ZTest

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 <peress@google.com>
Note, the test_main function is no longer needed since the default
already runs all tests.

Signed-off-by: Yuval Peress <peress@google.com>
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 <peress@google.com>
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 <peress@google.com>
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 <peress@google.com>
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 <peress@google.com>
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 <peress@google.com>
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 <peress@google.com>
Remove test_main in favor of new default one.

Signed-off-by: Yuval Peress <peress@google.com>
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 <peress@google.com>
Update to self registering test functions which gets rid of extern
inclusion and the need to have different implementations.

Signed-off-by: Yuval Peress <peress@google.com>
Use the 1CPU test rule and migrate to new APIs for attaching the tests
to the suite.

Signed-off-by: Yuval Peress <peress@google.com>
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 <peress@google.com>
Migrate tests to new api and fix mismatching function signature for
test_fifo_get_fail.

Signed-off-by: Yuval Peress <peress@google.com>
Update arm_hardfault_validation to new ztest API.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
Change-Id: If6a7d7c0d6e0e65a8f1a1ba434521b33b6874517
Update arm_interrupt tests to new ztest API.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
Change-Id: I3570c902f67068505a0031b7890a2b03c36e14d4
Update tests to new ztest API

Signed-off-by: Aaron Massey <aaronmassey@google.com>
Change-Id: If51829e0ddb5dfe41061c6ade7dcde875275a214
Update test suite to new ZTEST api.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
Change-Id: I15f67e4592e7d1594530adcc9b3528b3778bfab0
Update test to new ZTEST API.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
Change-Id: Icb5326bfc7c2e47a0c4e458f7d98273680a14156
Refactor tests to new ZTEST api.
Signed-off-by: Aaron Massey <aaronmassey@google.com>
Change-Id: I18451cbcb1d08777b6a0658e9c79e0fcf5238561
Refactor tests to use new ZTEST apis.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
Change-Id: If388fddc2d75b24ef58eb85f0925648e40bd5667
Refactor to use new ZTEST apis.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
Change-Id: Ibc37d835ed7496da8e355052c0982aa1ff2c8480
Refactor tests to use new ZTEST apis.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
Change-Id: Iae09c675d7ed6de201d0e85fc6a061bbe4c129e1
Refactor tests to use the new ZTEST api, removing now unnecessary #else.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
Change-Id: I828874335556041b3f27e1c89be561c3c71def01
Refactor tests to use new ZTEST APIs.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
Change-Id: I2d9343e219cd37ba3a2f4bff3676f9b9a2100e86
Updates tests to use the new ZTEST APIs

Signed-off-by: Aaron Massey <aaronmassey@google.com>
Change-Id: Ic85339dabbb508ce2e62e6eed60e24f2925271f6
Refactor tests to use new ZTEST APIs.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
Change-Id: I4b614ba1add3bc374f7a2f00f14be69717df70b5
Update tests to use new ZTEST APIs.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
Change-Id: Ib50f6e165986fe77a9d2cc4c6caed926c4936471
Update tests to use the new ZTEST APIs.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
Change-Id: I05f666e6a77d2b886773138666f01fc507a15038
Update tests to use the new ZTEST API.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
Change-Id: Idbfdf87c91628b9381eccf6e0ff689db9fc177e2
@@ -23,6 +23,7 @@
#include "lll/lll_adv_types.h"
#include "lll_adv.h"
#include "lll/lll_adv_pdu.h"
#include "lll/lll_df_types.h"
Copy link
Author

Choose a reason for hiding this comment

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

This is a modification I had to make to a non-UT source file in order to get it to build (it was missing a struct declaration otherwise)

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