-
Notifications
You must be signed in to change notification settings - Fork 7k
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
tests: Bluetooth: Add example bsim test #71053
Conversation
2e4f105
to
d8c6ff1
Compare
@jfischer-no Am I doing something wrong with the app Kconfig? It builds properly, and this is how most apps add custom options. |
Those 2 options are not defined in any Kconfig file |
edit: also like I said, they're used in two source files and the test compiles without issue. |
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.
Thanks @jori-nordic
A few requests
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.
Great job!
Given the nature of purpose of this, I've been extra pedantic in my review :)
LOG_DBG(""); | ||
|
||
err = bt_testlib_gatt_discover_primary(&svc_handle, &svc_end_handle, conn, svc, 1, 0xffff); | ||
if (err) { |
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.
Ditto with using boolean values for boolean expressions
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.
cmon, we have to ditch the whole of zephyr then. This is pretty much the idiomatic error handing in zephyr.
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.
Indeed. The coding guidelines do state this though, but it also states that we are not yet at a level where this should be enforced, so it's not a blocking comment, but the plan is actually to modify all if
statements in Zephyr to comply with that rule (at some point).
My personal opinion is that we might as well follow the to-be-followed rules now for new code
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.
it is a good opinion, I agree. I did make the change :).
Do we have a task-force for MISRA-ing the tree or is the plan to only enforce the rule on new PRs?
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.
Do we have a task-force for MISRA-ing the tree or is the plan to only enforce the rule on new PRs?
I think it's just been a low-effort thing from since like 2020 or something...
Damn I thought I had |
d8c6ff1
to
b74d08f
Compare
b74d08f
to
c276e64
Compare
I |
seems compliance script is more broken than I thought... |
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.
Mostly minors at this point
|
||
# Helpers that can be used on bsim targets but don't have other | ||
# dependencies (e.g. on Bluetooth, etc). | ||
add_library(babblekit) |
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.
nit: common test_lib was fine enough :), with this new name users will not know what this is (a test for something called babblekit?) (I'm not going to block it due to this name and folder though :) )
7c52dff
to
e5cf620
Compare
@aescolar and @Thalley I removed the timeout callback machinery. @aescolar it seems I can't call |
from all exit hooks you need to be careful that they may reenter (specially if you are yourself calling exit from them) |
Ah but then it seems anything with trace level I tried calling |
This code can be found (kinda) duplicated all over `tests/bsim/bluetooth`. Put it in a common place. Refactoring the current tests will be done in a future commit. Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
e5cf620
to
30a5615
Compare
This test is intended to teach the conventions and best practices to a potential contributor that wants to add a test, for say a new feature. It is liberally commented on purpose, so new contributors don't have to spend two weeks understanding the intricacies of the simulator, the bsim test framework, the native builds, backchannels, etc.. Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Someone should really fix this properly.. Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
30a5615
to
11e2757
Compare
#define TEST_START(msg, ...) \ | ||
do { \ | ||
bst_result = In_progress; \ | ||
bs_trace_info_time(2, "Test start: " msg "\n", ##__VA_ARGS__); \ |
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.
PSA: Explanation of , ##__VA_ARGS__
: https://stackoverflow.com/questions/5588855/standard-alternative-to-gccs-va-args-trick
This test is intended to teach the conventions and best practices to a
potential contributor that wants to add a test, for say a new feature.
It is liberally commented on purpose, so new contributors don't have to
spend two weeks understanding the intricacies of the simulator, the bsim
test framework, the native builds, backchannels, etc..