-
Notifications
You must be signed in to change notification settings - Fork 301
test: add tests for the ToxAV multithreading modes #1847
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
base: master
Are you sure you want to change the base?
Conversation
649a24e to
08fc8f2
Compare
auto_tests/toxav_mt_test.cc
Outdated
|
|
||
| auto poll_state = [](AV_State &av, uint32_t expected, uint32_t max_tries, | ||
| uint32_t delay_ms) -> bool { | ||
| uint32_t i; |
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.
Unfortunately, this is C++, and cimple doesn't understand C++, so here comes the manual diagnostic:
toxav_mt_test.cc:408: variable `i' can be reduced in scope
toxav_mt_test.cc:410: possibly to here
auto_tests/toxav_mt_test.cc
Outdated
| // temporarily add bootstrap node to end of toxes, so we can iterate all | ||
| toxes.push_back(std::move(bootstrap)); | ||
|
|
||
| uint32_t bootstrap_iteration = 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'd move this down to just before the for-loop, and move the initialisation into the for-init-stmt.
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.
Done
|
Huh, me pushing a commit broke Github Actions on this PR. @sudden6 try removing my commit from the PR and then adding it back and pushing it from your account, maybe that will fix it. Keep the commit as it is, such that it's a1247a7 hash, just push it from your account instead. For the context, GitHub has disabled Actions on my account for some reason. |
b977971 to
77fb904
Compare
auto_tests/toxav_mt_test.cc
Outdated
| ToxAV_Ptr toxAV_; | ||
|
|
||
| std::atomic_bool stop_threads; | ||
| std::atomic_bool incomming; |
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.
"incoming"
|
|
||
| std::atomic_bool video_received; | ||
| std::atomic_bool audio_received; | ||
| std::string name_; |
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.
What's the convention that makes name into name_ but leaves audio_received without trailing _?
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.
unified it, all members now are snek_ case
auto_tests/toxav_mt_test.cc
Outdated
|
|
||
| } // namespace | ||
|
|
||
| static void test_av(bool combined) { |
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.
Why is this outside the namespace{}?
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.
Moved inside
auto_tests/toxav_mt_test.cc
Outdated
| std::mutex tox_loop_lock; | ||
|
|
||
| Tox_Ptr tox_; | ||
| bool combined_; |
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.
combined_av is a little clearer on what is being combined here.
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.
Done
auto_tests/toxav_mt_test.cc
Outdated
|
|
||
| // Make lines shorter | ||
| using Clock = std::chrono::high_resolution_clock; | ||
| using TimePoint = std::chrono::time_point<Clock>; |
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.
The naming convention in this file is a bit all over the place. E.g. TimePoint and Tox_Ptr. Also, some top level functions are snake_case, others are dromedaryCase. Since you're not using the Tox naming conventions (which are somewhat self-described by all the other sources), can you briefly describe them at the top of the file? Just a list of "kind of identifier: naming convention".
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.
Should be mirroring random_testing.cc now
|
|
||
| static void t_accept_friend_request_cb(Tox *m, const uint8_t *public_key, const uint8_t *data, | ||
| size_t length, void *userdata) { | ||
| if (length == 7 && std::memcmp("gentoo", data, 7) == 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.
Do we expect other friend requests to arrive? Maybe we should assert that we don't.
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.
Should be fixed now
auto_tests/toxav_mt_test.cc
Outdated
| static void t_accept_friend_request_cb(Tox *m, const uint8_t *public_key, const uint8_t *data, | ||
| size_t length, void *userdata) { | ||
| if (length == 7 && std::memcmp("gentoo", data, 7) == 0) { | ||
| ck_assert(tox_friend_add_norequest(m, public_key, nullptr) != (uint32_t)-1); |
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.
uint32_t(-1) or static_cast (I think I'd prefer the former, but the latter might be slightly clearer).
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.
Fixed and opened #1855 because I copied this.
dd0dd4e to
4cf603c
Compare
| endif() | ||
| endfunction() | ||
|
|
||
| function(auto_test_cc target) |
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.
Maybe we can pass the suffix and avoid duplicating this? It's literally 1 byte difference between the two macros.
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.
Does this work for you?
0cc8c8f to
4cbb508
Compare
fee16c8 to
eae5537
Compare
faa0eb2 to
cb57cf7
Compare
4a1e2d8 to
0b604ce
Compare
This tests tox_iterate in a separate thread, and the two ToxAV modes.
0b604ce to
ebbe631
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1847 +/- ##
==========================================
+ Coverage 81.11% 81.63% +0.51%
==========================================
Files 81 82 +1
Lines 16052 16236 +184
==========================================
+ Hits 13021 13254 +233
+ Misses 3031 2982 -49 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This tests tox_iterate in a separate thread, and the two ToxAV modes.
This change is