Repository navigation
add missing negative providers tests - #1478
Conversation
ca1d1db to
1d1e9e8
Compare
35a9aac to
c23391a
Compare
c23391a to
d81df3f
Compare
8ebc885 to
55f532b
Compare
|
|
55f532b to
d9b697a
Compare
There was a problem hiding this comment.
Overall LGTM.
Could you add a test with a very long name? All ...ParamsSetName() functions use strncpy and cut a long name without an error. The test can check that umfMemoryProviderGetName() returns the cut name and that it ends with '\0'. You can put it next to params_NULL_name in provider_file_memory.cpp and provider_devdax_memory.cpp.
| // test all valid combinations | ||
| for (unsigned protection = UMF_PROTECTION_NONE; | ||
| protection < (UMF_PROTECTION_MAX - 1) << 1; ++protection) { | ||
| ret = umfFileMemoryProviderParamsSetProtection(params, protection); |
There was a problem hiding this comment.
This test can never fail. umfFileMemoryProviderParamsSetProtection() only checks
that hParams is not NULL. It accepts any value. The devdax provider checks the
flags and has a params_invalid_protection_flag test, but the file provider does
not check them. Please add the same check to the file provider and add a
params_invalid_protection_flag test. Or remove this test.
There was a problem hiding this comment.
check + new test added
| umf_result = umfDevDaxMemoryProviderParamsSetProtection(nullptr, 0); | ||
| EXPECT_EQ(umf_result, UMF_RESULT_ERROR_NOT_SUPPORTED); | ||
|
|
||
| umf_result = umfDevDaxMemoryProviderParamsSetName(params, "test"); |
There was a problem hiding this comment.
nit: params is always nullptr here. The other calls in this test use
nullptr directly. Please use nullptr here too. It is easier to read.
| umfFileMemoryProviderParamsSetVisibility(nullptr, UMF_MEM_MAP_PRIVATE); | ||
| EXPECT_EQ(umf_result, UMF_RESULT_ERROR_NOT_SUPPORTED); | ||
|
|
||
| umf_result = umfFileMemoryProviderParamsSetName(params, "test"); |
There was a problem hiding this comment.
nit: same as in the devdax test. Please use nullptr instead of params.
c0d1349 to
a6bdba3
Compare
add missing negative providers tests