-
Notifications
You must be signed in to change notification settings - Fork 15
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
hil: ota: add test for observation after restart #506
base: main
Are you sure you want to change the base?
Conversation
be677d4
to
6d30539
Compare
Visit the preview URL for this PR (updated for commit 76e94fb): https://golioth-firmware-sdk-doxygen-dev--pr506-szczys-ota-add-bpmcghzk.web.app (expires Thu, 13 Jun 2024 14:40:00 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: a9993e61697a3983f3479e468bcb0b616f9a0578 |
b45e641
to
70e89f7
Compare
tests/hil/tests/ota/test.c
Outdated
else if (golioth_sys_sem_take(restart_pending_sem, 0)) | ||
{ | ||
GLTH_LOGI(TAG, "Restart successful"); | ||
golioth_sys_sem_give(restart_test_begin_sem); |
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.
golioth_sys_sem_give(restart_test_begin_sem); |
We don't need to reset any semaphores for this test. We want each to run once and only once, to prevent restarting the test when the artifact is rolled back in the teardown phase of the test.
tests/hil/tests/ota/test.c
Outdated
static void test_restart(void) | ||
{ | ||
|
||
if (golioth_sys_sem_take(restart_test_begin_sem, 0)) |
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.
I don't think we need to use semaphores inside of this function. We're not performing mutual exclusion between multiple threads, and we're not signaling from one thread to another.
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.
Sounds good, I've converted this to use a bool variable.
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 feels a lot more straightforward!
Test that the firmware update observation is reestablished after a client restart. Signed-off-by: Mike Szczys <[email protected]>
70e89f7
to
76e94fb
Compare
Test that the firmware update observation is reestablished after a client restart.
resolves https://github.com/golioth/firmware-issue-tracker/issues/547