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

Fix thread unit tests #268

Merged
merged 1 commit into from
Dec 7, 2024
Merged

Conversation

kannibalox
Copy link
Contributor

Convert m_poking back to a bool due to test_and_set having different return values than compare_exchange. Without this test_thread_base fails:

test_thread_base.cc:61:Assertion
Test name: test_thread_base::test_lifecycle
assertion failed
- Expression: wait_for_true(std::bind(&test_thread::is_test_state, thread, test
_thread::TEST_PRE_STOP))

test_thread_base.cc:130:Assertion
Test name: test_thread_base::test_interrupt
assertion failed
- Expression: wait_for_true(std::bind(&test_thread::is_not_test_flags, thread, 
test_thread::test_flag_do_work))

Failures !!!
Run: 27   Failure total: 2   Failures: 2   Errors: 0
FAIL: LibTorrent_Test_Torrent_Utils

The first failure is fixed by the test_thread.h change, the second by the m_poking change.

Convert m_poking back to a bool due to test_and_set having different
return values than compare_exchange

Also minor typo fix
@@ -73,6 +70,8 @@ thread_interrupt::event_read() {
throw internal_error("Invalid result reading from thread_interrupt socket.");

instrumentation_update(INSTRUMENTATION_POLLING_INTERRUPT_READ_EVENT, 1);

m_poking = false;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't dig into exactly why, but moving this back down is indeed required for the tests to succeed.

@rakshasa rakshasa merged commit d1d0445 into rakshasa:master Dec 7, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants