-
Notifications
You must be signed in to change notification settings - Fork 35
[CTL] Add support for defaults #1216
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
Conversation
2ec6659
to
408f2c4
Compare
umf_os_memory_provider_params_handle_t os_memory_provider_params = NULL; | ||
umf_memory_provider_ops_t *os_provider_ops = umfOsMemoryProviderOps(); | ||
if (os_provider_ops == NULL) { | ||
GTEST_SKIP() << "OS memory provider is not supported!"; |
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.
Instead of adding such skip msg, I guess we should add this test in CMake only when OS prov and disjoint pool are enabled.
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's what for we've added a dummy function.
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.
yy? not sure what you mean
@@ -35,7 +35,7 @@ TEST_F(test, ctl_by_handle_os_provider) { | |||
|
|||
int ipc_enabled = 0xBAD; | |||
ret = umfCtlGet("umf.provider.by_handle.params.ipc_enabled", hProvider, |
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 any test for umfCtlGet
that pass something else than 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.
As I see it's not a part of this PR
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.
You're adding a new paramter and without testing values other than 0 it's not properly tested. At least mark in tests a TODO for future.
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 callback discard completely size, so such test will cover completely nothing and will test nothing.
static int CTL_READ_HANDLER(ipc_enabled)(void *ctx,
umf_ctl_query_source_t source,
void *arg, size_t size,
umf_ctl_index_utlist_t *indexes,
const char *extra_name,
umf_ctl_query_type_t query_type) {
/* suppress unused-parameter errors */
(void)source, (void)indexes, (void)ctx, (void)extra_name, (void)query_type,
(void)size;
int *arg_out = arg;
os_memory_provider_t *os_provider = (os_memory_provider_t *)ctx;
*arg_out = os_provider->IPC_enabled;
return 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'm reading your last comment as "size is useless" ;)
Let me re-phrase - whenever size is used, please add a test with various values (user may give some input we may not expect, e.g. on wrong assumptions on how this func works) or mark a TODO for adding tests in the future.
b7324ed
to
8e3a2fc
Compare
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.
umf_result_t umfCtlExec(const char *name, void *ctx, void *arg); should also have arg size imho.
338947a
to
29380ba
Compare
@@ -35,7 +35,7 @@ TEST_F(test, ctl_by_handle_os_provider) { | |||
|
|||
int ipc_enabled = 0xBAD; | |||
ret = umfCtlGet("umf.provider.by_handle.params.ipc_enabled", hProvider, |
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.
You're adding a new paramter and without testing values other than 0 it's not properly tested. At least mark in tests a TODO for future.
umf_os_memory_provider_params_handle_t os_memory_provider_params = NULL; | ||
umf_memory_provider_ops_t *os_provider_ops = umfOsMemoryProviderOps(); | ||
if (os_provider_ops == NULL) { | ||
GTEST_SKIP() << "OS memory provider is not supported!"; |
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.
yy? not sure what you mean
a8a7fe8
to
56b5408
Compare
33ceeeb
to
77692e1
Compare
0c02aaa
to
f7c7900
Compare
Please, re-review. |
@KFilipek please work with other reviewers to close all conversations |
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.
Pull Request Overview
This PR introduces support for default values in the CTL interface and updates the CTL query API across the codebase by adding an extra size parameter. Key changes include updates to unit tests to verify default value handling (including multithreaded tests), modifications to CTL handler APIs in providers, pools, and CTL modules, and corresponding documentation updates.
Reviewed Changes
Copilot reviewed 21 out of 23 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
test/ctl/ctl_unittest.cpp | Added extra size parameter to ctl_query calls in unit tests. |
test/ctl/ctl_api.cpp | Extended tests with default handling and updated query template. |
test/ctl/ctl_debug.c | Updated CTL handlers with new extra size parameter. |
src/provider/.c & src/provider/.h | Updated CTL query signatures to include the size parameter. |
src/pool/*.c | Adjusted CTL query calls and added default value integration. |
src/memory_provider.c, src/memory_pool.c | Updated CTL API use and logic for setting defaults. |
src/libumf.c, src/ctl/ctl.[ch] | Updated CTL API function signatures and internal query logic. |
include/umf/*.h | Updated documentation and API prototypes with new size parameter. |
benchmark/benchmark_umf.hpp | Minor update to supply size parameter for CTL queries. |
Files not reviewed (2)
- src/libumf.def: Language not supported
- test/CMakeLists.txt: Language not supported
Comments suppressed due to low confidence (1)
src/memory_pool.c:160
- Using strstr to match the default entry with the result of ops->get_name(NULL) may lead to unintended substring matches. Consider using a strict equality comparison to correctly detect a matching default property.
if (CTL_DEFAULT_ENTRIES[i][0] != '\0' && strstr(CTL_DEFAULT_ENTRIES[i], ops->get_name(NULL))) {
AI suggested Co-authored-by: Copilot <[email protected]>
src/ctl/ctl.h
Outdated
umf_ctl_node_t root[CTL_MAX_ENTRIES]; | ||
int first_free; | ||
}; | ||
|
||
struct ctl *ctl_new(void); |
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.
bump
continued in #1320 |
[CTL] Add support for defaults
Description
This PR introduces initial support for setting up default values.
Checklist