-
-
Notifications
You must be signed in to change notification settings - Fork 200
fix: re-add setting thread name #1424
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f0f7b85
add unit test
JoshuaMoelans 441d37d
only run on test_unit_transport
JoshuaMoelans c87623f
add `sentry__bgworker_setname` again
JoshuaMoelans ccc53f0
Update tests/unit/test_basic.c
JoshuaMoelans 114f42b
update CHANGELOG.md
JoshuaMoelans File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,10 @@ | ||
| #include "sentry_core.h" | ||
| #include "sentry_database.h" | ||
| #include "sentry_options.h" | ||
| #include "sentry_string.h" | ||
| #include "sentry_sync.h" | ||
| #include "sentry_testsupport.h" | ||
| #include "sentry_transport.h" | ||
|
|
||
| static void | ||
| send_envelope_test_basic(sentry_envelope_t *envelope, void *data) | ||
|
|
@@ -304,3 +307,43 @@ SENTRY_TEST(capture_minidump_invalid_path) | |
|
|
||
| sentry_close(); | ||
| } | ||
|
|
||
| SENTRY_TEST(basic_transport_thread_name) | ||
| { | ||
| const char *expected_thread_name = "sentry::worker_thread"; | ||
|
|
||
| SENTRY_TEST_OPTIONS_NEW(options); | ||
| sentry_options_set_dsn(options, "https://[email protected]/42"); | ||
| sentry_options_set_transport_thread_name(options, expected_thread_name); | ||
|
|
||
| // Initialize sentry which should start the transport and set the thread | ||
| // name | ||
| TEST_CHECK_INT_EQUAL(sentry_init(options), 0); | ||
|
|
||
| // Access the transport through runtime options to check if thread name was | ||
| // set | ||
| SENTRY_WITH_OPTIONS (runtime_options) { | ||
| TEST_ASSERT(!!runtime_options->transport); | ||
|
|
||
| // Get the bgworker from the transport (for HTTP transports) | ||
| sentry_bgworker_t *bgworker | ||
| = (sentry_bgworker_t *)sentry__transport_get_bgworker( | ||
| runtime_options->transport); | ||
| TEST_ASSERT(!!bgworker); | ||
|
|
||
| // Check if the thread name was properly set on the bgworker | ||
| const char *actual_thread_name | ||
| = sentry__bgworker_get_thread_name(bgworker); | ||
|
|
||
| // TODO This test should fail initially because winhttp transport | ||
| // doesn't call sentry__bgworker_setname() like curl transport does. | ||
JoshuaMoelans marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| if (actual_thread_name) { | ||
| TEST_CHECK_STRING_EQUAL(actual_thread_name, expected_thread_name); | ||
| } else { | ||
| TEST_CHECK(false); // Fail if thread_name is NULL | ||
| TEST_MSG("Transport thread name was not set "); | ||
| } | ||
| } | ||
|
|
||
| sentry_close(); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.